This commit is contained in:
2025-02-08 00:19:28 +08:00
parent 5b4a0507ae
commit c37a99f06d
3 changed files with 10 additions and 5 deletions

View File

@@ -54,7 +54,9 @@ const createMessageFromCurrentBuffer = (
tool_calls: tools.length > 0 ? tools : undefined,
// 补全其他必填字段的默认值(根据你的类型定义)
hide: false,
token: 0, // 需要实际的token计算逻辑
token: calculate_token_length(
chunkMessages.join("") + reasoningChunks.join("")
), // 需要实际的token计算逻辑
example: false,
audio: null,
logprobs: null,
@@ -284,7 +286,7 @@ export default function ChatBOX() {
token: data.usage?.completion_tokens_details
? data.usage.completion_tokens -
data.usage.completion_tokens_details.reasoning_tokens
: (data.usage.completion_tokens ?? calculate_token_length(msg.content)),
: data.usage.completion_tokens ?? calculate_token_length(msg.content),
example: false,
audio: null,
logprobs: data.choices[0]?.logprobs,