AstrBot 4.10.2__py3-none-any.whl → 4.10.3__py3-none-any.whl

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 (63) hide show
  1. astrbot/builtin_stars/astrbot/long_term_memory.py +186 -0
  2. astrbot/builtin_stars/astrbot/main.py +128 -0
  3. astrbot/builtin_stars/astrbot/metadata.yaml +4 -0
  4. astrbot/builtin_stars/astrbot/process_llm_request.py +245 -0
  5. astrbot/builtin_stars/builtin_commands/commands/__init__.py +31 -0
  6. astrbot/builtin_stars/builtin_commands/commands/admin.py +77 -0
  7. astrbot/builtin_stars/builtin_commands/commands/alter_cmd.py +173 -0
  8. astrbot/builtin_stars/builtin_commands/commands/conversation.py +366 -0
  9. astrbot/builtin_stars/builtin_commands/commands/help.py +88 -0
  10. astrbot/builtin_stars/builtin_commands/commands/llm.py +20 -0
  11. astrbot/builtin_stars/builtin_commands/commands/persona.py +142 -0
  12. astrbot/builtin_stars/builtin_commands/commands/plugin.py +120 -0
  13. astrbot/builtin_stars/builtin_commands/commands/provider.py +329 -0
  14. astrbot/builtin_stars/builtin_commands/commands/setunset.py +36 -0
  15. astrbot/builtin_stars/builtin_commands/commands/sid.py +36 -0
  16. astrbot/builtin_stars/builtin_commands/commands/t2i.py +23 -0
  17. astrbot/builtin_stars/builtin_commands/commands/tool.py +31 -0
  18. astrbot/builtin_stars/builtin_commands/commands/tts.py +36 -0
  19. astrbot/builtin_stars/builtin_commands/commands/utils/rst_scene.py +26 -0
  20. astrbot/builtin_stars/builtin_commands/main.py +237 -0
  21. astrbot/builtin_stars/builtin_commands/metadata.yaml +4 -0
  22. astrbot/builtin_stars/python_interpreter/main.py +537 -0
  23. astrbot/builtin_stars/python_interpreter/metadata.yaml +4 -0
  24. astrbot/builtin_stars/python_interpreter/requirements.txt +1 -0
  25. astrbot/builtin_stars/python_interpreter/shared/api.py +22 -0
  26. astrbot/builtin_stars/reminder/main.py +266 -0
  27. astrbot/builtin_stars/reminder/metadata.yaml +4 -0
  28. astrbot/builtin_stars/session_controller/main.py +114 -0
  29. astrbot/builtin_stars/session_controller/metadata.yaml +5 -0
  30. astrbot/builtin_stars/web_searcher/engines/__init__.py +111 -0
  31. astrbot/builtin_stars/web_searcher/engines/bing.py +30 -0
  32. astrbot/builtin_stars/web_searcher/engines/sogo.py +52 -0
  33. astrbot/builtin_stars/web_searcher/main.py +436 -0
  34. astrbot/builtin_stars/web_searcher/metadata.yaml +4 -0
  35. astrbot/cli/__init__.py +1 -1
  36. astrbot/core/agent/message.py +9 -0
  37. astrbot/core/agent/runners/tool_loop_agent_runner.py +2 -1
  38. astrbot/core/backup/__init__.py +26 -0
  39. astrbot/core/backup/constants.py +77 -0
  40. astrbot/core/backup/exporter.py +476 -0
  41. astrbot/core/backup/importer.py +761 -0
  42. astrbot/core/config/default.py +1 -1
  43. astrbot/core/log.py +1 -1
  44. astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py +1 -1
  45. astrbot/core/pipeline/waking_check/stage.py +2 -1
  46. astrbot/core/provider/entities.py +32 -9
  47. astrbot/core/provider/provider.py +3 -1
  48. astrbot/core/provider/sources/anthropic_source.py +80 -27
  49. astrbot/core/provider/sources/fishaudio_tts_api_source.py +14 -6
  50. astrbot/core/provider/sources/gemini_source.py +75 -26
  51. astrbot/core/provider/sources/openai_source.py +68 -25
  52. astrbot/core/star/context.py +1 -1
  53. astrbot/core/star/star_manager.py +11 -13
  54. astrbot/core/utils/astrbot_path.py +34 -0
  55. astrbot/dashboard/routes/__init__.py +2 -0
  56. astrbot/dashboard/routes/backup.py +589 -0
  57. astrbot/dashboard/routes/log.py +44 -10
  58. astrbot/dashboard/server.py +8 -1
  59. {astrbot-4.10.2.dist-info → astrbot-4.10.3.dist-info}/METADATA +1 -1
  60. {astrbot-4.10.2.dist-info → astrbot-4.10.3.dist-info}/RECORD +63 -24
  61. {astrbot-4.10.2.dist-info → astrbot-4.10.3.dist-info}/WHEEL +0 -0
  62. {astrbot-4.10.2.dist-info → astrbot-4.10.3.dist-info}/entry_points.txt +0 -0
  63. {astrbot-4.10.2.dist-info → astrbot-4.10.3.dist-info}/licenses/LICENSE +0 -0
