UNPKG

@assistant-ui/react

Version:

React components for AI chat.

163 lines 6.06 kB
import type { AssistantToolUIsState } from "../stores/AssistantToolUIs"; import { ReadonlyStore } from "../ReadonlyStore"; import { UseBoundStore } from "zustand"; import { AssistantRuntime } from "../../api/AssistantRuntime"; import { ThreadListState } from "../../api/ThreadListRuntime"; export type AssistantContextValue = { useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>; useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>; useThreadList: UseBoundStore<ReadonlyStore<ThreadListState>>; /** * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0. */ useAssistantActions: UseBoundStore<ReadonlyStore<AssistantRuntime>>; }; export declare const AssistantContext: import("react").Context<AssistantContextValue | null>; export declare const useAssistantContext: { (options?: { optional?: false | undefined; } | undefined): AssistantContextValue; (options?: { optional?: boolean | undefined; } | undefined): AssistantContextValue | null; }; export declare function useAssistantRuntime(options?: { optional?: false | undefined; }): AssistantRuntime; export declare function useAssistantRuntime(options?: { optional?: boolean | undefined; }): AssistantRuntime | null; export declare const actions: { useAssistantActions: { (): AssistantRuntime; <TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected; (options: { optional: true; }): AssistantRuntime | null; <TSelected>(options: { optional: true; selector?: (state: AssistantRuntime) => TSelected; }): TSelected | null; }; } & { useAssistantActionsStore: { (): ReadonlyStore<AssistantRuntime>; (options: { optional: true; }): ReadonlyStore<AssistantRuntime> | null; }; }; /** * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0. */ export declare const useAssistantActionsStore: { (): ReadonlyStore<AssistantRuntime>; (options: { optional: true; }): ReadonlyStore<AssistantRuntime> | null; }; /** * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0. */ export declare const useAssistantActions: { (): AssistantRuntime; <TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected; (options: { optional: true; }): AssistantRuntime | null; <TSelected>(options: { optional: true; selector?: (state: AssistantRuntime) => TSelected; }): TSelected | null; }; /** * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0. */ export declare const useAssistantRuntimeStore: { (): ReadonlyStore<AssistantRuntime>; (options: { optional: true; }): ReadonlyStore<AssistantRuntime> | null; }; export declare const useToolUIs: { (): Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }>; <TSelected>(selector: (state: Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }>) => TSelected): TSelected; (options: { optional: true; }): Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }> | null; <TSelected>(options: { optional: true; selector?: (state: Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }>) => TSelected; }): TSelected | null; }, useToolUIsStore: { (): ReadonlyStore<Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }>>; (options: { optional: true; }): ReadonlyStore<Readonly<{ getToolUI: (toolName: string) => import("../..").ToolCallContentPartComponent | null; setToolUI: (toolName: string, render: import("../..").ToolCallContentPartComponent) => import("../..").Unsubscribe; }>> | null; }; export declare const useThreadList: { (): Readonly<{ threads: readonly Readonly<{ threadId: string; title?: string; }>[]; archivedThreads: readonly Readonly<{ threadId: string; title?: string; }>[]; }>; <TSelected>(selector: (state: Readonly<{ threads: readonly Readonly<{ threadId: string; title?: string; }>[]; archivedThreads: readonly Readonly<{ threadId: string; title?: string; }>[]; }>) => TSelected): TSelected; (options: { optional: true; }): Readonly<{ threads: readonly Readonly<{ threadId: string; title?: string; }>[]; archivedThreads: readonly Readonly<{ threadId: string; title?: string; }>[]; }> | null; <TSelected>(options: { optional: true; selector?: (state: Readonly<{ threads: readonly Readonly<{ threadId: string; title?: string; }>[]; archivedThreads: readonly Readonly<{ threadId: string; title?: string; }>[]; }>) => TSelected; }): TSelected | null; }; //# sourceMappingURL=AssistantContext.d.ts.map