Commit fb2b017f by Liu

delete:切换工具按钮时不新建会话

parent 9112f406
......@@ -8,7 +8,7 @@ import type { RootState } from '@/store'
import SendIcon from '@/assets/svg/send.svg?react'
import { type WithAuthProps, withAuth } from '@/auth/withAuth'
import { useAppDispatch, useAppSelector } from '@/store/hook'
import { clearCurrentToolId, createConversation, setCurrentToolId } from '@/store/conversationSlice'
import { clearCurrentToolId, setCurrentToolId } from '@/store/conversationSlice'
import { fetchToolList } from '@/api/home'
import { getUserRolesForApi, safeSessionStorageGetItem, safeSessionStorageRemoveItem, safeSessionStorageSetItem } from '@/lib/utils'
......@@ -235,16 +235,16 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
newSearchParams.delete('toolId')
setSearchParams(newSearchParams, { replace: true })
}
try {
await dispatch(createConversation({
conversationData: {},
shouldNavigate: true,
shouldSendQuestion: '',
})).unwrap()
}
catch (error) {
console.error('创建会话失败:', error)
}
// try {
// await dispatch(createConversation({
// conversationData: {},
// shouldNavigate: true,
// shouldSendQuestion: '',
// })).unwrap()
// }
// catch (error) {
// console.error('创建会话失败:', error)
// }
}
// 处理工具按钮点击:先创建新会话,再切换工具
......@@ -264,16 +264,16 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
setSessionToolId(tool.toolId)
// 先通知上层更新欢迎语(即便后续接口异常也能生效)
onToolClick?.(false, tool.toolId, tool.toolName, true)
try {
await dispatch(createConversation({
conversationData: { toolId: tool.toolId },
shouldNavigate: true,
shouldSendQuestion: '',
})).unwrap()
}
catch (error) {
console.error('创建会话失败:', error)
}
// try {
// await dispatch(createConversation({
// conversationData: { toolId: tool.toolId },
// shouldNavigate: true,
// shouldSendQuestion: '',
// })).unwrap()
// }
// catch (error) {
// console.error('创建会话失败:', error)
// }
}
useEffect(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment