@zhengxs/wechaty-plugin-assistant
Version:
64 lines (62 loc) • 1.35 kB
TypeScript
import { ContactSelf, Message, Wechaty, WechatyPlugin } from 'wechaty';
import { Command } from '../integrations';
import { ConversationContext } from './context';
import { HookQueue, HooksName } from './hooks';
import { Keywords } from './keywords';
import { ChatModel } from './llm';
import { AssistantMonitor } from './monitor';
import { AssistantOptions } from './options';
export type AssistantHooks = {
[K in HooksName]: HookQueue<K>;
};
export interface Assistant {
/**
* 助手的配置
*/
options: AssistantOptions;
/**
* 助手的监控器
*/
monitor: AssistantMonitor;
/**
* 聊天指令
*/
command: Command;
/**
* 关键词
*/
keywords: Keywords;
/**
* 助手的钩子
*/
hooks: AssistantHooks;
llm: ChatModel;
/**
* 当前机器人登录的用户
*/
chatbotUser?: ContactSelf | null;
/**
* wechaty 实例
*/
wechaty?: Wechaty | null;
/**
* 消息监听器
*/
handler: (message: Message) => Promise<void>;
/**
* 插件回调
*/
callback: () => WechatyPlugin;
/**
* 调用大语言模型
*/
call(ctx: ConversationContext): Promise<void>;
/**
* 启动助手
*/
run(): void;
/**
* 停止助手
*/
stop(): void;
}