**图片功能** - 支持接收用户发送的图片消息(自动下载到临时目录) - 支持发送本地文件路径(自动读取转为 Base64) - 富媒体消息接口(sendC2CImageMessage/sendGroupImageMessage) - 图片本地代理服务(解决 QQ 图片 URL 直接访问限制) **消息格式** - 默认启用 Markdown 消息格式 **定时提醒优化** - 修复 cron 提醒:移除无效 --system-prompt 参数,改用 --message 直接输出提醒内容 - 精简用户交互话术,避免冗长回复 **代码清理** - 移除过时的流式消息处理代码 - 优化 gateway/outbound/channel 模块结构
124 lines
2.4 KiB
TypeScript
124 lines
2.4 KiB
TypeScript
/**
|
||
* QQ Bot 配置类型
|
||
*/
|
||
export interface QQBotConfig {
|
||
appId: string;
|
||
clientSecret?: string;
|
||
clientSecretFile?: string;
|
||
}
|
||
|
||
/**
|
||
* 解析后的 QQ Bot 账户
|
||
*/
|
||
export interface ResolvedQQBotAccount {
|
||
accountId: string;
|
||
name?: string;
|
||
enabled: boolean;
|
||
appId: string;
|
||
clientSecret: string;
|
||
secretSource: "config" | "file" | "env" | "none";
|
||
/** 系统提示词 */
|
||
systemPrompt?: string;
|
||
/** 图床服务器公网地址 */
|
||
imageServerBaseUrl?: string;
|
||
/** 是否支持 markdown 消息(默认 false,需要机器人具备该权限才能启用) */
|
||
markdownSupport?: boolean;
|
||
config: QQBotAccountConfig;
|
||
}
|
||
|
||
/**
|
||
* QQ Bot 账户配置
|
||
*/
|
||
export interface QQBotAccountConfig {
|
||
enabled?: boolean;
|
||
name?: string;
|
||
appId?: string;
|
||
clientSecret?: string;
|
||
clientSecretFile?: string;
|
||
dmPolicy?: "open" | "pairing" | "allowlist";
|
||
allowFrom?: string[];
|
||
/** 系统提示词,会添加在用户消息前面 */
|
||
systemPrompt?: string;
|
||
/** 图床服务器公网地址,用于发送图片,例如 http://your-ip:18765 */
|
||
imageServerBaseUrl?: string;
|
||
/** 是否支持 markdown 消息(默认 false,需要机器人具备该权限才能启用) */
|
||
markdownSupport?: boolean;
|
||
}
|
||
|
||
/**
|
||
* 富媒体附件
|
||
*/
|
||
export interface MessageAttachment {
|
||
content_type: string; // 如 "image/png"
|
||
filename?: string;
|
||
height?: number;
|
||
width?: number;
|
||
size?: number;
|
||
url: string;
|
||
}
|
||
|
||
/**
|
||
* C2C 消息事件
|
||
*/
|
||
export interface C2CMessageEvent {
|
||
author: {
|
||
id: string;
|
||
union_openid: string;
|
||
user_openid: string;
|
||
};
|
||
content: string;
|
||
id: string;
|
||
timestamp: string;
|
||
message_scene?: {
|
||
source: string;
|
||
};
|
||
attachments?: MessageAttachment[];
|
||
}
|
||
|
||
/**
|
||
* 频道 AT 消息事件
|
||
*/
|
||
export interface GuildMessageEvent {
|
||
id: string;
|
||
channel_id: string;
|
||
guild_id: string;
|
||
content: string;
|
||
timestamp: string;
|
||
author: {
|
||
id: string;
|
||
username?: string;
|
||
bot?: boolean;
|
||
};
|
||
member?: {
|
||
nick?: string;
|
||
joined_at?: string;
|
||
};
|
||
attachments?: MessageAttachment[];
|
||
}
|
||
|
||
/**
|
||
* 群聊 AT 消息事件
|
||
*/
|
||
export interface GroupMessageEvent {
|
||
author: {
|
||
id: string;
|
||
member_openid: string;
|
||
};
|
||
content: string;
|
||
id: string;
|
||
timestamp: string;
|
||
group_id: string;
|
||
group_openid: string;
|
||
attachments?: MessageAttachment[];
|
||
}
|
||
|
||
/**
|
||
* WebSocket 事件负载
|
||
*/
|
||
export interface WSPayload {
|
||
op: number;
|
||
d?: unknown;
|
||
s?: number;
|
||
t?: string;
|
||
}
|