Skip to content

Commit 8da0b14

Browse files
committed
set stopReason as first choice
1 parent 65efda1 commit 8da0b14

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/routes/messages/non-stream-translation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ export function translateToAnthropic(
274274
// Merge content from all choices
275275
let allTextBlocks: Array<AnthropicTextBlock> = []
276276
let allToolUseBlocks: Array<AnthropicToolUseBlock> = []
277-
let stopReason: "stop" | "length" | "tool_calls" | "content_filter" | null = "stop" // default
278-
277+
let stopReason: "stop" | "length" | "tool_calls" | "content_filter" | null = null // default
278+
stopReason = response.choices[0]?.finish_reason ?? stopReason;
279+
279280
// Process all choices to extract text and tool use blocks
280281
for (const choice of response.choices) {
281282
const textBlocks = getAnthropicTextBlocks(choice.message.content)

0 commit comments

Comments
 (0)