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
0bdbb145
Commit
0bdbb145
authored
Dec 01, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:问候语逻辑
parent
79258d30
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
src/pages/Chat/Chat.tsx
+4
-7
No files found.
src/pages/Chat/Chat.tsx
View file @
0bdbb145
...
@@ -32,7 +32,7 @@ export const Chat: React.FC = () => {
...
@@ -32,7 +32,7 @@ export const Chat: React.FC = () => {
const
currentIdRef
=
useRef
<
string
|
undefined
>
(
id
)
const
currentIdRef
=
useRef
<
string
|
undefined
>
(
id
)
const
lastSentQuestionRef
=
useRef
<
string
>
(
''
)
const
lastSentQuestionRef
=
useRef
<
string
>
(
''
)
const
abortControllerRef
=
useRef
<
AbortController
|
null
>
(
null
)
const
abortControllerRef
=
useRef
<
AbortController
|
null
>
(
null
)
const
[
currentToolName
,
setCurrentToolName
]
=
useState
<
string
|
undefined
>
(
undefined
)
const
[
currentToolName
,
setCurrentToolName
]
=
useState
<
string
>
(
'通用模式'
)
/** 处理正常stream的数据 */
/** 处理正常stream的数据 */
const
handleStreamMesageData
=
(
msg
:
any
,
question
:
string
)
=>
{
const
handleStreamMesageData
=
(
msg
:
any
,
question
:
string
)
=>
{
...
@@ -330,8 +330,10 @@ export const Chat: React.FC = () => {
...
@@ -330,8 +330,10 @@ export const Chat: React.FC = () => {
// 根据 currentToolId 获取对应的 toolName
// 根据 currentToolId 获取对应的 toolName
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
currentToolId
)
return
const
getToolNameFromToolId
=
async
()
=>
{
const
getToolNameFromToolId
=
async
()
=>
{
if
(
currentToolId
)
{
try
{
try
{
// 使用统一的方法获取 userRoles(先同步路由到 localStorage,然后读取)
// 使用统一的方法获取 userRoles(先同步路由到 localStorage,然后读取)
const
userRoles
=
getUserRolesForApi
()
const
userRoles
=
getUserRolesForApi
()
...
@@ -347,11 +349,6 @@ export const Chat: React.FC = () => {
...
@@ -347,11 +349,6 @@ export const Chat: React.FC = () => {
console
.
error
(
'获取工具列表失败:'
,
error
)
console
.
error
(
'获取工具列表失败:'
,
error
)
}
}
}
}
else
{
// 通用模式
setCurrentToolName
(
'通用模式'
)
}
}
getToolNameFromToolId
()
getToolNameFromToolId
()
},
[
currentToolId
])
},
[
currentToolId
])
...
...
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