Merge pull request #114 from Askhz/fix/thinking-model-duplicate-response
fix(serve): skip thinking-only message fragments to prevent duplicate response in cs-cloud
This commit is contained in:
commit
754157fd88
|
|
@ -26,7 +26,7 @@ import {
|
|||
createFileStateCacheWithSizeLimit,
|
||||
type FileStateCache,
|
||||
} from './fileStateCache.js'
|
||||
import { isNotEmptyMessage, normalizeMessages } from './messages.js'
|
||||
import { isNotEmptyMessage, isThinkingMessage, normalizeMessages } from './messages.js'
|
||||
import { expandPath } from './path.js'
|
||||
import type {
|
||||
inputSchema as permissionToolInputSchema,
|
||||
|
|
@ -117,6 +117,13 @@ export function* normalizeMessage(message: Message): Generator<SDKMessage> {
|
|||
if (!isNotEmptyMessage(_)) {
|
||||
continue
|
||||
}
|
||||
// Skip thinking-only messages: normalizeMessages splits a multi-block
|
||||
// AssistantMessage (e.g. [thinking, text]) into one message per block.
|
||||
// Emitting the thinking-only fragment causes serve mode to send a second
|
||||
// session.message event, which cs-cloud renders as a duplicate response.
|
||||
if (isThinkingMessage(_)) {
|
||||
continue
|
||||
}
|
||||
yield {
|
||||
type: 'assistant',
|
||||
message: _.message,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user