arisa 3.0.11 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -21,6 +21,10 @@ export class AgentManager {
|
|
|
21
21
|
this.sessions.clear();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
resetSession(chatId) {
|
|
25
|
+
this.sessions.delete(chatId);
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
async validatePiAgent() {
|
|
25
29
|
this.logger?.log("agent", "validating Pi session");
|
|
26
30
|
const { authStorage, modelRegistry } = createPiRuntime({
|
|
@@ -240,6 +240,14 @@ export async function createTelegramBot({ config, artifactStore, toolRegistry, a
|
|
|
240
240
|
return ctx.reply(auth.firstTime ? "This chat is now authorized for Arisa." : "Arisa is ready.");
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
+
bot.command("new", async (ctx) => {
|
|
244
|
+
const auth = await authorizeChat({ config, chatId: ctx.chat.id, saveConfig, chatMeta: getIncomingChatMeta(ctx) });
|
|
245
|
+
if (!auth.ok) return;
|
|
246
|
+
agentManager.resetSession(ctx.chat.id);
|
|
247
|
+
perChatState.set(ctx.chat.id, { processing: false, nextPrompt: "" });
|
|
248
|
+
return ctx.reply("Started a new chat context.");
|
|
249
|
+
});
|
|
250
|
+
|
|
243
251
|
bot.on("message", async (ctx) => {
|
|
244
252
|
const auth = await authorizeChat({ config, chatId: ctx.chat.id, saveConfig, chatMeta: getIncomingChatMeta(ctx) });
|
|
245
253
|
if (!auth.ok) return;
|
|
@@ -295,6 +303,9 @@ export async function createTelegramBot({ config, artifactStore, toolRegistry, a
|
|
|
295
303
|
logger?.log("telegram", `startup message failed for chat ${chatId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
296
304
|
}
|
|
297
305
|
}
|
|
306
|
+
await bot.api.setMyCommands([
|
|
307
|
+
{ command: "new", description: "Start a new chat context" }
|
|
308
|
+
]);
|
|
298
309
|
logger?.log("telegram", "bot polling started");
|
|
299
310
|
await bot.start();
|
|
300
311
|
}
|