UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

82 lines (81 loc) 2.36 kB
import type { IAsyncStorage } from "jodit/esm/types/index"; import type { IAIAssistantStorage, IConversation, IConversationMeta, IGlobalSettings } from "../../interface/index"; /** * Unified web storage implementation using Jodit's storage providers * Supports localStorage, sessionStorage, and memory storage */ export declare class WebStorageConversationStorage implements IAIAssistantStorage { private storage; private maxConversations; constructor(storageProvider: IAsyncStorage, maxConversations: number); close(): Promise<void>; /** * Get storage key for a conversation ID */ private getConversationKey; /** * Get all conversation IDs from storage */ private getAllKeys; /** * Update conversation index */ private updateIndex; /** * Add conversation ID to index */ private addToIndex; /** * Remove conversation ID from index */ private removeFromIndex; /** * List all conversations * @param query - Optional search query to filter conversations by title and message content */ list(query?: string): Promise<IConversationMeta[]>; /** * Get a specific conversation by ID */ get(id: string): Promise<IConversation | null>; /** * Save or update a conversation */ save(conversation: IConversation): Promise<void>; /** * Delete a conversation */ delete(id: string): Promise<void>; /** * Clear all conversations */ clear(): Promise<void>; /** * Evict oldest conversation (LRU) */ private evictOldest; /** * Get global settings */ getGlobalSettings(): Promise<IGlobalSettings | null>; /** * Save global settings */ saveGlobalSettings(settings: Partial<IGlobalSettings>): Promise<void>; } /** * Factory functions to create storage providers using Jodit's Storage */ export declare function createStorageProvider(type: 'indexedDB' | 'localStorage' | 'sessionStorage' | 'memoryStorage', rootKey?: string): IAsyncStorage; /** * Generate unique conversation ID */ export declare function generateConversationId(): string; /** * Generate unique message ID */ export declare function generateMessageId(): string; /** * Generate unique tool call ID */ export declare function generateToolCallId(): string;