assistant-robot
Version:
An assistant widget, have a 3D robot which can interact with user, have a simple LLM which can chat with user.
95 lines (94 loc) • 2.77 kB
TypeScript
import { LanguageModel } from "./LanguageModel";
export interface ILanguageModelOptions {
[prop: string]: any;
}
interface ILanguageModelSubclass<T extends LanguageModel> {
new (options: ILanguageModelOptions): T;
}
export interface ILanguageModelConfig<T extends LanguageModel> extends ILanguageModelOptions {
Model: ILanguageModelSubclass<T>;
}
export interface IOperation {
key: string;
text: string;
/**
* To mark that is this item disabled,
* we just add a `data-disabled` attribute to the menu item,
* user should implement the funtion
*/
disabled: boolean;
}
export interface IOperationBoxConfig {
hide?: boolean;
perationBoxClassName?: string;
operationList?: IOperation[];
}
export interface IModelConfig {
position: [number, number, number];
rotation: [number, number, number];
helloActionName: string;
idleActionName: string;
helloContent: string;
}
/**
* Configs for the scene of the assistant robot's 3d model.
* To see all default value's, look at MODEL_SCENE_CONFIG
*/
export interface IModelSceneConfig {
backgroundColor: number;
backgroundAlpha: number;
camera: {
fov: number;
near: number;
far: number;
position: [number, number, number];
lookAt: [number, number, number];
};
/**
* config of the ambient light in the scene.
* the light globally illuminates all objects in the scene equally.
*/
ambientLight: {
color: number;
intensity: number;
};
/**
* config of the directional light in the scene.
* A light that gets emitted in a specific direction
*/
directionalLight: {
color: number;
intensity: number;
position: [number, number, number];
};
}
/**
* config for the 3d render part.
*/
export type TRobotModelConfig = Partial<IModelSceneConfig> & {
modelConfig?: Partial<IModelConfig>;
modelUrl?: string;
};
export interface IUserDetectorConfig {
/**
* The path to where the files of the face detect model are located.
* If your user can not get the public one, the files can be download from there:https://github.com/ymrdf/assistant-robot/tree/main/example/public/face_detection
*/
solutionPath?: string;
}
export interface IAssistantRobotConfig<T extends LanguageModel> {
className: string;
languageModel: ILanguageModelConfig<T>;
operationBox: IOperationBoxConfig;
robotModel: TRobotModelConfig;
userDetector: IUserDetectorConfig;
}
export type TCallback = () => void;
export type TEventListenFunc = (...args: any[]) => void;
export interface IActionConfig {
loop?: boolean;
weight?: number;
timeScale?: number;
repetitions?: number;
}
export {};