@charisma-ai/sdk
Version:
Charisma.ai SDK for Javascript (browser)
33 lines (32 loc) • 1.27 kB
TypeScript
import EventEmitter from "eventemitter3";
import Playthrough from "./Playthrough";
import { StartEvent, ReplyEvent, ActionEvent, SpeechConfig, MessageEvent, StartTypingEvent, StopTypingEvent, EpisodeCompleteEvent } from "./types";
export interface ConversationOptions {
speechConfig?: SpeechConfig;
}
export declare type ConversationEvents = {
message: [MessageEvent];
"start-typing": [StartTypingEvent];
"stop-typing": [StopTypingEvent];
"episode-complete": [EpisodeCompleteEvent];
"playback-start": [];
"playback-stop": [];
};
export declare class Conversation extends EventEmitter<ConversationEvents> {
private id;
private eventQueue;
private lastEventId?;
private lastTimestamp?;
private playthroughInstance;
private options;
constructor(conversationId: number, playthroughInstance: Playthrough, options?: ConversationOptions);
addIncomingEvent: Conversation["emit"];
start: (event?: StartEvent) => void;
reply: (event: ReplyEvent) => void;
tap: () => void;
action: (event: ActionEvent) => void;
resume: () => void;
setSpeechConfig: (speechConfig: SpeechConfig | undefined) => void;
reconnect: () => Promise<void>;
}
export default Conversation;