@@ -18,6 +18,7 @@ from astrbot.core.config.astrbot_config import AstrBotConfig
18
18
  from astrbot.core.provider.register import llm_tools
19
19
  from astrbot.core.utils.astrbot_path import (
20
20
  get_astrbot_config_path,
21
+ get_astrbot_path,
21
22
  get_astrbot_plugin_path,
22
23
  )
23
24
  from astrbot.core.utils.io import remove_dir
@@ -49,13 +50,10 @@ class PluginManager:
49
50
  """存储插件的路径。即 data/plugins"""
50
51
  self.plugin_config_path = get_astrbot_config_path()
51
52
  """存储插件配置的路径。data/config"""
52
- self.reserved_plugin_path = os.path.abspath(
53
- os.path.join(
54
- os.path.dirname(os.path.abspath(__file__)),
55
- "../../../packages",
56
- ),
53
+ self.reserved_plugin_path = os.path.join(
54
+ get_astrbot_path(), "astrbot", "builtin_stars"
57
55
  )
58
- """保留插件的路径。在 packages 目录下"""
56
+ """保留插件的路径。在 astrbot/builtin_stars 目录下"""
59
57
  self.conf_schema_fname = "_conf_schema.json"
60
58
  self.logo_fname = "logo.png"
61
59
  """插件配置 Schema 文件名"""
@@ -252,7 +250,7 @@ class PluginManager:
252
250
  list[str]: 与该插件相关的模块名列表
253
251
 
254
252
  """
255
- prefix = "packages." if is_reserved else "data.plugins."
253
+ prefix = "astrbot.builtin_stars." if is_reserved else "data.plugins."
256
254
  return [
257
255
  key
258
256
  for key in list(sys.modules.keys())
@@ -270,7 +268,7 @@ class PluginManager:
270
268
  可以基于模块名模式或插件目录名移除模块,用于清理插件相关的模块缓存
271
269
 
272
270
  Args:
273
- module_patterns: 要移除的模块名模式列表(例如 ["data.plugins", "packages"])
271
+ module_patterns: 要移除的模块名模式列表(例如 ["data.plugins", "astrbot.builtin_stars"])
274
272
  root_dir_name: 插件根目录名,用于移除与该插件相关的所有模块
275
273
  is_reserved: 插件是否为保留插件(影响模块路径前缀)
276
274
 
@@ -382,9 +380,9 @@ class PluginManager:
382
380
  reserved = plugin_module.get(
383
381
  "reserved",
384
382
  False,
385
- ) # 是否是保留插件。目前在 packages/ 目录下的都是保留插件。保留插件不可以卸载。
383
+ ) # 是否是保留插件。目前在 astrbot/builtin_stars 目录下的都是保留插件。保留插件不可以卸载。
386
384
 
387
- path = "data.plugins." if not reserved else "packages."
385
+ path = "data.plugins." if not reserved else "astrbot.builtin_stars."
388
386
  path += root_dir_name + "." + module_str
389
387
 
390
388
  # 检查是否需要载入指定的插件
@@ -829,7 +827,7 @@ class PluginManager:
829
827
  if (
830
828
  mp
831
829
  and mp.startswith(plugin_module_path)
832
- and not mp.endswith(("packages", "data.plugins"))
830
+ and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
833
831
  ):
834
832
  to_remove.append(func_tool)
835
833
  for func_tool in to_remove:
@@ -884,7 +882,7 @@ class PluginManager:
884
882
  plugin.module_path
885
883
  and mp
886
884
  and plugin.module_path.startswith(mp)
887
- and not mp.endswith(("packages", "data.plugins"))
885
+ and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
888
886
  ):
889
887
  func_tool.active = False
890
888
  if func_tool.name not in inactivated_llm_tools:
@@ -933,7 +931,7 @@ class PluginManager:
933
931
  plugin.module_path
934
932
  and mp
935
933
  and plugin.module_path.startswith(mp)
936
- and not mp.endswith(("packages", "data.plugins"))
934
+ and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
937
935
  and func_tool.name in inactivated_llm_tools
938
936
  ):
939
937
  inactivated_llm_tools.remove(func_tool.name)
@@ -5,6 +5,10 @@
5
5
  数据目录路径:固定为根目录下的 data 目录
6
6
  配置文件路径:固定为数据目录下的 config 目录
7
7
  插件目录路径:固定为数据目录下的 plugins 目录
8
+ 插件数据目录路径:固定为数据目录下的 plugin_data 目录
9
+ T2I 模板目录路径:固定为数据目录下的 t2i_templates 目录
10
+ WebChat 数据目录路径:固定为数据目录下的 webchat 目录
11
+ 临时文件目录路径:固定为数据目录下的 temp 目录
8
12
  """
9
13
 
10
14
  import os
@@ -37,3 +41,33 @@ def get_astrbot_config_path() -> str:
37
41
  def get_astrbot_plugin_path() -> str:
38
42
  """获取Astrbot插件目录路径"""
39
43
  return os.path.realpath(os.path.join(get_astrbot_data_path(), "plugins"))
44
+
45
+
46
+ def get_astrbot_plugin_data_path() -> str:
47
+ """获取Astrbot插件数据目录路径"""
48
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "plugin_data"))
49
+
50
+
51
+ def get_astrbot_t2i_templates_path() -> str:
52
+ """获取Astrbot T2I 模板目录路径"""
53
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "t2i_templates"))
54
+
55
+
56
+ def get_astrbot_webchat_path() -> str:
57
+ """获取Astrbot WebChat 数据目录路径"""
58
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "webchat"))
59
+
60
+
61
+ def get_astrbot_temp_path() -> str:
62
+ """获取Astrbot临时文件目录路径"""
63
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "temp"))
64
+
65
+
66
+ def get_astrbot_knowledge_base_path() -> str:
67
+ """获取Astrbot知识库根目录路径"""
68
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "knowledge_base"))
69
+
70
+
71
+ def get_astrbot_backups_path() -> str:
72
+ """获取Astrbot备份目录路径"""
73
+ return os.path.realpath(os.path.join(get_astrbot_data_path(), "backups"))
@@ -1,4 +1,5 @@
1
1
  from .auth import AuthRoute
2
+ from .backup import BackupRoute
2
3
  from .chat import ChatRoute
3
4
  from .command import CommandRoute
4
5
  from .config import ConfigRoute
@@ -17,6 +18,7 @@ from .update import UpdateRoute
17
18
 
18
19
  __all__ = [
19
20
  "AuthRoute",
21
+ "BackupRoute",
20
22
  "ChatRoute",
21
23
  "CommandRoute",
22
24
  "ConfigRoute",