()
| 4425 | } |
| 4426 | |
| 4427 | function formatRemoteExecutionMemoryContext() { |
| 4428 | const entries = Array.isArray(state.remoteExecution.memory.entries) ? state.remoteExecution.memory.entries : []; |
| 4429 | if (!entries.length) return ""; |
| 4430 | const lines = entries.slice(-state.remoteExecution.memory.limit).map((entry) => { |
| 4431 | const speaker = entry.role === "assistant" ? assistantName : ownerLabel; |
| 4432 | return `${speaker}:${String(entry.text || "").trim()}`; |
| 4433 | }).filter((line) => !/:$/.test(line)); |
| 4434 | if (!lines.length) return ""; |
| 4435 | return [ |
| 4436 | "以下是远程执行模式的独立滚动记忆,请自然参考,不要逐字复述:", |
| 4437 | ...lines |
| 4438 | ].join("\n"); |
| 4439 | } |
| 4440 | |
| 4441 | async function rememberRemoteExecutionTurn(userText, reply) { |
| 4442 | const entries = Array.isArray(state.remoteExecution.memory.entries) ? state.remoteExecution.memory.entries : []; |
no outgoing calls
no test coverage detected