@assistant-ui/react
Version:
TypeScript/React library for AI Chat
47 lines • 1.55 kB
TypeScript
import type { DictationState } from "../../legacy-runtime/runtime-cores/core/ComposerRuntimeCore.js";
import type { Attachment } from "../../types/index.js";
import type { MessageRole, RunConfig } from "../../types/AssistantTypes.js";
import type { AttachmentClientApi } from "./Attachment.js";
export type ComposerClientState = {
readonly text: string;
readonly role: MessageRole;
readonly attachments: readonly Attachment[];
readonly runConfig: RunConfig;
readonly isEditing: boolean;
readonly canCancel: boolean;
readonly attachmentAccept: string;
readonly isEmpty: boolean;
readonly type: "thread" | "edit";
/**
* The current state of dictation.
* Undefined when dictation is not active.
*/
readonly dictation: DictationState | undefined;
};
export type ComposerClientApi = {
getState(): ComposerClientState;
setText(text: string): void;
setRole(role: MessageRole): void;
setRunConfig(runConfig: RunConfig): void;
addAttachment(file: File): Promise<void>;
clearAttachments(): Promise<void>;
attachment(selector: {
index: number;
} | {
id: string;
}): AttachmentClientApi;
reset(): Promise<void>;
send(): void;
cancel(): void;
beginEdit(): void;
/**
* Start dictation to convert voice to text input.
* Requires a DictationAdapter to be configured.
*/
startDictation(): void;
/**
* Stop the current dictation session.
*/
stopDictation(): void;
};
//# sourceMappingURL=Composer.d.ts.map