aient 1.1.98__tar.gz → 1.1.99__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 (56) hide show
  1. {aient-1.1.98 → aient-1.1.99}/PKG-INFO +1 -1
  2. {aient-1.1.98 → aient-1.1.99}/aient/architext/architext/core.py +20 -2
  3. {aient-1.1.98 → aient-1.1.99}/aient/architext/test/test.py +32 -0
  4. {aient-1.1.98 → aient-1.1.99}/aient.egg-info/PKG-INFO +1 -1
  5. {aient-1.1.98 → aient-1.1.99}/pyproject.toml +1 -1
  6. {aient-1.1.98 → aient-1.1.99}/LICENSE +0 -0
  7. {aient-1.1.98 → aient-1.1.99}/README.md +0 -0
  8. {aient-1.1.98 → aient-1.1.99}/aient/__init__.py +0 -0
  9. {aient-1.1.98 → aient-1.1.99}/aient/architext/architext/__init__.py +0 -0
  10. {aient-1.1.98 → aient-1.1.99}/aient/architext/test/openai_client.py +0 -0
  11. {aient-1.1.98 → aient-1.1.99}/aient/architext/test/test_save_load.py +0 -0
  12. {aient-1.1.98 → aient-1.1.99}/aient/core/__init__.py +0 -0
  13. {aient-1.1.98 → aient-1.1.99}/aient/core/log_config.py +0 -0
  14. {aient-1.1.98 → aient-1.1.99}/aient/core/models.py +0 -0
  15. {aient-1.1.98 → aient-1.1.99}/aient/core/request.py +0 -0
  16. {aient-1.1.98 → aient-1.1.99}/aient/core/response.py +0 -0
  17. {aient-1.1.98 → aient-1.1.99}/aient/core/test/test_base_api.py +0 -0
  18. {aient-1.1.98 → aient-1.1.99}/aient/core/test/test_geminimask.py +0 -0
  19. {aient-1.1.98 → aient-1.1.99}/aient/core/test/test_image.py +0 -0
  20. {aient-1.1.98 → aient-1.1.99}/aient/core/test/test_payload.py +0 -0
  21. {aient-1.1.98 → aient-1.1.99}/aient/core/utils.py +0 -0
  22. {aient-1.1.98 → aient-1.1.99}/aient/models/__init__.py +0 -0
  23. {aient-1.1.98 → aient-1.1.99}/aient/models/audio.py +0 -0
  24. {aient-1.1.98 → aient-1.1.99}/aient/models/base.py +0 -0
  25. {aient-1.1.98 → aient-1.1.99}/aient/models/chatgpt.py +0 -0
  26. {aient-1.1.98 → aient-1.1.99}/aient/plugins/__init__.py +0 -0
  27. {aient-1.1.98 → aient-1.1.99}/aient/plugins/arXiv.py +0 -0
  28. {aient-1.1.98 → aient-1.1.99}/aient/plugins/config.py +0 -0
  29. {aient-1.1.98 → aient-1.1.99}/aient/plugins/excute_command.py +0 -0
  30. {aient-1.1.98 → aient-1.1.99}/aient/plugins/get_time.py +0 -0
  31. {aient-1.1.98 → aient-1.1.99}/aient/plugins/image.py +0 -0
  32. {aient-1.1.98 → aient-1.1.99}/aient/plugins/list_directory.py +0 -0
  33. {aient-1.1.98 → aient-1.1.99}/aient/plugins/read_file.py +0 -0
  34. {aient-1.1.98 → aient-1.1.99}/aient/plugins/read_image.py +0 -0
  35. {aient-1.1.98 → aient-1.1.99}/aient/plugins/readonly.py +0 -0
  36. {aient-1.1.98 → aient-1.1.99}/aient/plugins/registry.py +0 -0
  37. {aient-1.1.98 → aient-1.1.99}/aient/plugins/run_python.py +0 -0
  38. {aient-1.1.98 → aient-1.1.99}/aient/plugins/websearch.py +0 -0
  39. {aient-1.1.98 → aient-1.1.99}/aient/plugins/write_file.py +0 -0
  40. {aient-1.1.98 → aient-1.1.99}/aient/utils/__init__.py +0 -0
  41. {aient-1.1.98 → aient-1.1.99}/aient/utils/prompt.py +0 -0
  42. {aient-1.1.98 → aient-1.1.99}/aient/utils/scripts.py +0 -0
  43. {aient-1.1.98 → aient-1.1.99}/aient.egg-info/SOURCES.txt +0 -0
  44. {aient-1.1.98 → aient-1.1.99}/aient.egg-info/dependency_links.txt +0 -0
  45. {aient-1.1.98 → aient-1.1.99}/aient.egg-info/requires.txt +0 -0
  46. {aient-1.1.98 → aient-1.1.99}/aient.egg-info/top_level.txt +0 -0
  47. {aient-1.1.98 → aient-1.1.99}/setup.cfg +0 -0
  48. {aient-1.1.98 → aient-1.1.99}/test/test_Web_crawler.py +0 -0
  49. {aient-1.1.98 → aient-1.1.99}/test/test_ddg_search.py +0 -0
  50. {aient-1.1.98 → aient-1.1.99}/test/test_google_search.py +0 -0
  51. {aient-1.1.98 → aient-1.1.99}/test/test_ollama.py +0 -0
  52. {aient-1.1.98 → aient-1.1.99}/test/test_plugin.py +0 -0
  53. {aient-1.1.98 → aient-1.1.99}/test/test_search.py +0 -0
  54. {aient-1.1.98 → aient-1.1.99}/test/test_url.py +0 -0
  55. {aient-1.1.98 → aient-1.1.99}/test/test_whisper.py +0 -0
  56. {aient-1.1.98 → aient-1.1.99}/test/test_yjh.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.98
