Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Preserve learning card errors across slots

Fei2411810c7190d7e2
diff --git a/ds-bot/client.js b/ds-bot/client.js
index a8414ed6..ef0a3c76 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -18976,6 +18976,7 @@ function proposalPlacement(proposal, turns) {
// src/client/learning-card.js
var import_react46 = require("react");
+var failedAnswers = /* @__PURE__ */ new Map();
function ProposalCard({ proposal, initialError = "", onFailure, onResolved, actions }) {
const [busy, setBusy] = (0, import_react46.useState)(false);
const [error, setError] = (0, import_react46.useState)(initialError);
@@ -19040,13 +19041,20 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
for (const entry of Object.values(failed)) {
if (entry.proposal.botId === bot.id && !proposals.some((proposal) => proposal.id === entry.proposal.id)) visible.push(entry.proposal);
}
+ for (const entry of failedAnswers.values()) {
+ if (entry.proposal.botId === bot.id && !proposals.some((proposal) => proposal.id === entry.proposal.id) && !visible.some((proposal) => proposal.id === entry.proposal.id)) visible.push(entry.proposal);
+ }
const cards = visible.filter((proposal) => {
const placement = proposalPlacement(proposal, facts?.turns);
return dock ? placement.kind === "dock" : placement.kind === "turn" && placement.turn === turn?.turn;
});
if (cards.length === 0) return null;
- const onFailure = (proposal, error) => setFailed((current) => ({ ...current, [proposal.id]: { proposal, error } }));
+ const onFailure = (proposal, error) => {
+ failedAnswers.set(proposal.id, { proposal, error });
+ setFailed((current) => ({ ...current, [proposal.id]: { proposal, error } }));
+ };
const onResolved = (id) => setFailed((current) => {
+ failedAnswers.delete(id);
if (!(id in current)) return current;
const next = { ...current };
delete next[id];
@@ -19057,7 +19065,7 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
{ className: "bt-q-inline", key: proposal.id },
(0, import_react46.createElement)(ProposalCard, {
proposal,
- initialError: failed[proposal.id]?.error,
+ initialError: failed[proposal.id]?.error ?? failedAnswers.get(proposal.id)?.error,
onFailure,
onResolved,
actions
diff --git a/ds-bot/src/client/learning-card.js b/ds-bot/src/client/learning-card.js
index 098001dc..5b72d1b7 100644
--- a/ds-bot/src/client/learning-card.js
+++ b/ds-bot/src/client/learning-card.js
@@ -4,6 +4,8 @@ import { proposalPlacement } from './learning-card-model.js'
import { currentPart } from './text.js'
import { t } from './i18n.js'
+const failedAnswers = new Map()
+
function ProposalCard({ proposal, initialError = '', onFailure, onResolved, actions }) {
const [busy, setBusy] = useState(false)
const [error, setError] = useState(initialError)
@@ -53,13 +55,21 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
for (const entry of Object.values(failed)) {
if (entry.proposal.botId === bot.id && !proposals.some(proposal => proposal.id === entry.proposal.id)) visible.push(entry.proposal)
}
+ for (const entry of failedAnswers.values()) {
+ if (entry.proposal.botId === bot.id && !proposals.some(proposal => proposal.id === entry.proposal.id)
+ && !visible.some(proposal => proposal.id === entry.proposal.id)) visible.push(entry.proposal)
+ }
const cards = visible.filter(proposal => {
const placement = proposalPlacement(proposal, facts?.turns)
return dock ? placement.kind === 'dock' : placement.kind === 'turn' && placement.turn === turn?.turn
})
if (cards.length === 0) return null
- const onFailure = (proposal, error) => setFailed(current => ({ ...current, [proposal.id]: { proposal, error } }))
+ const onFailure = (proposal, error) => {
+ failedAnswers.set(proposal.id, { proposal, error })
+ setFailed(current => ({ ...current, [proposal.id]: { proposal, error } }))
+ }
const onResolved = id => setFailed(current => {
+ failedAnswers.delete(id)
if (!(id in current)) return current
const next = { ...current }
delete next[id]
@@ -68,7 +78,7 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
return h('div', { className: 'bt-learning-stack' }, cards.map(proposal => h('div', { className: 'bt-q-inline', key: proposal.id },
h(ProposalCard, {
proposal,
- initialError: failed[proposal.id]?.error,
+ initialError: failed[proposal.id]?.error ?? failedAnswers.get(proposal.id)?.error,
onFailure,
onResolved,
actions,