andy-stack_vaultkeeper-ai/Stores/ConversationStore.ts
Andrew Beal 679a94d173 feature: implement fuzzysearch service
refactor: rename type interfaces to use I prefix convention

Standardize naming by adding I prefix to all interface types across the codebase (StreamChunk → IStreamChunk, SearchMatch → ISearchMatch, etc.). Also rename conversationStore.ts to ConversationStore.ts for consistency.
2025-10-29 19:35:19 +00:00

29 lines
1.3 KiB
TypeScript

import { writable } from 'svelte/store';
import type { Conversation } from 'Conversations/Conversation';
interface IConversationStoreState {
shouldReset: boolean;
conversationToLoad: { conversation: Conversation; filePath: string } | null;
shouldDeactivateEditMode: boolean;
}
function createConversationStore() {
const { subscribe, set, update } = writable<IConversationStoreState>({
shouldReset: false,
conversationToLoad: null,
shouldDeactivateEditMode: false
});
return {
subscribe,
reset: () => set({ shouldReset: true, conversationToLoad: null, shouldDeactivateEditMode: true }),
clearResetFlag: () => update(state => ({ ...state, shouldReset: false })),
loadConversation: (conversation: Conversation, filePath: string) =>
set({ shouldReset: false, conversationToLoad: { conversation, filePath }, shouldDeactivateEditMode: true }),
clearLoadFlag: () => update(state => ({ ...state, conversationToLoad: null })),
deactivateEditMode: () => update(state => ({ ...state, shouldDeactivateEditMode: true })),
clearEditModeFlag: () => update(state => ({ ...state, shouldDeactivateEditMode: false }))
};
}
export const conversationStore = createConversationStore();