mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 21:01:32 +08:00
fix(消息重传): 单条无提及消息重传时使用助手模型
当重传单条无提及消息时,使用助手模型进行重传,其他情况保持原有逻辑
This commit is contained in:
parent
a4ba89b68e
commit
2e369174e7
@ -1164,16 +1164,31 @@ export const resendMessageThunk =
|
||||
const messagesToUpdateInRedux: { topicId: string; messageId: string; updates: Partial<Message> }[] = []
|
||||
|
||||
// 先处理已有的重传
|
||||
for (const originalMsg of assistantMessagesToReset) {
|
||||
if (assistantMessagesToReset.length === 1 && !userMessageToResend?.mentions?.length) {
|
||||
// 单条消息无mention时使用助手模型
|
||||
const originalMsg = assistantMessagesToReset[0]
|
||||
const blockIdsToDelete = [...(originalMsg.blocks || [])]
|
||||
const resetMsg = resetAssistantMessage(originalMsg, {
|
||||
status: AssistantMessageStatus.PENDING,
|
||||
updatedAt: new Date().toISOString()
|
||||
updatedAt: new Date().toISOString(),
|
||||
model: assistant.model
|
||||
})
|
||||
|
||||
resetDataList.push(resetMsg)
|
||||
allBlockIdsToDelete.push(...blockIdsToDelete)
|
||||
messagesToUpdateInRedux.push({ topicId, messageId: resetMsg.id, updates: resetMsg })
|
||||
} else {
|
||||
for (const originalMsg of assistantMessagesToReset) {
|
||||
const blockIdsToDelete = [...(originalMsg.blocks || [])]
|
||||
const resetMsg = resetAssistantMessage(originalMsg, {
|
||||
status: AssistantMessageStatus.PENDING,
|
||||
updatedAt: new Date().toISOString()
|
||||
})
|
||||
|
||||
resetDataList.push(resetMsg)
|
||||
allBlockIdsToDelete.push(...blockIdsToDelete)
|
||||
messagesToUpdateInRedux.push({ topicId, messageId: resetMsg.id, updates: resetMsg })
|
||||
}
|
||||
}
|
||||
|
||||
// 再处理新的重传(用户消息提及,但是现有助手消息中不存在提及的模型)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user