import { type PropType, Ref } from "vue"; import { createChatStore, HistoryFilter } from "../ui-store/index.js"; import { PreinitializedWritableAtom, StoreValue } from "nanostores"; import { ILangGraphClient } from "@langgraph-js/pure-graph/dist/types.js"; /** * @zh UnionStore 类型用于合并 store 的 data 和 mutations,使其可以直接访问。 * @en The UnionStore type is used to merge the data and mutations of a store, allowing direct access. */ export type UnionStoreVue>; mutations: Record; }> = { [k in keyof T["data"]]: Readonly>>; } & T["mutations"]; /** * @zh useUnionStore Hook 用于将 nanostores 的 store 结构转换为更易于在 UI 组件中使用的扁平结构。 * @en The useUnionStore Hook is used to transform the nanostores store structure into a flatter structure that is easier to use in UI components. */ export declare const useUnionStoreVue: ; mutations: Record; }>(store: T, useStore: (store: PreinitializedWritableAtom) => Readonly>) => UnionStoreVue; /** * 使用 Chat Store 的组合式函数 * @throws {Error} 如果在 ChatProvider 外部使用会抛出错误 */ export declare const useChat: () => UnionStoreVue>; export interface ChatProviderProps { defaultAgent?: string; apiUrl?: string; defaultHeaders?: Record; withCredentials?: boolean; fetch?: typeof fetch; showHistory?: boolean; showGraph?: boolean; fallbackToAvailableAssistants?: boolean; /** 初始化时是否自动激活最近的历史会话(默认 false,创建新会话) */ autoRestoreLastSession?: boolean; onInitError?: (error: any, currentAgent: string) => void; client?: ILangGraphClient; legacyMode?: boolean; /** 历史记录筛选的默认参数 */ historyFilter?: HistoryFilter; /** UI 更新的防抖时间(毫秒,默认 10) */ debounceTime?: number; } /** * @zh Chat Provider Hook,用于在 setup 中直接使用 * @en Chat Provider Hook, used directly in setup */ export declare const useChatProvider: (props: ChatProviderProps) => { unionStore: UnionStoreVue<{ data: { artifacts: PreinitializedWritableAtom & object; currentArtifactId: PreinitializedWritableAtom<[string, string] | null> & object; showArtifact: PreinitializedWritableAtom & object; client: PreinitializedWritableAtom | null> & object; history: PreinitializedWritableAtom & object; sessions: PreinitializedWritableAtom & object; renderMessages: PreinitializedWritableAtom & object; userInput: PreinitializedWritableAtom & object; loading: PreinitializedWritableAtom & object; inChatError: PreinitializedWritableAtom & object; currentAgent: PreinitializedWritableAtom & object; currentChatId: PreinitializedWritableAtom & object; currentNodeName: PreinitializedWritableAtom & object; currentStatus: PreinitializedWritableAtom & object; interruptData: PreinitializedWritableAtom & object; isInterrupted: PreinitializedWritableAtom & object; tools: PreinitializedWritableAtom[]> & object; collapsedTools: PreinitializedWritableAtom & object; showGraph: PreinitializedWritableAtom & object; graphVisualize: PreinitializedWritableAtom & object; showHistory: PreinitializedWritableAtom & object; historyList: PreinitializedWritableAtom[]> & object; historyPagination: PreinitializedWritableAtom & object; historyFilter: PreinitializedWritableAtom & object; }; mutations: { setCurrentArtifactById: (id: string, tool_id: string) => void; setShowArtifact: (show: boolean) => void; initClient: () => Promise; getClient: () => import("../LangGraphClient.js").LangGraphClient | null; getHistory: () => import("../History.js").History | null; activateSession: (sessionId: string, mustResetStream?: boolean) => Promise; createNewSession: () => Promise; refreshSessionList: () => Promise; refreshHistoryList: () => Promise; sendMessage: (message?: import("@langchain/langgraph-sdk").Message[], options?: import("../LangGraphClient.js").SendMessageOptions, withoutCheck?: boolean, isResume?: boolean) => Promise; stopGeneration: () => void; setUserInput: (input: string) => void; revertChatTo(messageId: string, resend?: boolean, sendOptions?: import("../LangGraphClient.js").SendMessageOptions & import("../time-travel/index.js").RevertChatToOptions): Promise; refreshTools: () => Promise; setTools(new_tools: import("../index.js").UnionTool[]): void; toggleToolCollapse: (toolId: string) => void; getToolUIRender: (tool_name: string) => ((message: import("../LangGraphClient.js").RenderMessage) => Object) | null; isFELocking: () => boolean | undefined; toggleHistoryVisible: () => void; toggleGraphVisible(): void; refreshGraph: () => Promise; setCurrentAgent(agent: string): Promise; resumeFromInterrupt(data: any): Promise; addToHistory: (thread: import("@langchain/langgraph-sdk").Thread<{ messages: import("@langchain/langgraph-sdk").Message[]; }>) => void; createNewChat(metadata?: Record): Promise; toHistoryChat: (thread: import("@langchain/langgraph-sdk").Thread<{ messages: import("@langchain/langgraph-sdk").Message[]; }>) => Promise; deleteHistoryChat(thread: import("@langchain/langgraph-sdk").Thread<{ messages: import("@langchain/langgraph-sdk").Message[]; }>): Promise; setHistoryPage(page: number): void; setHistoryPageSize(pageSize: number): void; setHistoryFilter(filter: Partial): void; resetHistoryFilter(): void; }; }>; }; /** * Chat Provider 组件 * 提供 Chat Store 的上下文 */ export declare const ChatProvider: import("vue").DefineComponent; default: string; }; apiUrl: { type: PropType; default: string; }; defaultHeaders: { type: PropType>; default: () => {}; }; withCredentials: { type: PropType; default: boolean; }; fetch: { type: PropType; default: undefined; }; showHistory: { type: PropType; default: boolean; }; showGraph: { type: PropType; default: boolean; }; autoRestoreLastSession: { type: PropType; default: boolean; }; onInitError: { type: PropType<(error: any, currentAgent: string) => void>; default: undefined; }; historyFilter: { type: PropType; default: undefined; }; debounceTime: { type: PropType; default: undefined; }; }>, () => import("vue").VNode[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly; default: string; }; apiUrl: { type: PropType; default: string; }; defaultHeaders: { type: PropType>; default: () => {}; }; withCredentials: { type: PropType; default: boolean; }; fetch: { type: PropType; default: undefined; }; showHistory: { type: PropType; default: boolean; }; showGraph: { type: PropType; default: boolean; }; autoRestoreLastSession: { type: PropType; default: boolean; }; onInitError: { type: PropType<(error: any, currentAgent: string) => void>; default: undefined; }; historyFilter: { type: PropType; default: undefined; }; debounceTime: { type: PropType; default: undefined; }; }>> & Readonly<{}>, { apiUrl: string; defaultHeaders: Record; showGraph: boolean; showHistory: boolean; historyFilter: any; defaultAgent: string; withCredentials: boolean; fetch: typeof fetch; autoRestoreLastSession: boolean; onInitError: (error: any, currentAgent: string) => void; debounceTime: number; }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;