fix: update to new ConversationManager

This commit is contained in:
WJG 2024-02-23 16:32:23 +08:00
parent aae3202c98
commit 18c246ac6c
No known key found for this signature in database
GPG Key ID: 258474EF8590014A

View File

@ -48,16 +48,13 @@ export class MyBot {
} }
async ask(msg: string) { async ask(msg: string) {
const memory = await this.manager.getMemory(); const { bot, master, room, memory } = await this.manager.get();
const room = await this.manager.getRoom(); if (!memory) {
const bot = await this.manager.getUser("bot"); return;
const master = await this.manager.getUser("master"); }
const lastMessages = await this.manager.getMessages({ const lastMessages = await this.manager.getMessages({
take: 10, take: 10,
}); });
if (!this.manager.isReady) {
return;
}
const result = await openai.chat({ const result = await openai.chat({
system: buildPrompt(systemTemplate, { system: buildPrompt(systemTemplate, {
bot_name: bot!.name, bot_name: bot!.name,