foliko 1.1.50 → 1.1.52
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/.agent/data/default.json
CHANGED
|
@@ -32,5 +32,27 @@
|
|
|
32
32
|
},
|
|
33
33
|
"createdAt": "2026-05-01T16:24:24.447Z",
|
|
34
34
|
"lastActive": "2026-05-01T16:24:24.447Z"
|
|
35
|
+
},
|
|
36
|
+
"session:qq_c2c_default_c2c": {
|
|
37
|
+
"messages": [],
|
|
38
|
+
"variables": {},
|
|
39
|
+
"metadata": {
|
|
40
|
+
"platform": "qq",
|
|
41
|
+
"identifier": "default_c2c",
|
|
42
|
+
"type": "c2c"
|
|
43
|
+
},
|
|
44
|
+
"createdAt": "2026-05-02T14:21:02.797Z",
|
|
45
|
+
"lastActive": "2026-05-02T14:21:02.797Z"
|
|
46
|
+
},
|
|
47
|
+
"session:qq_group_default_group": {
|
|
48
|
+
"messages": [],
|
|
49
|
+
"variables": {},
|
|
50
|
+
"metadata": {
|
|
51
|
+
"platform": "qq",
|
|
52
|
+
"identifier": "default_group",
|
|
53
|
+
"type": "group"
|
|
54
|
+
},
|
|
55
|
+
"createdAt": "2026-05-02T14:21:02.798Z",
|
|
56
|
+
"lastActive": "2026-05-02T14:21:02.798Z"
|
|
35
57
|
}
|
|
36
58
|
}
|
|
@@ -158,6 +158,100 @@
|
|
|
158
158
|
"text": "哈哈,心情不错嘛!😄\n\n有什么想聊的,或者想让我帮你做点好玩的吗?"
|
|
159
159
|
}
|
|
160
160
|
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"role": "user",
|
|
164
|
+
"content": "你好"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"role": "assistant",
|
|
168
|
+
"content": [
|
|
169
|
+
{
|
|
170
|
+
"type": "text",
|
|
171
|
+
"text": "<think>用户只是说\"你好\",这是一个简单的问候。我应该简洁地回复,保持友好。\n</think>\n\n你好!👋"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"role": "user",
|
|
177
|
+
"content": "怎么这么慢?"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"role": "assistant",
|
|
181
|
+
"content": [
|
|
182
|
+
{
|
|
183
|
+
"type": "text",
|
|
184
|
+
"text": "<think>用户说\"怎么这么慢?\",可能是指我回复慢,或者是在问我为什么某个操作慢。但我一般回复挺快的,可能用户是在开玩笑或者想要我执行某个操作?\n\n我应该回应一下,看看用户需要什么。\n</think>\n\n抱歉让你久等了!😅\n\n是在等我做什么操作吗?还是单纯想聊聊天?告诉我你需要什么~"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"role": "user",
|
|
190
|
+
"content": "没有"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"role": "assistant",
|
|
194
|
+
"content": [
|
|
195
|
+
{
|
|
196
|
+
"type": "text",
|
|
197
|
+
"text": "<think>用户说\"没有\",表示没什么特别的事要做。我就简单回复一下,保持轻松的语气。\n</think>\n\n好的,那我就陪着你~ 😊\n\n有需要随时说!"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"role": "user",
|
|
203
|
+
"content": "今天星期几"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"role": "assistant",
|
|
207
|
+
"content": [
|
|
208
|
+
{
|
|
209
|
+
"type": "text",
|
|
210
|
+
"text": "<think>用户问今天星期几,我之前已经回答过了是2026年5月2日星期六。让我再获取一下时间确认一下。\n</think>\n\n\n"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "tool-call",
|
|
214
|
+
"toolCallId": "call_function_kaxyw4vfiym7_1",
|
|
215
|
+
"toolName": "get_time",
|
|
216
|
+
"input": {}
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"role": "tool",
|
|
222
|
+
"content": [
|
|
223
|
+
{
|
|
224
|
+
"type": "tool-result",
|
|
225
|
+
"toolCallId": "call_function_kaxyw4vfiym7_1",
|
|
226
|
+
"toolName": "get_time",
|
|
227
|
+
"output": {
|
|
228
|
+
"type": "text",
|
|
229
|
+
"value": "{\"success\":true,\"beijingTime\":\"2026-05-02 22:22:27\",\"timestamp\":1777731747493,\"timezone\":\"Asia/Shanghai (UTC+8)\",\"formatted\":{\"year\":2026,\"month\":\"05\",\"day\":\"02\",\"hour\":\"22\",\"minute\":\"22\",\"second\":\"22\"}}"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"role": "assistant",
|
|
236
|
+
"content": [
|
|
237
|
+
{
|
|
238
|
+
"type": "text",
|
|
239
|
+
"text": "<think>用户问今天星期几,根据时间信息,今天是2026年5月2日。我需要根据日期判断是星期几。\n\n2026年5月2日,让我算一下:\n- 2026年1月1日是星期几?我需要查一下\n- 或者用计算方法\n\n2026年是平年(不能被4整除),1月1日到5月2日:\n- 1月:31天\n- 2月:28天\n- 3月:31天\n- 4月:30天\n- 5月2日:2天\n\n总天数 = 31 + 28 + 31 + 30 + 2 = 122天\n\n需要知道2026年1月1日是星期几。2025年1月1日是星期三(2024是闰年)。\n2026年1月1日 = 2025年1月1日 + 365天\n365 mod 7 = 1,所以2026年1月1日是星期四\n\n122天后的星期 = 4 + (122 - 1) mod 7 = 4 + 121 mod 7\n121 mod 7 = 2(因为 119 = 17*7)\n所以是 4 + 2 = 6,星期六\n\n是的,5月2日确实是星期六。\n</think>\n\n今天是 **2026年5月2日,星期六** 🎉\n\n周末愉快~"
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"role": "user",
|
|
245
|
+
"content": "OK"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"role": "assistant",
|
|
249
|
+
"content": [
|
|
250
|
+
{
|
|
251
|
+
"type": "text",
|
|
252
|
+
"text": "<think>用户回复 OK,这是一个简单的确认。我可以简短回复,保持对话轻松。\n</think>\n\n👍 有事叫我!"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
161
255
|
}
|
|
162
256
|
],
|
|
163
257
|
"variables": {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foliko",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.52",
|
|
4
4
|
"description": "简约的插件化 Agent 框架",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
55
55
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
56
56
|
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
57
|
-
"@chnak/qq-bot": "1.0.
|
|
57
|
+
"@chnak/qq-bot": "1.0.6",
|
|
58
58
|
"@chnak/weixin-bot": "^1.2.9",
|
|
59
59
|
"@chnak/zod-to-markdown": "1.0.7",
|
|
60
60
|
"@hono/node-server": "^1.19.11",
|
package/plugins/qq-plugin.js
CHANGED
|
@@ -405,6 +405,35 @@ class QQPlugin extends Plugin {
|
|
|
405
405
|
})
|
|
406
406
|
|
|
407
407
|
log.info('QQ Bot 已连接')
|
|
408
|
+
|
|
409
|
+
// 预先创建默认 session scope,避免收到消息时延迟
|
|
410
|
+
this._ensureDefaultSessionScopes()
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* 预先创建默认的 session scope
|
|
415
|
+
* 避免收到消息时才创建导致的延迟
|
|
416
|
+
*/
|
|
417
|
+
_ensureDefaultSessionScopes() {
|
|
418
|
+
try {
|
|
419
|
+
// 创建默认的私聊 session agent 和 scope
|
|
420
|
+
const defaultC2CId = 'default_c2c'
|
|
421
|
+
const { agent: c2cAgent, sessionId: c2cSessionId } = this._getSessionAgent(defaultC2CId, 'c2c')
|
|
422
|
+
if (c2cAgent && !this._sessionScopes.has(c2cSessionId)) {
|
|
423
|
+
this._setupSessionScopeListeners(c2cAgent, c2cSessionId, null, defaultC2CId, 'c2c')
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// 创建默认的群聊 session agent 和 scope
|
|
427
|
+
const defaultGroupId = 'default_group'
|
|
428
|
+
const { agent: groupAgent, sessionId: groupSessionId } = this._getSessionAgent(defaultGroupId, 'group')
|
|
429
|
+
if (groupAgent && !this._sessionScopes.has(groupSessionId)) {
|
|
430
|
+
this._setupSessionScopeListeners(groupAgent, groupSessionId, null, defaultGroupId, 'group')
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
log.info('Default session scopes prepared')
|
|
434
|
+
} catch (err) {
|
|
435
|
+
log.warn('Failed to prepare default session scopes:', err.message)
|
|
436
|
+
}
|
|
408
437
|
}
|
|
409
438
|
|
|
410
439
|
/**
|