mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 16:30:27 +00:00
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.
29 lines
1.3 KiB
TypeScript
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();
|