This commit is contained in:
sliverp
2026-01-29 12:03:48 +08:00
parent ee8beee4c1
commit b58146d9b8
3 changed files with 15 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ export function resolveQQBotAccount(
clientSecretFile: qqbot?.clientSecretFile,
dmPolicy: qqbot?.dmPolicy,
allowFrom: qqbot?.allowFrom,
systemPrompt: qqbot?.systemPrompt,
};
appId = qqbot?.appId ?? "";
} else {
@@ -95,6 +96,7 @@ export function resolveQQBotAccount(
appId,
clientSecret,
secretSource,
systemPrompt: accountConfig.systemPrompt,
config: accountConfig,
};
}

View File

@@ -135,11 +135,19 @@ export async function startGateway(ctx: GatewayContext): Promise<void> {
const envelopeOptions = pluginRuntime.channel.reply.resolveEnvelopeFormatOptions(cfg);
// 组装消息体,添加系统提示词
const builtinPrompt = "由于平台限制你的回复中不可以包含任何URL";
const systemPrompts = [builtinPrompt];
if (account.systemPrompt) {
systemPrompts.push(account.systemPrompt);
}
const messageBody = `【系统提示】\n${systemPrompts.join("\n")}\n\n【用户输入】\n${event.content}`;
const body = pluginRuntime.channel.reply.formatInboundEnvelope({
channel: "QQBot",
from: event.senderName ?? event.senderId,
timestamp: new Date(event.timestamp).getTime(),
body: event.content,
body: messageBody,
chatType: isGroup ? "group" : "direct",
sender: {
id: event.senderId,

View File

@@ -17,6 +17,8 @@ export interface ResolvedQQBotAccount {
appId: string;
clientSecret: string;
secretSource: "config" | "file" | "env" | "none";
/** 系统提示词 */
systemPrompt?: string;
config: QQBotAccountConfig;
}
@@ -31,6 +33,8 @@ export interface QQBotAccountConfig {
clientSecretFile?: string;
dmPolicy?: "open" | "pairing" | "allowlist";
allowFrom?: string[];
/** 系统提示词,会添加在用户消息前面 */
systemPrompt?: string;
}
/**