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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
src/pages/Chat/Chat.tsx
+14
-17
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,26 +330,23 @@ export const Chat: React.FC = () => {
...
@@ -330,26 +330,23 @@ 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
()
const
res
=
await
fetchToolList
({
userRoles
})
const
res
=
await
fetchToolList
({
userRoles
})
if
(
res
?.
data
)
{
if
(
res
?.
data
)
{
const
tool
=
res
.
data
.
find
((
t
:
any
)
=>
t
.
toolId
===
currentToolId
)
const
tool
=
res
.
data
.
find
((
t
:
any
)
=>
t
.
toolId
===
currentToolId
)
if
(
tool
?.
toolName
)
{
if
(
tool
?.
toolName
)
{
setCurrentToolName
(
tool
.
toolName
)
setCurrentToolName
(
tool
.
toolName
)
}
}
}
}
}
catch
(
error
)
{
console
.
error
(
'获取工具列表失败:'
,
error
)
}
}
}
else
{
catch
(
error
)
{
// 通用模式
console
.
error
(
'获取工具列表失败:'
,
error
)
setCurrentToolName
(
'通用模式'
)
}
}
}
}
getToolNameFromToolId
()
getToolNameFromToolId
()
...
...
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