Commit 0bdbb145 by Liu

fix:问候语逻辑

parent 79258d30
...@@ -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])
......
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