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
94e0db57
Commit
94e0db57
authored
Jan 07, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 切换工具时重置按钮
parent
a058d446
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
src/components/ChatEditor/index.tsx
+5
-0
src/pages/Chat/Chat.tsx
+4
-0
No files found.
src/components/ChatEditor/index.tsx
View file @
94e0db57
...
...
@@ -9,6 +9,7 @@ import SendIcon from '@/assets/svg/send.svg?react'
import
{
type
WithAuthProps
,
withAuth
}
from
'@/auth/withAuth'
import
{
useAppDispatch
,
useAppSelector
}
from
'@/store/hook'
import
{
clearCurrentToolId
,
setCurrentToolId
}
from
'@/store/conversationSlice'
import
{
setIsAsking
}
from
'@/store/chatSlice'
import
{
fetchToolList
}
from
'@/api/home'
import
{
getUserRolesForApi
,
safeSessionStorageGetItem
,
safeSessionStorageRemoveItem
,
safeSessionStorageSetItem
}
from
'@/lib/utils'
import
{
fetchSessionConversationId
,
fetchUserQaRecordPage
}
from
'@/api/conversation'
...
...
@@ -299,6 +300,8 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
const
handleGeneralClick
=
async
()
=>
{
if
(
!
checkAuth
())
return
// 重置提交按钮状态
dispatch
(
setIsAsking
(
false
))
// 先更新 Redux,确保状态同步
dispatch
(
clearCurrentToolId
())
// 立即更新本地状态,让 UI 立即响应
...
...
@@ -349,6 +352,8 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
// 处理工具按钮点击:先创建新会话,再切换工具
const
handleToolClick
=
async
(
tool
:
any
)
=>
{
// 重置提交按钮状态
dispatch
(
setIsAsking
(
false
))
if
(
tool
.
toolName
===
'数据助手'
)
{
safeSessionStorageSetItem
(
'showToolQuestion'
,
'true'
)
setShowToolQuestion
(
true
)
...
...
src/pages/Chat/Chat.tsx
View file @
94e0db57
...
...
@@ -274,6 +274,8 @@ export const Chat: React.FC = () => {
// 处理错误
if
(
msg
?.
type
===
'ERROR'
)
{
// 出错时需要重置 isAsking 状态
dispatch
(
setIsAsking
(
false
))
// 如果是 AbortError,不显示错误
if
(
msg
.
content
?.
name
===
'AbortError'
)
{
return
...
...
@@ -293,6 +295,8 @@ export const Chat: React.FC = () => {
return
}
if
(
msg
.
type
===
'END'
)
{
// 流式请求正常结束时重置 isAsking 状态
dispatch
(
setIsAsking
(
false
))
if
(
isNew
)
{
setTimeout
(()
=>
{
dispatch
(
fetchConversations
())
...
...
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