mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
fix(openai): fix stop_reason null, zero usage fields and max_tokens forwarding
- Fix stop_reason always null in assembled AssistantMessage by applying the value captured from message_delta event - Reset partialMessage to null after message_stop to prevent duplicate AssistantMessage emission causing doubled content in next API request - Forward computed maxTokens into buildOpenAIRequestBody as max_tokens so OpenAI-compatible endpoints receive the intended output cap - Extract assembleFinalAssistantOutputs helper to deduplicate message assembly logic between message_stop handler and post-loop fallback - Fix test helper to use events parameter instead of hidden global - Add regression test for max_tokens request forwarding Signed-off-by: guunergooner <tongchao0923@gmail.com>
This commit is contained in:
@@ -76,6 +76,7 @@ function getLocale(): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
/** Return the epoch-ms of the start of the local calendar day for `d`. */
|
||||
function startOfDay(d: Date): number {
|
||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user