UNPKG

assistant-robot

Version:

An assistant widget, have a 3D robot which can interact with user, have a simple LLM which can chat with user.

40 lines (39 loc) 1.5 kB
import { AssistantModel } from "./AssistantModel"; import { UserDetector } from "./UserDetector"; import { OperationManager } from "./OperationManager"; import { EUserDetectorStatus } from "./constants"; import { EventListener } from "./utils"; import type { LanguageModel } from "./LanguageModel"; import type { IAssistantRobotConfig, IActionConfig } from "./type"; /** * the main class of the assistant robot. * After the class is instantiated, a fill funtion assistant robot will be show on the page. */ export declare class Assistant<T extends LanguageModel> extends EventListener { assistantModel: AssistantModel; userDetector: UserDetector; operationManager: OperationManager | undefined; languageModel: T; options: IAssistantRobotConfig<T>; constructor(el: Element, options: IAssistantRobotConfig<T>); handleLanguageModelLoad: () => void; handleUserDetectorStatusChange: (status: EUserDetectorStatus) => void; onMenuClick: (key: string) => void; /** * ask the assistant robot a question * @param question question go ask */ ask: (question: string) => Promise<void>; /** * make the robot say something * @param text what the robot should say */ assistantSay(text: string): void; /** * make the robot play a action * @param name name of the action * @param config config of the action */ assistantPlay(name: string, config?: IActionConfig): void; lookAtUser(): Promise<void>; }