mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 06:19:05 +08:00
fix: non-streaming reasoning_content (#6308)
* fix: non-streaming reasoning_content * fix: streamline reasoning handling in OpenAIProvider
This commit is contained in:
parent
cc9b301fd4
commit
bc188d6724
@ -550,12 +550,16 @@ export default class OpenAIProvider extends BaseOpenAIProvider {
|
|||||||
// Separate onChunk calls for text and usage/metrics
|
// Separate onChunk calls for text and usage/metrics
|
||||||
let content = ''
|
let content = ''
|
||||||
stream.choices.forEach((choice) => {
|
stream.choices.forEach((choice) => {
|
||||||
|
const reasoning = choice.message.reasoning || choice.message.reasoning_content
|
||||||
// reasoning
|
// reasoning
|
||||||
if (choice.message.reasoning) {
|
if (reasoning) {
|
||||||
onChunk({ type: ChunkType.THINKING_DELTA, text: choice.message.reasoning })
|
onChunk({
|
||||||
|
type: ChunkType.THINKING_DELTA,
|
||||||
|
text: reasoning
|
||||||
|
})
|
||||||
onChunk({
|
onChunk({
|
||||||
type: ChunkType.THINKING_COMPLETE,
|
type: ChunkType.THINKING_COMPLETE,
|
||||||
text: choice.message.reasoning,
|
text: reasoning,
|
||||||
thinking_millsec: new Date().getTime() - start_time_millsec
|
thinking_millsec: new Date().getTime() - start_time_millsec
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user