fix(chat): update conversation handling and improve response logic

This commit is contained in:
twwu
2026-04-17 16:22:22 +08:00
parent 73ff36cb0e
commit ea58415f88
3 changed files with 8 additions and 3 deletions

View File

@@ -438,7 +438,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
if (conversationId === currentConversationId)
handleNewConversation()
handleUpdateConversationList()
}, [isInstalledApp, appId, t, handleUpdateConversationList, handleNewConversation, currentConversationId, conversationDeleting])
}, [conversationDeleting, currentConversationId, handleNewConversation, handleUpdateConversationList, appSourceType, appId, t])
const [conversationRenaming, setConversationRenaming] = useState(false)
const handleRenameConversation = useCallback(async (conversationId: string, newName: string, { onSuccess }: Callback) => {
if (conversationRenaming)
@@ -464,7 +464,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
finally {
setConversationRenaming(false)
}
}, [isInstalledApp, appId, t, conversationRenaming, originConversationList])
}, [conversationRenaming, t, appSourceType, appId, originConversationList])
const handleNewConversationCompleted = useCallback((newConversationId: string) => {
setNewConversationId(newConversationId)
handleConversationIdInfoChange(newConversationId)

View File

@@ -303,6 +303,7 @@ const Answer: FC<AnswerProps> = ({
{
typeof item.siblingCount === 'number'
&& item.siblingCount > 1
&& !responding
&& (
<ContentSwitch
count={item.siblingCount}
@@ -408,7 +409,9 @@ const Answer: FC<AnswerProps> = ({
}
{
typeof item.siblingCount === 'number'
&& item.siblingCount > 1 && (
&& item.siblingCount > 1
&& !responding
&& (
<ContentSwitch
count={item.siblingCount}
currentIndex={item.siblingIndex}

View File

@@ -1233,6 +1233,8 @@ export const useChat = (
})
},
onWorkflowStarted: ({ workflow_run_id, task_id, conversation_id, message_id }) => {
handleResponding(true)
hasStopRespondedRef.current = false
// If there are no streaming messages, we still need to set the conversation_id to avoid create a new conversation when regeneration in chat-flow.
if (conversation_id) {
conversationIdRef.current = conversation_id