amrita_plugin_memory 0.2.5__tar.gz → 0.2.6__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.
Files changed (27) hide show
  1. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/PKG-INFO +1 -1
  2. amrita_plugin_memory-0.2.6/amrita_plugin_memory/rethinking/__init__.py +13 -0
  3. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/_state.py +8 -0
  4. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/runner.py +3 -9
  5. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/tools.py +1 -2
  6. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/PKG-INFO +1 -1
  7. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/pyproject.toml +1 -1
  8. amrita_plugin_memory-0.2.5/amrita_plugin_memory/rethinking/__init__.py +0 -20
  9. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/LICENSE +0 -0
  10. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/README.md +0 -0
  11. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/__init__.py +0 -0
  12. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/config.py +0 -0
  13. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/embed.py +0 -0
  14. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/matchers.py +0 -0
  15. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/backend.py +0 -0
  16. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/consts.py +0 -0
  17. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/hooks.py +0 -0
  18. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/nodes.py +0 -0
  19. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/schemas.py +0 -0
  20. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/workflow.py +0 -0
  21. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/tools.py +0 -0
  22. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/vector.py +0 -0
  23. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/SOURCES.txt +0 -0
  24. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/dependency_links.txt +0 -0
  25. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/requires.txt +0 -0
  26. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/top_level.txt +0 -0
  27. {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amrita_plugin_memory
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Amrita长期记忆插件
5
5
  Requires-Python: <3.14,>=3.10
6
6
  Description-Content-Type: text/markdown
@@ -0,0 +1,13 @@
1
+ """潜意识推理循环(rethinking"""
2
+
3
+ from . import _state, backend, hooks, nodes, schemas, tools, workflow
4
+
5
+ __all__ = [
6
+ "_state",
7
+ "backend",
8
+ "hooks",
9
+ "nodes",
10
+ "schemas",
11
+ "tools",
12
+ "workflow",
13
+ ]
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from typing import TYPE_CHECKING, Any
6
6
 
7
+ from amrita.plugins.chat.config import config_manager
8
+ from amrita_core import ModelPreset
7
9
  from amrita_core.tools.manager import MultiToolsManager
8
10
 
9
11
  if TYPE_CHECKING:
@@ -15,6 +17,12 @@ _pending_messages: list[dict[str, Any]] = []
15
17
  _SUBCONSCIOUS_TOOLS = MultiToolsManager()
16
18
 
17
19
 
20
+ async def get_preset() -> ModelPreset:
21
+ return await config_manager.get_preset(
22
+ (await config_manager.safe_get_config()).preset
23
+ )
24
+
25
+
18
26
  def get_runner() -> SubconsciousRunner | None:
19
27
  return _runner
20
28
 
@@ -16,7 +16,7 @@ from amrita_core.base.backend import BackendSlots
16
16
  from amrita_core.builtins.agent import ReActAgentStrategy
17
17
  from amrita_core.chatmanager import ChatObject
18
18
  from amrita_core.config import get_config
19
- from amrita_core.preset import PresetManager
19
+ from amrita_core.preset import ModelPreset
20
20
  from amrita_core.types import Message, UniResponseUsage
21
21
  from amrita_core.utils import gather_usage
22
22
  from amrita_sense import WorkflowInterpreter
@@ -123,18 +123,13 @@ class SubconsciousRunner:
123
123
  self._is_running = True
124
124
  self._iter_stop_result = {}
125
125
 
126
- preset = PresetManager().get_default_preset()
126
+ preset = await _state.get_preset()
127
127
  prompt_text = await self._load_prompt()
128
128
  user_msg_text = (
129
129
  f"现在是第 {self._total_runs + 1} 次潜意识推理循环。"
130
130
  f"请检查用户 (ID: {self._config.target_user_id}) 的记忆库,执行必要的整理操作。"
131
131
  f"完成后务必调用 subconscious_iter_stop。"
132
132
  )
133
- if self._is_native_thinking():
134
- user_msg_text += (
135
- " (注意:你的模型启用了内置思考模式,请务必调用 think_and_reason。)"
136
- )
137
-
138
133
  train = Message(role="system", content=prompt_text)
139
134
  user_input = user_msg_text
140
135
 
@@ -181,8 +176,7 @@ class SubconsciousRunner:
181
176
  await self._post_process(chat_obj)
182
177
 
183
178
  @staticmethod
184
- def _is_native_thinking() -> bool:
185
- preset = PresetManager().get_default_preset()
179
+ def _is_native_thinking(preset: ModelPreset) -> bool:
186
180
  return (
187
181
  preset.thinking_config is not None
188
182
  and preset.thinking_config.thinking_type == "enabled"
@@ -8,7 +8,6 @@ from typing import Any
8
8
 
9
9
  from amrita_core import on_tools
10
10
  from amrita_core.libchat import call_completion, get_last_response
11
- from amrita_core.preset import PresetManager
12
11
  from amrita_core.types import CONTENT_LIST_TYPE, Message
13
12
  from chromadb import GetResult
14
13
  from jinja2 import Template
@@ -308,7 +307,7 @@ async def _generate_send_content(intent: str, memory_context: str) -> str:
308
307
  current_time=datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC"),
309
308
  character_prompt=character_prompt,
310
309
  )
311
- preset = PresetManager().get_default_preset()
310
+ preset = await _state.get_preset()
312
311
  messages: CONTENT_LIST_TYPE = [
313
312
  Message(role="system", content=system_content),
314
313
  Message(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amrita_plugin_memory
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Amrita长期记忆插件
5
5
  Requires-Python: <3.14,>=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "amrita_plugin_memory"
3
3
  description = "Amrita长期记忆插件"
4
- version = "0.2.5"
4
+ version = "0.2.6"
5
5
  dependencies = [
6
6
  "aiohttp>=3.13.3",
7
7
  "aiologic>=0.16.0",
@@ -1,20 +0,0 @@
1
- """潜意识推理循环(rethinking 子包)。
2
-
3
- 导入此包时触发工具注册和 hook 注册。
4
- 注意:避免模块级导入 tools/runner 等会触发循环导入的子模块。
5
- 这些模块的副作用(@on_tools 注册、hook 注册)通过 hooks 和 tools 内部的延迟导入自动生效。
6
- """
7
-
8
- from . import _state, backend, hooks, nodes, schemas, workflow
9
-
10
- __all__ = [
11
- "_state",
12
- "backend",
13
- "consts",
14
- "hooks",
15
- "nodes",
16
- "runner",
17
- "schemas",
18
- "tools",
19
- "workflow",
20
- ]