fix behavior log

This commit is contained in:
MaxRobinsonTheGreat 2025-03-30 16:33:21 -05:00
parent 4fbf90ee0c
commit 8793b3d905

View file

@ -242,13 +242,13 @@ export class Agent {
const checkInterrupt = () => this.self_prompter.shouldInterrupt(self_prompt) || this.shut_up || convoManager.responseScheduledFor(source); const checkInterrupt = () => this.self_prompter.shouldInterrupt(self_prompt) || this.shut_up || convoManager.responseScheduledFor(source);
let behavior_log = this.bot.modes.flushBehaviorLog(); let behavior_log = this.bot.modes.flushBehaviorLog().trim();
if (behavior_log.trim().length > 0) { if (behavior_log.length > 0) {
const MAX_LOG = 500; const MAX_LOG = 500;
if (behavior_log.length > MAX_LOG) { if (behavior_log.length > MAX_LOG) {
behavior_log = '...' + behavior_log.substring(behavior_log.length - MAX_LOG); behavior_log = '...' + behavior_log.substring(behavior_log.length - MAX_LOG);
} }
behavior_log = 'Recent behaviors log: \n' + behavior_log.substring(behavior_log.indexOf('\n')); behavior_log = 'Recent behaviors log: \n' + behavior_log;
await this.history.add('system', behavior_log); await this.history.add('system', behavior_log);
} }