@assistant-ui/react
Version:
Typescript/React library for AI Chat
80 lines • 3.52 kB
TypeScript
import { SpeechState, SubmittedFeedback } from "../runtimes/core/ThreadRuntimeCore";
import { ThreadMessage, ThreadAssistantContentPart, ThreadUserContentPart, Unsubscribe } from "../types";
import { RunConfig, ToolCallContentPartStatus } from "../types/AssistantTypes";
import { AttachmentRuntime, MessageAttachmentRuntimeImpl } from "./AttachmentRuntime";
import { EditComposerRuntime, EditComposerRuntimeImpl } from "./ComposerRuntime";
import { ContentPartRuntime, ContentPartRuntimeImpl } from "./ContentPartRuntime";
import { MessageRuntimePath } from "./RuntimePathTypes";
import { ThreadRuntimeCoreBinding } from "./ThreadRuntime";
import { SubscribableWithState } from "./subscribable/Subscribable";
export declare const toContentPartStatus: (message: ThreadMessage, partIndex: number, part: ThreadUserContentPart | ThreadAssistantContentPart) => ToolCallContentPartStatus;
export type MessageState = ThreadMessage & {
readonly parentId: string | null;
readonly isLast: boolean;
readonly branchNumber: number;
readonly branchCount: number;
/**
* @deprecated This API is still under active development and might change without notice.
*/
readonly speech: SpeechState | undefined;
readonly submittedFeedback: SubmittedFeedback | undefined;
};
export type MessageStateBinding = SubscribableWithState<MessageState, MessageRuntimePath>;
type ReloadConfig = {
runConfig?: RunConfig;
};
export type MessageRuntime = {
readonly path: MessageRuntimePath;
readonly composer: EditComposerRuntime;
getState(): MessageState;
reload(config?: ReloadConfig): void;
/**
* @deprecated This API is still under active development and might change without notice.
*/
speak(): void;
/**
* @deprecated This API is still under active development and might change without notice.
*/
stopSpeaking(): void;
submitFeedback({ type }: {
type: "positive" | "negative";
}): void;
switchToBranch({ position, branchId, }: {
position?: "previous" | "next" | undefined;
branchId?: string | undefined;
}): void;
unstable_getCopyText(): string;
subscribe(callback: () => void): Unsubscribe;
getContentPartByIndex(idx: number): ContentPartRuntime;
getContentPartByToolCallId(toolCallId: string): ContentPartRuntime;
getAttachmentByIndex(idx: number): AttachmentRuntime & {
source: "message";
};
};
export declare class MessageRuntimeImpl implements MessageRuntime {
private _core;
private _threadBinding;
get path(): MessageRuntimePath;
constructor(_core: MessageStateBinding, _threadBinding: ThreadRuntimeCoreBinding);
protected __internal_bindMethods(): void;
readonly composer: EditComposerRuntimeImpl;
private _getEditComposerRuntimeCore;
getState(): MessageState;
reload(reloadConfig?: ReloadConfig): void;
speak(): void;
stopSpeaking(): void;
submitFeedback({ type }: {
type: "positive" | "negative";
}): void;
switchToBranch({ position, branchId, }: {
position?: "previous" | "next" | undefined;
branchId?: string | undefined;
}): void;
unstable_getCopyText(): string;
subscribe(callback: () => void): Unsubscribe;
getContentPartByIndex(idx: number): ContentPartRuntimeImpl;
getContentPartByToolCallId(toolCallId: string): ContentPartRuntimeImpl;
getAttachmentByIndex(idx: number): MessageAttachmentRuntimeImpl;
}
export {};
//# sourceMappingURL=MessageRuntime.d.ts.map