發佈 0.1.7:新增會話模式開關(獨立/共用)

摘要:
bot 設定新增「會話模式」:預設各聊天室獨立會話;可切為所有聊天室
共用一條記憶(單一專案助理情境)。共用模式下 /new 清除全部記憶,
/status 會顯示目前模式,bot 列表小字標示「共用會話」。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 12:05:30 +08:00
co-authored by Claude Fable 5
parent 6e39a8084f
commit d5c4464fe1
5 changed files with 39 additions and 11 deletions
+4 -1
View File
@@ -78,6 +78,7 @@ async function listBots() {
sandbox: cfg?.sandbox || null,
model: cfg?.model || '',
reasoningEffort: cfg?.reasoningEffort || '',
sharedSession: !!cfg?.sharedSession,
serviceTier: cfg?.serviceTier || '',
timeoutMinutes: cfg?.timeoutMinutes || null,
tokenMasked: maskToken(cfg?.telegramToken),
@@ -112,7 +113,7 @@ function validateBotInput({ name, token, workDir, sandbox }, { isCreate }) {
}
}
async function createBot({ name, token, workDir, sandbox, model, reasoningEffort, timeoutMinutes }) {
async function createBot({ name, token, workDir, sandbox, model, reasoningEffort, sharedSession, timeoutMinutes }) {
validateBotInput({ name, token, workDir, sandbox }, { isCreate: true });
const reg = loadRegistry();
if (reg.bots[name]) throw new Error(`已有同名 bot${name}`);
@@ -128,6 +129,7 @@ async function createBot({ name, token, workDir, sandbox, model, reasoningEffort
sandbox: sandbox || 'workspace-write',
model: model || '',
reasoningEffort: reasoningEffort || '',
sharedSession: !!sharedSession,
serviceTier: 'priority', // 速度固定 Fast 1.5x
timeoutMinutes: Number(timeoutMinutes) || 30,
pm2Name: name,
@@ -158,6 +160,7 @@ async function updateBot(name, patch) {
}
if (patch.model !== undefined) raw.model = patch.model;
if (patch.reasoningEffort !== undefined) raw.reasoningEffort = patch.reasoningEffort;
if (patch.sharedSession !== undefined) raw.sharedSession = !!patch.sharedSession;
if (patch.timeoutMinutes !== undefined && Number(patch.timeoutMinutes) > 0) {
raw.timeoutMinutes = Number(patch.timeoutMinutes);
}