View as Markdown

API reference: @salmonui/chat/conversation

ConversationApiinterface

import type { ConversationApi } from '@salmonui/chat/conversation';
interface ConversationApi {
    scrollToBottom(options?: {
        readonly behavior?: ScrollBehavior;
    }): void;
    scrollToMessage(id: string, options?: {
        readonly focus?: boolean;
    }): boolean;
    focus(): void;
    send(text: string): void;
    stop(): void;
    regenerate(id: string): void;
    readonly element: HTMLDivElement | null;
}
ConversationApi members (7)
NameSignatureDescription
scrollToBottomscrollToBottom(options?: { readonly behavior?: ScrollBehavior; }): void;

Scrolls to the latest message.

scrollToMessagescrollToMessage(id: string, options?: { readonly focus?: boolean; }): boolean;

Scrolls a message into view (mounted or virtualized) and returns whether it exists.

focusfocus(): void;

Focuses the composer input.

sendsend(text: string): void;

Sends text as the current user (runs onBeforeSend and the adapter).

stopstop(): void;

Aborts a pending adapter response.

regenerateregenerate(id: string): void;

Assistant variant: runs the adapter again for response id and keeps the previous text as an alternative.

elementreadonly element: HTMLDivElement | null;

The root element.