mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-04 05:56:08 +00:00
fix: phone ui
This commit is contained in:
@@ -4,12 +4,12 @@ import { immer } from 'zustand/middleware/immer';
|
||||
|
||||
import { ChatHistoryItemType } from '@/types/chat';
|
||||
import type { InitChatResponse } from '@/api/response/chat';
|
||||
import { getChatHistory } from '@/api/chat';
|
||||
import { HUMAN_ICON } from '@/constants/chat';
|
||||
import { delChatHistoryById, getChatHistory } from '@/api/chat';
|
||||
|
||||
type State = {
|
||||
history: ChatHistoryItemType[];
|
||||
loadHistory: (data: { appId?: string }) => Promise<null>;
|
||||
delHistory(history: string): Promise<void>;
|
||||
updateHistory: (history: ChatHistoryItemType) => void;
|
||||
chatData: InitChatResponse;
|
||||
setChatData: (e: InitChatResponse | ((e: InitChatResponse) => InitChatResponse)) => void;
|
||||
@@ -63,6 +63,12 @@ export const useChatStore = create<State>()(
|
||||
});
|
||||
return null;
|
||||
},
|
||||
async delHistory(historyId) {
|
||||
set((state) => {
|
||||
state.history = state.history.filter((item) => item._id !== historyId);
|
||||
});
|
||||
await delChatHistoryById(historyId);
|
||||
},
|
||||
updateHistory(history) {
|
||||
const index = get().history.findIndex((item) => item._id === history._id);
|
||||
set((state) => {
|
||||
|
Reference in New Issue
Block a user