mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 20:00:00 +08:00
fix: web search references missing caused by early reset (#9328)
This commit is contained in:
parent
cdca8c0ed7
commit
f8120c2ebb
@ -40,7 +40,6 @@ export const createCitationCallbacks = (deps: CitationCallbacksDependencies) =>
|
||||
status: MessageBlockStatus.SUCCESS
|
||||
}
|
||||
blockManager.smartBlockUpdate(citationBlockId, changes, MessageBlockType.CITATION, true)
|
||||
citationBlockId = null
|
||||
} else {
|
||||
logger.error('[onExternalToolComplete] citationBlockId is null. Cannot update.')
|
||||
}
|
||||
@ -121,6 +120,9 @@ export const createCitationCallbacks = (deps: CitationCallbacksDependencies) =>
|
||||
},
|
||||
|
||||
// 暴露给外部的方法,用于textCallbacks中获取citationBlockId
|
||||
getCitationBlockId: () => citationBlockId
|
||||
getCitationBlockId: () => citationBlockId,
|
||||
setCitationBlockId: (id: string | null) => {
|
||||
citationBlockId = id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,8 @@ export const createCallbacks = (deps: CallbacksDependencies) => {
|
||||
blockManager,
|
||||
getState,
|
||||
assistantMsgId,
|
||||
getCitationBlockId: citationCallbacks.getCitationBlockId
|
||||
getCitationBlockId: citationCallbacks.getCitationBlockId,
|
||||
setCitationBlockId: citationCallbacks.setCitationBlockId
|
||||
})
|
||||
|
||||
// 组合所有回调
|
||||
|
||||
@ -12,10 +12,11 @@ interface TextCallbacksDependencies {
|
||||
getState: any
|
||||
assistantMsgId: string
|
||||
getCitationBlockId: () => string | null
|
||||
setCitationBlockId: (id: string | null) => void
|
||||
}
|
||||
|
||||
export const createTextCallbacks = (deps: TextCallbacksDependencies) => {
|
||||
const { blockManager, getState, assistantMsgId, getCitationBlockId } = deps
|
||||
const { blockManager, getState, assistantMsgId, getCitationBlockId, setCitationBlockId } = deps
|
||||
|
||||
// 内部维护的状态
|
||||
let mainTextBlockId: string | null = null
|
||||
@ -62,6 +63,7 @@ export const createTextCallbacks = (deps: TextCallbacksDependencies) => {
|
||||
}
|
||||
blockManager.smartBlockUpdate(mainTextBlockId, changes, MessageBlockType.MAIN_TEXT, true)
|
||||
mainTextBlockId = null
|
||||
setCitationBlockId(null)
|
||||
} else {
|
||||
logger.warn(
|
||||
`[onTextComplete] Received text.complete but last block was not MAIN_TEXT (was ${blockManager.lastBlockType}) or lastBlockId is null.`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user