backup current stable ejclaw state
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { getPairedTurnOutputs, getRecentChatMessages } from './db.js';
|
||||
import {
|
||||
getPairedTurnOutputs,
|
||||
getRecentChatMessages,
|
||||
getRecentDeliveredOwnerWorkItemsForChat,
|
||||
} from './db.js';
|
||||
import { logger } from './logger.js';
|
||||
import {
|
||||
buildArbiterPromptForTask,
|
||||
@@ -270,10 +274,31 @@ export async function runQueuedGroupTurn(args: {
|
||||
turnOutputs,
|
||||
});
|
||||
} else {
|
||||
prompt = args.formatMessages(
|
||||
// Single-mode (or paired-not-yet-activated) fallback.
|
||||
// The messages table only stores human messages, so the bot's own prior
|
||||
// answers (which live in work_items.result_payload) are otherwise invisible
|
||||
// to the next turn. Prepend the most recent delivered owner answers so the
|
||||
// model can reference what it previously said (e.g. "translate your last
|
||||
// answer to Korean").
|
||||
const recentBotAnswers = getRecentDeliveredOwnerWorkItemsForChat(
|
||||
chatJid,
|
||||
3,
|
||||
);
|
||||
const formattedNew = args.formatMessages(
|
||||
args.labelPairedSenders(chatJid, missedMessages),
|
||||
args.timezone,
|
||||
);
|
||||
if (recentBotAnswers.length === 0) {
|
||||
prompt = formattedNew;
|
||||
} else {
|
||||
const priorBlock = recentBotAnswers
|
||||
.map((item, idx) => {
|
||||
const label = `Prior bot answer ${idx + 1}/${recentBotAnswers.length} (delivered ${item.delivered_at ?? item.updated_at})`;
|
||||
return `${label}:\n${item.result_payload}`;
|
||||
})
|
||||
.join('\n\n');
|
||||
prompt = `[Recent prior answers from you in this channel — for context only, do not re-send]\n${priorBlock}\n\n[New messages to respond to]\n${formattedNew}`;
|
||||
}
|
||||
}
|
||||
|
||||
const startSeq = missedMessages[0].seq ?? null;
|
||||
|
||||
Reference in New Issue
Block a user