amrita_plugin_memory 0.2.7__tar.gz → 0.2.8__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.7 → amrita_plugin_memory-0.2.8}/PKG-INFO +2 -1
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/__init__.py +1 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/__init__.py +1 -1
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/runner.py +6 -6
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/tools.py +2 -2
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/tools.py +1 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/PKG-INFO +2 -1
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/requires.txt +1 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/pyproject.toml +2 -1
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/LICENSE +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/README.md +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/config.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/embed.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/matchers.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/_state.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/backend.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/consts.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/hooks.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/nodes.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/schemas.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/workflow.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/vector.py +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/SOURCES.txt +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/dependency_links.txt +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/top_level.txt +0 -0
- {amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: amrita_plugin_memory
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Amrita长期记忆插件
|
|
5
5
|
Requires-Python: <3.14,>=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -10,6 +10,7 @@ Requires-Dist: aiologic>=0.16.0
|
|
|
10
10
|
Requires-Dist: amrita-core>=0.8.5
|
|
11
11
|
Requires-Dist: amrita>=1.3
|
|
12
12
|
Requires-Dist: chromadb>=1.5.8
|
|
13
|
+
Requires-Dist: nonebot-plugin-amrita>=0.2.2
|
|
13
14
|
Requires-Dist: nonebot-plugin-apscheduler>=0.5.0
|
|
14
15
|
Requires-Dist: nonebot-plugin-localstore>=0.7.4
|
|
15
16
|
Dynamic: license-file
|
|
@@ -2,6 +2,7 @@ from nonebot import require
|
|
|
2
2
|
|
|
3
3
|
require("nonebot_plugin_localstore")
|
|
4
4
|
require("nonebot_plugin_apscheduler")
|
|
5
|
+
require("nonebot_plugin_amrita")
|
|
5
6
|
require("amrita.plugins.chat")
|
|
6
7
|
require("amrita.plugins.menu")
|
|
7
8
|
from . import config, embed, matchers, rethinking, tools, vector
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/runner.py
RENAMED
|
@@ -9,9 +9,7 @@ import random
|
|
|
9
9
|
from datetime import datetime, timedelta, timezone
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
-
from amrita.plugins.chat.utils.app import CachedUserDataRepository
|
|
13
12
|
from amrita.plugins.chat.utils.libchat import add_usage
|
|
14
|
-
from amrita.plugins.chat.utils.sql import InsightsModel
|
|
15
13
|
from amrita_core import SuspendObjectStream
|
|
16
14
|
from amrita_core.base.backend import BackendSlots
|
|
17
15
|
from amrita_core.builtins.agent import ReActAgentStrategy
|
|
@@ -24,6 +22,8 @@ from amrita_sense import WorkflowInterpreter
|
|
|
24
22
|
from amrita_sense.runtime.types import InterpreterContext
|
|
25
23
|
from jinja2 import Template
|
|
26
24
|
from nonebot import logger
|
|
25
|
+
from nonebot_plugin_amrita.database import InsightsModel
|
|
26
|
+
from nonebot_plugin_amrita.memory import CachedUserDataRepository
|
|
27
27
|
from nonebot_plugin_apscheduler import scheduler
|
|
28
28
|
|
|
29
29
|
from ..config import DATA_PATH, SubconsciousConfig
|
|
@@ -48,7 +48,7 @@ class SubconsciousRunner:
|
|
|
48
48
|
|
|
49
49
|
使用 ChatObject 作为数据容器 + 标准 Agent 框架(ReActAgentStrategy)。
|
|
50
50
|
LIMITING_MEMORY 节点在 Agent Loop 之前运行 MemoryLimiter 压缩会话消息。
|
|
51
|
-
持久化使用 CachedUserDataRepository(
|
|
51
|
+
持久化使用 CachedUserDataRepository(user_00000000)。
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
def __init__(self, config: SubconsciousConfig) -> None:
|
|
@@ -268,7 +268,7 @@ class SubconsciousRunner:
|
|
|
268
268
|
"""从 CachedUserDataRepository 恢复状态。"""
|
|
269
269
|
try:
|
|
270
270
|
repo = CachedUserDataRepository()
|
|
271
|
-
mem = await repo.get_memory(
|
|
271
|
+
mem = await repo.get_memory(_REPO_UID)
|
|
272
272
|
# extra_prompt 存 JSON 元状态
|
|
273
273
|
if mem.extra_prompt:
|
|
274
274
|
data = json.loads(mem.extra_prompt)
|
|
@@ -301,7 +301,7 @@ class SubconsciousRunner:
|
|
|
301
301
|
"""保存状态到 CachedUserDataRepository。"""
|
|
302
302
|
try:
|
|
303
303
|
repo = CachedUserDataRepository()
|
|
304
|
-
mem = await repo.get_memory(
|
|
304
|
+
mem = await repo.get_memory(_REPO_UID)
|
|
305
305
|
latest_abstract = self._last_abstracts[-1] if self._last_abstracts else ""
|
|
306
306
|
mem.memory_json.abstract = latest_abstract
|
|
307
307
|
mem.extra_prompt = json.dumps(
|
|
@@ -322,7 +322,7 @@ class SubconsciousRunner:
|
|
|
322
322
|
"""持久化待发送消息到 CachedUserDataRepository 的 extra_prompt 中。"""
|
|
323
323
|
try:
|
|
324
324
|
repo = CachedUserDataRepository()
|
|
325
|
-
mem = await repo.get_memory(
|
|
325
|
+
mem = await repo.get_memory(_REPO_UID)
|
|
326
326
|
existing: dict[str, Any] = {}
|
|
327
327
|
if mem.extra_prompt:
|
|
328
328
|
try:
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/tools.py
RENAMED
|
@@ -268,10 +268,10 @@ async def subconscious_read_chat_context(data: dict[str, Any]) -> str:
|
|
|
268
268
|
return _tools_err(f"invalid target_user_id: {uid_str}")
|
|
269
269
|
limit = int(data.get("limit", 10))
|
|
270
270
|
try:
|
|
271
|
-
from
|
|
271
|
+
from nonebot_plugin_amrita.memory import CachedUserDataRepository
|
|
272
272
|
|
|
273
273
|
repo = CachedUserDataRepository()
|
|
274
|
-
mem = await repo.get_memory(user_id
|
|
274
|
+
mem = await repo.get_memory(f"user_{user_id}")
|
|
275
275
|
messages = mem.memory_json.messages
|
|
276
276
|
recent = messages[-limit:] if len(messages) > limit else messages
|
|
277
277
|
return json.dumps(
|
|
@@ -23,6 +23,7 @@ Scope = Literal["group", "user"] # type alias
|
|
|
23
23
|
|
|
24
24
|
def _get_event(ctx: ToolContext) -> OB11Event:
|
|
25
25
|
"""从 ToolContext 中提取 OneBot V11 原始事件"""
|
|
26
|
+
assert ctx.ctx.chat_object
|
|
26
27
|
amrictx: AmritaBotContext = ctx.ctx.chat_object._hook_kwargs["amrita"]
|
|
27
28
|
return amrictx["event"]
|
|
28
29
|
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: amrita_plugin_memory
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Amrita长期记忆插件
|
|
5
5
|
Requires-Python: <3.14,>=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -10,6 +10,7 @@ Requires-Dist: aiologic>=0.16.0
|
|
|
10
10
|
Requires-Dist: amrita-core>=0.8.5
|
|
11
11
|
Requires-Dist: amrita>=1.3
|
|
12
12
|
Requires-Dist: chromadb>=1.5.8
|
|
13
|
+
Requires-Dist: nonebot-plugin-amrita>=0.2.2
|
|
13
14
|
Requires-Dist: nonebot-plugin-apscheduler>=0.5.0
|
|
14
15
|
Requires-Dist: nonebot-plugin-localstore>=0.7.4
|
|
15
16
|
Dynamic: license-file
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "amrita_plugin_memory"
|
|
3
3
|
description = "Amrita长期记忆插件"
|
|
4
|
-
version = "0.2.
|
|
4
|
+
version = "0.2.8"
|
|
5
5
|
dependencies = [
|
|
6
6
|
"aiohttp>=3.13.3",
|
|
7
7
|
"aiologic>=0.16.0",
|
|
8
8
|
"amrita-core>=0.8.5",
|
|
9
9
|
"amrita>=1.3",
|
|
10
10
|
"chromadb>=1.5.8",
|
|
11
|
+
"nonebot-plugin-amrita>=0.2.2",
|
|
11
12
|
"nonebot-plugin-apscheduler>=0.5.0",
|
|
12
13
|
"nonebot-plugin-localstore>=0.7.4",
|
|
13
14
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/_state.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/backend.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/consts.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/hooks.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/nodes.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory/rethinking/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.7 → amrita_plugin_memory-0.2.8}/amrita_plugin_memory.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|