qq-bot/llm/prompt.ts

15 lines
360 B
TypeScript

import prompt from './prompt.txt'
async function getSystemPrompt(user: Sender) {
const map = {
"nickname": user.nickname || "用户",
}
let prot = prompt;
for (const k in map) {
const v = map[k as keyof typeof map];
const re = new RegExp(`\\{${k}\\}`, 'g');
prot = prot.replace(re, v);
}
return prot;
}