3
+ Version: 1.1.99
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -35,13 +35,30 @@ class ContentBlock:
35
35
  # 2. 上下文提供者 (带缓存)
36
36
  class ContextProvider(ABC):
37
37
  def __init__(self, name: str):
38
- self.name = name; self._cached_content: Optional[str] = None; self._is_stale: bool = True
38
+ self.name = name
39
+ self._cached_content: Optional[str] = None
40
+ self._is_stale: bool = True
41
+ self._visible: bool = True
39
42
 
40
43
  def __str__(self):
41
44
  # This allows the object to be captured when used inside an f-string.
42
45
  return _register_provider(self)
43
46
 
44
47
  def mark_stale(self): self._is_stale = True
48
+
49
+ @property
50
+ def visible(self) -> bool:
51
+ """Gets the visibility of the provider."""
52
+ return self._visible
53
+
54
+ @visible.setter
55
+ def visible(self, value: bool):
56
+ """Sets the visibility of the provider."""
57
+ if self._visible != value:
58
+ self._visible = value
59
+ # Content needs to be re-evaluated, but the source data hasn't changed,
60
+ # so just marking it stale is enough for the renderer to reconsider it.
61
+ self.mark_stale()
45
62
  async def refresh(self):
46
63
  if self._is_stale:
47
64
  self._cached_content = await self.render()
@@ -51,7 +68,8 @@ class ContextProvider(ABC):
51
68
  @abstractmethod
52
69
  def update(self, *args, **kwargs): raise NotImplementedError
53
70
  def get_content_block(self) -> Optional[ContentBlock]:
54
- if self._cached_content is not None: return ContentBlock(self.name, self._cached_content)
71
+ if self.visible and self._cached_content is not None:
72
+ return ContentBlock(self.name, self._cached_content)
55
73
  return None
56
74
 
57
75
  class Texts(ContextProvider):
@@ -1021,6 +1021,38 @@ Current time: {Texts(lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"))}
1021
1021
  empty_text = Texts("")
1022
1022
  self.assertEqual(empty_text.content, "")
1023
1023
 
1024
+ async def test_z7_provider_visibility(self):
1025
+ """测试 provider 的可见性标志是否能正常工作"""
1026
+ # 1. 初始化 provider,visible 默认为 True
1027
+ text_provider = Texts("Hello, World!", name="greeting")
1028
+ self.assertTrue(text_provider.visible)
1029
+
1030
+ messages = Messages(SystemMessage(text_provider))
1031
+
1032
+ # 2. 初始渲染,内容应该可见
1033
+ rendered_visible = await messages.render_latest()
1034
+ self.assertEqual(len(rendered_visible), 1)
1035
+ self.assertEqual(rendered_visible[0]['content'], "Hello, World!")
1036
+
1037
+ # 3. 设置为不可见
1038
+ provider = messages.provider("greeting")
1039
+ provider.visible = False
1040
+ self.assertFalse(provider.visible)
1041
+
1042
+ # 4. 再次渲染,内容应该消失
1043
+ # 因为 visibility 变化会 mark_stale,所以需要 render_latest
1044
+ rendered_invisible = await messages.render_latest()
1045
+ self.assertEqual(len(rendered_invisible), 0, "设置为不可见后,消息应该不被渲染")
1046
+
1047
+ # 5. 再次设置为可见
1048
+ provider.visible = True
1049
+ self.assertTrue(provider.visible)
1050
+
1051
+ # 6. 渲染,内容应该再次出现
1052
+ rendered_visible_again = await messages.render_latest()
1053
+ self.assertEqual(len(rendered_visible_again), 1)
1054
+ self.assertEqual(rendered_visible_again[0]['content'], "Hello, World!")
1055
+
1024
1056
 
1025
1057
  # ==============================================================================
1026
1058
  # 6. 演示
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.1.98
3
+ Version: 1.1.99
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aient"
3
- version = "1.1.98"
3
+ version = "1.1.99"
4
4
  description = "Aient: The Awakening of Agent."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes