forked from innovacion/Mayacontigo
ic
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
interface conversationState {
|
||||
assistantName: string;
|
||||
conversationId: string;
|
||||
receivingMsg: boolean;
|
||||
setConversationId: (newId: string) => void;
|
||||
setAssistantName: (newName: string) => void;
|
||||
setReceivingMsg: (newState: boolean) => void;
|
||||
}
|
||||
|
||||
export const conversationStore = create<conversationState>()((set) => ({
|
||||
assistantName: "",
|
||||
conversationId: "",
|
||||
receivingMsg: false,
|
||||
setConversationId: (newId) => set({ conversationId: newId }),
|
||||
setAssistantName: (newName) => set({ assistantName: newName }),
|
||||
setReceivingMsg: (newState) => set({ receivingMsg: newState }),
|
||||
}));
|
||||
14
.templates/rag/{{project_name}}/gui/store/messageStore.ts
Normal file
14
.templates/rag/{{project_name}}/gui/store/messageStore.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
interface messageState {
|
||||
messages: Array<{ user: boolean; content: string }>;
|
||||
pushMessage: (newMessage: { user: boolean; content: string }) => void;
|
||||
resetConversation: () => void;
|
||||
}
|
||||
|
||||
export const messageStore = create<messageState>()((set) => ({
|
||||
messages: [],
|
||||
pushMessage: (newMessage) =>
|
||||
set((state) => ({ messages: [...state.messages, newMessage] })),
|
||||
resetConversation: () => set(() => ({ messages: [] })),
|
||||
}));
|
||||
Reference in New Issue
Block a user