mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 07:29:35 +08:00
fix: streaming
This commit is contained in:
@@ -210,6 +210,7 @@ ${allKeywords.join('\n')}
|
||||
if (allowAnswer) {
|
||||
actionSections.push(`
|
||||
<action-answer>
|
||||
- If <question> is a simple greeting, chit-chat, or general knowledge, provide the answer directly.
|
||||
- Provide final response only when 100% certain
|
||||
- Responses must be definitive (no ambiguity, uncertainty, or disclaimers)${allowReflect ? '\n- If doubts remain, use <action-reflect> instead' : ''}
|
||||
</action-answer>
|
||||
|
||||
@@ -105,7 +105,7 @@ app.post('/v1/chat/completions', (async (req: Request, res: Response) => {
|
||||
context.tokenTracker.trackUsage('evaluator', chunkTokens, TOKEN_CATEGORIES.REASONING);
|
||||
|
||||
// Only send chunk if there's content to send
|
||||
if (action.think) {
|
||||
if (action.thisStep.think) {
|
||||
const chunk: ChatCompletionChunk = {
|
||||
id: requestId,
|
||||
object: 'chat.completion.chunk',
|
||||
@@ -114,7 +114,7 @@ app.post('/v1/chat/completions', (async (req: Request, res: Response) => {
|
||||
system_fingerprint: 'fp_' + requestId,
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: { content: `<think>${action.think}</think>` },
|
||||
delta: { content: `${action.thisStep.think}` },
|
||||
logprobs: null,
|
||||
finish_reason: null
|
||||
}]
|
||||
@@ -175,7 +175,7 @@ app.post('/v1/chat/completions', (async (req: Request, res: Response) => {
|
||||
system_fingerprint: 'fp_' + requestId,
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: { content: '</think>' },
|
||||
delta: { content: '</think>\n\n' },
|
||||
logprobs: null,
|
||||
finish_reason: null
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user