amrita_plugin_memory 0.2.4__tar.gz → 0.2.5__tar.gz
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.
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/PKG-INFO +1 -1
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/runner.py +9 -3
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/tools.py +27 -9
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/tools.py +12 -4
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/PKG-INFO +1 -1
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/pyproject.toml +1 -1
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/LICENSE +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/README.md +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/__init__.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/config.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/embed.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/matchers.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/__init__.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/_state.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/backend.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/consts.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/hooks.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/nodes.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/schemas.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/workflow.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/vector.py +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/SOURCES.txt +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/dependency_links.txt +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/requires.txt +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/top_level.txt +0 -0
- {amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/setup.cfg +0 -0
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/runner.py
RENAMED
|
@@ -170,7 +170,9 @@ class SubconsciousRunner:
|
|
|
170
170
|
chat_obj.begin()
|
|
171
171
|
await chat_obj
|
|
172
172
|
except Exception as e:
|
|
173
|
-
logger.
|
|
173
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
174
|
+
f"[EXP Subconscious] Error: {e}"
|
|
175
|
+
)
|
|
174
176
|
finally:
|
|
175
177
|
self._chat_obj = None
|
|
176
178
|
self._is_running = False
|
|
@@ -314,7 +316,9 @@ class SubconsciousRunner:
|
|
|
314
316
|
)
|
|
315
317
|
await repo.update_memory_data(mem)
|
|
316
318
|
except Exception as e:
|
|
317
|
-
logger.
|
|
319
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
320
|
+
f"[EXP Subconscious] Save to repo failed: {e}"
|
|
321
|
+
)
|
|
318
322
|
|
|
319
323
|
async def _save_pending_to_repo(self) -> None:
|
|
320
324
|
"""持久化待发送消息到 CachedUserDataRepository 的 extra_prompt 中。"""
|
|
@@ -331,7 +335,9 @@ class SubconsciousRunner:
|
|
|
331
335
|
mem.extra_prompt = json.dumps(existing, ensure_ascii=False)
|
|
332
336
|
await repo.update_memory_data(mem)
|
|
333
337
|
except Exception as e:
|
|
334
|
-
logger.
|
|
338
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
339
|
+
f"[EXP Subconscious] Save pending failed: {e}"
|
|
340
|
+
)
|
|
335
341
|
|
|
336
342
|
# Prompt 加载
|
|
337
343
|
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/tools.py
RENAMED
|
@@ -81,7 +81,9 @@ async def subconscious_read_memory(data: dict[str, Any]) -> str:
|
|
|
81
81
|
)
|
|
82
82
|
return json.dumps(result, ensure_ascii=False, indent=2, default=str)
|
|
83
83
|
except Exception as e:
|
|
84
|
-
logger.
|
|
84
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
85
|
+
f"subconscious_read_memory error: {e}"
|
|
86
|
+
)
|
|
85
87
|
return _tools_err(str(e))
|
|
86
88
|
|
|
87
89
|
|
|
@@ -99,7 +101,9 @@ async def subconscious_write_memory(data: dict[str, Any]) -> str:
|
|
|
99
101
|
await ope.add_note(pid, str(data["content"]), metadata=meta)
|
|
100
102
|
return _tools_ok(id=meta.memory_id)
|
|
101
103
|
except Exception as e:
|
|
102
|
-
logger.
|
|
104
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
105
|
+
f"subconscious_write_memory error: {e}"
|
|
106
|
+
)
|
|
103
107
|
return _tools_err(str(e))
|
|
104
108
|
|
|
105
109
|
|
|
@@ -146,7 +150,9 @@ async def subconscious_update_memory(data: dict[str, Any]) -> str:
|
|
|
146
150
|
await ope.update_note(pid, new_content, metadata=meta)
|
|
147
151
|
return _tools_ok(message="记忆更新成功", id=mem_id)
|
|
148
152
|
except Exception as e:
|
|
149
|
-
logger.
|
|
153
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
154
|
+
f"subconscious_update_memory error: {e}"
|
|
155
|
+
)
|
|
150
156
|
return _tools_err(str(e))
|
|
151
157
|
|
|
152
158
|
|
|
@@ -166,7 +172,9 @@ async def subconscious_delete_memory(data: dict[str, Any]) -> str:
|
|
|
166
172
|
await ope.delete_note(pid, mem_id)
|
|
167
173
|
return _tools_ok(message="记忆删除成功", id=mem_id)
|
|
168
174
|
except Exception as e:
|
|
169
|
-
logger.
|
|
175
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
176
|
+
f"subconscious_delete_memory error: {e}"
|
|
177
|
+
)
|
|
170
178
|
return _tools_err(str(e))
|
|
171
179
|
|
|
172
180
|
|
|
@@ -203,7 +211,9 @@ async def subconscious_list_memory(data: dict[str, Any]) -> str:
|
|
|
203
211
|
)
|
|
204
212
|
return _tools_ok(memories=memories, total=len(ids))
|
|
205
213
|
except Exception as e:
|
|
206
|
-
logger.
|
|
214
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
215
|
+
f"subconscious_list_memory error: {e}"
|
|
216
|
+
)
|
|
207
217
|
return _tools_err(str(e))
|
|
208
218
|
|
|
209
219
|
|
|
@@ -236,7 +246,9 @@ async def subconscious_send_to_user(data: dict[str, Any]) -> str:
|
|
|
236
246
|
try:
|
|
237
247
|
content = await _generate_send_content(intent, memory_context)
|
|
238
248
|
except Exception as e:
|
|
239
|
-
logger.
|
|
249
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
250
|
+
f"[EXP Subconscious] Generate send content failed: {e}"
|
|
251
|
+
)
|
|
240
252
|
return _tools_err(str(e))
|
|
241
253
|
ts = datetime.now(timezone.utc).isoformat()
|
|
242
254
|
pending = _state.get_pending()
|
|
@@ -272,7 +284,9 @@ async def subconscious_read_chat_context(data: dict[str, Any]) -> str:
|
|
|
272
284
|
indent=2,
|
|
273
285
|
)
|
|
274
286
|
except Exception as e:
|
|
275
|
-
logger.
|
|
287
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
288
|
+
f"subconscious_read_chat_context error: {e}"
|
|
289
|
+
)
|
|
276
290
|
return _tools_err(str(e))
|
|
277
291
|
|
|
278
292
|
|
|
@@ -386,7 +400,9 @@ async def subconscious_duplicate_helper(data: dict[str, Any]) -> str:
|
|
|
386
400
|
memories=items,
|
|
387
401
|
)
|
|
388
402
|
except Exception as e:
|
|
389
|
-
logger.
|
|
403
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
404
|
+
f"subconscious_duplicate_helper error: {e}"
|
|
405
|
+
)
|
|
390
406
|
return _tools_err(str(e))
|
|
391
407
|
|
|
392
408
|
|
|
@@ -444,5 +460,7 @@ async def subconscious_get_memory_stats(data: dict[str, Any]) -> str:
|
|
|
444
460
|
avg_length=total_length // len(ids) if ids else 0,
|
|
445
461
|
)
|
|
446
462
|
except Exception as e:
|
|
447
|
-
logger.
|
|
463
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
464
|
+
f"subconscious_get_memory_stats error: {e}"
|
|
465
|
+
)
|
|
448
466
|
return _tools_err(str(e))
|
|
@@ -245,7 +245,9 @@ async def r(ctx: ToolContext) -> str:
|
|
|
245
245
|
)
|
|
246
246
|
return json.dumps(res, ensure_ascii=False, indent=4)
|
|
247
247
|
except Exception as e:
|
|
248
|
-
logger.
|
|
248
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
249
|
+
f"检索记忆时发生错误: {e}"
|
|
250
|
+
)
|
|
249
251
|
return _err(f"检索记忆失败: {e!s}")
|
|
250
252
|
|
|
251
253
|
|
|
@@ -317,7 +319,9 @@ async def update_memory(ctx: ToolContext) -> str:
|
|
|
317
319
|
|
|
318
320
|
return _ok(message="记忆更新成功", id=ctx.data["id"])
|
|
319
321
|
except Exception as e:
|
|
320
|
-
logger.
|
|
322
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
323
|
+
f"更新记忆时发生错误: {e}"
|
|
324
|
+
)
|
|
321
325
|
return _err(f"更新记忆失败: {e!s}")
|
|
322
326
|
|
|
323
327
|
|
|
@@ -349,7 +353,9 @@ async def delete_memory(ctx: ToolContext) -> str:
|
|
|
349
353
|
await ope.delete_note(partition_id, ctx.data["id"])
|
|
350
354
|
return _ok(message="记忆删除成功", id=ctx.data["id"])
|
|
351
355
|
except Exception as e:
|
|
352
|
-
logger.
|
|
356
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
357
|
+
f"删除记忆时发生错误: {e}"
|
|
358
|
+
)
|
|
353
359
|
return _err(f"删除记忆失败: {e!s}")
|
|
354
360
|
|
|
355
361
|
|
|
@@ -400,5 +406,7 @@ async def list_memory(ctx: ToolContext) -> str:
|
|
|
400
406
|
|
|
401
407
|
return _ok(memories=memories, total=len(ids))
|
|
402
408
|
except Exception as e:
|
|
403
|
-
logger.
|
|
409
|
+
logger.opt(exception=e, colors=True, raw=True).exception(
|
|
410
|
+
f"列出记忆时发生错误: {e}"
|
|
411
|
+
)
|
|
404
412
|
return _err(f"列出记忆失败: {e!s}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/_state.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/backend.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/consts.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/hooks.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/nodes.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory/rethinking/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.4 → amrita_plugin_memory-0.2.5}/amrita_plugin_memory.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|