11
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user