Commit 67a904c3 by Liu

fix: 历史会话记录增加toolID

parent bc0509b3
...@@ -8,7 +8,7 @@ import type { RootState } from '@/store' ...@@ -8,7 +8,7 @@ import type { RootState } from '@/store'
import SendIcon from '@/assets/svg/send.svg?react' import SendIcon from '@/assets/svg/send.svg?react'
import { type WithAuthProps, withAuth } from '@/auth/withAuth' import { type WithAuthProps, withAuth } from '@/auth/withAuth'
import { useAppDispatch, useAppSelector } from '@/store/hook' import { useAppDispatch, useAppSelector } from '@/store/hook'
import { clearBusinessInsightWorkflow, clearCurrentToolId, setCurrentToolId } from '@/store/conversationSlice' import { clearBusinessInsightWorkflow, clearCurrentToolId, fetchConversations, setCurrentToolId } from '@/store/conversationSlice'
import { setIsAsking } from '@/store/chatSlice' import { setIsAsking } from '@/store/chatSlice'
import { fetchToolList } from '@/api/home' import { fetchToolList } from '@/api/home'
import { safeSessionStorageGetItem, safeSessionStorageRemoveItem, safeSessionStorageSetItem } from '@/lib/utils' import { safeSessionStorageGetItem, safeSessionStorageRemoveItem, safeSessionStorageSetItem } from '@/lib/utils'
...@@ -434,6 +434,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth, ...@@ -434,6 +434,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
} }
} }
} }
dispatch(fetchConversations(normalizedToolId))
sessionStorage.removeItem('toolHistoryLoading') sessionStorage.removeItem('toolHistoryLoading')
} }
} }
......
...@@ -25,14 +25,17 @@ const initialState: ConversationState = { ...@@ -25,14 +25,17 @@ const initialState: ConversationState = {
export const fetchConversations = createAsyncThunk( export const fetchConversations = createAsyncThunk(
'conversation/fetchConversations', 'conversation/fetchConversations',
async (_, { rejectWithValue }) => { async (toolId?: string, { rejectWithValue }) => {
try { try {
await waitForToken() await waitForToken()
// 调用真实接口获取会话列表 const requestData: Record<string, any> = {
const response = await fetchQueryUserConversationPage({
pageNum: 1, pageNum: 1,
pageSize: 100, pageSize: 100,
}) }
if (toolId) {
requestData.toolId = toolId
}
const response = await fetchQueryUserConversationPage(requestData)
const records = response.data?.records || [] const records = response.data?.records || []
return processConversationData(records) return processConversationData(records)
} }
......
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