Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
fb2b017f
Commit
fb2b017f
authored
Dec 23, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete:切换工具按钮时不新建会话
parent
9112f406
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
src/components/ChatEditor/index.tsx
+21
-21
No files found.
src/components/ChatEditor/index.tsx
View file @
fb2b017f
...
...
@@ -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
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment