xiaozuoassistant 0.2.39 → 0.2.40
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.
|
@@ -90,6 +90,26 @@ export class FeishuChannel extends BaseChannel {
|
|
|
90
90
|
// Use chat_id for group chats, open_id/user_id for p2p?
|
|
91
91
|
// Actually message.chat_id is universal for where the message comes from.
|
|
92
92
|
const sessionId = `feishu:${botName}:${event.chat_id}`;
|
|
93
|
+
// 支持飞书端发送 /archive 触发手动归档
|
|
94
|
+
if (content.trim().toLowerCase() === '/archive') {
|
|
95
|
+
console.log(`[Feishu-${botName}] Manual archive command triggered for sessionId: ${sessionId}`);
|
|
96
|
+
this.emitMessage(sessionId, '正在为您整理并归档当前会话的长期记忆,请稍候...');
|
|
97
|
+
// We can't directly call memoryManager here as it breaks architecture,
|
|
98
|
+
// emit a special command or let Brain handle it.
|
|
99
|
+
// The simplest way is to emit the command, and let the backend API handle it via event or intercept it.
|
|
100
|
+
// For MVP: We intercept it here and make a local HTTP request to the archive endpoint
|
|
101
|
+
try {
|
|
102
|
+
const axios = require('axios');
|
|
103
|
+
const configLoader = require('../config/loader.js').config;
|
|
104
|
+
const port = configLoader.server?.port || 3001;
|
|
105
|
+
await axios.post(`http://127.0.0.1:${port}/api/sessions/${encodeURIComponent(sessionId)}/archive`);
|
|
106
|
+
this.emitMessage(sessionId, '✅ 归档完成!我已经记住了这个会话的关键信息。');
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
this.emitMessage(sessionId, `❌ 归档失败: ${e.message}`);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
93
113
|
console.log(`[Feishu-${botName}] Emitting message with sessionId: ${sessionId}`);
|
|
94
114
|
this.emitMessage(sessionId, content);
|
|
95
115
|
}
|