fix: streaming

This commit is contained in:
Han Xiao
2025-02-09 15:09:48 +08:00
parent 6828e894e6
commit de2bc3771b
2 changed files with 4 additions and 3 deletions

View File

@@ -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>

View File

@@ -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
}]