amrita 1.0.0.dev1__tar.gz → 1.0.0.dev2__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-1.0.0.dev1/amrita.egg-info → amrita-1.0.0.dev2}/PKG-INFO +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/builtin_hook.py +1 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/check_rule.py +5 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/config.py +26 -30
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/chat.py +180 -13
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/debug_switchs.py +1 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/insights.py +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/mcp.py +3 -3
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/page.py +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/preprocess.py +1 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/runtime.py +11 -187
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/app.py +3 -1
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/nodelib.py +0 -11
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2/amrita.egg-info}/PKG-INFO +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita.egg-info/requires.txt +1 -1
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/pyproject.toml +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/LICENSE +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/MANIFEST.in +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/README.md +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/API.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/__main__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/bot.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/cache.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/cli.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/cmds/main.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/cmds/plugin.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/cmds/wrapper.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/config.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/config_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/dirty.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/load_test.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/on.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/exception.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/add_notices.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/chatobj.py +2 -2
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/choose_prompt.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/del_memory.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/disable.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/enable.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/fakepeople_switch.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/poke_event.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/preset_test.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/presets.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/prompt.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/recall.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/sessions.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/set_preset.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/handlers/show_abstract.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/hook_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/matcher.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/matcher_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/1d99948099bb_fix_memory.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/1e67057a1646_memory_abstract.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/25b14ed0ad3c_insights.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/3537b7cb6a29_init.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/5740c5aae763_json.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/702651e6e3d8_refactor_by_core.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/74381965bbe2_abs_move.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/b54b093a9ce3_sessions.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/migrations/ec1f1e46989b_usage.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/on_event.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/templates/function.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/templates/mcp.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/templates/models.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/templates/prompts.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/admin.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/functions.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/libchat.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/llm_tools/builtin_tools.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/llm_tools/manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/llm_tools/mcp_client.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/llm_tools/models.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/lock.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/protocol.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/sql.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/chat/utils/tokenizer.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/add.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/amrita.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/apicall_insight.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/auto_clean.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/ban.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/black.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/blacklist/black.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/blacklist/models.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/checker.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/event.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/leave.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/list_black.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/migrations/5d80e832962b_webui.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/migrations/9c25f4ea773e_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/migrations/a61ec0d70761_type.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/migrations/a62db4039f17_blacklist.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/models.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/pardon.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/send.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/status.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/status_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/manager/utils.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/menu/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/menu/commands.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/menu/manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/menu/models.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/menu/utils.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/API/admin.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/API/config.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/API/node.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/API/rules.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/command_manager.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/commands/lp_chat_group.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/commands/lp_perm_group.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/commands/lp_user.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/commands/main.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/config.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/legacy.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/migrations/8b619d7fca40_refactor.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/models.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/on_init.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/perm/utils.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/API.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/__init__.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/authlib.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/config.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/main.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/api.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/bot.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/confedit.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/config.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/dbmeta.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/index.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/route/user.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/sidebar.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/static/css/base.css +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/static/css/dash.css +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/static/images/Amrita.png +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/static/images/github-mark-white.svg +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/static/images/github-mark.svg +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/base.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/blacklist.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/confedit_edit.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/config.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/create_perm_group.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/dashboard.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/dbmetadata.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/error.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/group_permissions.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/index.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/password-help.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/perm_group_permissions.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/permissions.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/plugins.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/status.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/system_confedit.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/plugins/webui/service/templates/user_permissions.html +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/resource.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/admin.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/bot_utils.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/dbmetadata.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/dependencies.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/logging.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/plugins.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/rate.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/send.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/system_health.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita/utils/utils.py +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita.egg-info/SOURCES.txt +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita.egg-info/dependency_links.txt +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita.egg-info/entry_points.txt +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/amrita.egg-info/top_level.txt +0 -0
- {amrita-1.0.0.dev1 → amrita-1.0.0.dev2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: amrita
|
|
3
|
-
Version: 1.0.0.
|
|
3
|
+
Version: 1.0.0.dev2
|
|
4
4
|
Summary: A powerful AI bot framework powered by NoneBot2
|
|
5
5
|
License-Expression: GPL-3.0-or-later
|
|
6
6
|
Project-URL: Homepage, https://github.com/LiteSuggarDEV/Amrita
|
|
@@ -29,7 +29,7 @@ Requires-Dist: nonebot-plugin-orm>=0.8.3
|
|
|
29
29
|
Requires-Dist: nb-cli==1.6.0
|
|
30
30
|
Requires-Dist: watchfiles>=1.1.1
|
|
31
31
|
Provides-Extra: full
|
|
32
|
-
Requires-Dist: amrita-core==0.4.2
|
|
32
|
+
Requires-Dist: amrita-core==0.4.3.2; extra == "full"
|
|
33
33
|
Requires-Dist: nonebot-plugin-uniconf>=0.1.3; extra == "full"
|
|
34
34
|
Requires-Dist: aiomysql>=0.3.2; extra == "full"
|
|
35
35
|
Requires-Dist: aiopg>=1.4.0; extra == "full"
|
|
@@ -7,7 +7,6 @@ from amrita_core import (
|
|
|
7
7
|
ChatObject,
|
|
8
8
|
PreCompletionEvent,
|
|
9
9
|
ToolContext,
|
|
10
|
-
get_config,
|
|
11
10
|
on_precompletion,
|
|
12
11
|
on_tools,
|
|
13
12
|
)
|
|
@@ -47,7 +46,7 @@ agent.BUILTIN_TOOLS_NAME.add(REPORT_TOOL_MEDIUM.function.name)
|
|
|
47
46
|
@on_tools(
|
|
48
47
|
data=PROCESS_MESSAGE_TOOL,
|
|
49
48
|
custom_run=True,
|
|
50
|
-
enable_if=lambda:
|
|
49
|
+
enable_if=lambda: config_manager.config.llm.tools.agent_middle_message,
|
|
51
50
|
)
|
|
52
51
|
async def _(ctx: ToolContext) -> str | None:
|
|
53
52
|
msg: str = ctx.data["content"]
|
|
@@ -53,7 +53,7 @@ async def is_bot_enabled(event: Event) -> bool:
|
|
|
53
53
|
bots = set(nonebot.get_bots().keys())
|
|
54
54
|
if event.get_user_id() in bots: # 多实例下防止冲突
|
|
55
55
|
return False
|
|
56
|
-
if group_id := getattr(event, "group_id", None) is not None:
|
|
56
|
+
if (group_id := getattr(event, "group_id", None)) is not None:
|
|
57
57
|
data = await CachedUserDataRepository().get_group_config(
|
|
58
58
|
group_id,
|
|
59
59
|
)
|
|
@@ -219,7 +219,10 @@ async def should_respond_with_usage_check(event: MessageEvent, bot: Bot) -> bool
|
|
|
219
219
|
):
|
|
220
220
|
if event.is_tome():
|
|
221
221
|
with contextlib.suppress(Exception):
|
|
222
|
-
await bot.send(
|
|
222
|
+
await bot.send(
|
|
223
|
+
event,
|
|
224
|
+
random.choice(config_manager.config.usage_limit.limit_msg),
|
|
225
|
+
)
|
|
223
226
|
return False
|
|
224
227
|
return False
|
|
225
228
|
return True
|
|
@@ -11,6 +11,7 @@ import nonebot_plugin_localstore as store
|
|
|
11
11
|
import tomli
|
|
12
12
|
import tomli_w
|
|
13
13
|
from amrita_core import ModelPreset as CoreModelPreset
|
|
14
|
+
from amrita_core import PresetManager, set_config
|
|
14
15
|
from amrita_core.config import (
|
|
15
16
|
AmritaConfig as AmritaCoreConfig,
|
|
16
17
|
)
|
|
@@ -27,6 +28,7 @@ from nonebot import get_driver, logger
|
|
|
27
28
|
from nonebot_plugin_uniconf import EnvfulConfigManager
|
|
28
29
|
from nonebot_plugin_uniconf.manager import replace_env_vars
|
|
29
30
|
from pydantic import BaseModel, Field
|
|
31
|
+
from typing_extensions import final, override
|
|
30
32
|
|
|
31
33
|
from amrita.config_manager import UniConfigManager
|
|
32
34
|
|
|
@@ -262,10 +264,14 @@ class UsageLimitConfig(BaseModel):
|
|
|
262
264
|
total_daily_limit: int = Field(default=1500, description="总使用次数限制")
|
|
263
265
|
total_daily_token_limit: int = Field(default=1000000, description="总使用token限制")
|
|
264
266
|
global_insights_expire_days: int = Field(default=7, description="全局统计过期天数")
|
|
267
|
+
limit_msg: list[str] = Field(
|
|
268
|
+
default=["今日额度已达上限,请明天再试。"],
|
|
269
|
+
description="达到使用限制时返回的消息",
|
|
270
|
+
)
|
|
265
271
|
|
|
266
272
|
|
|
267
273
|
class LLM_Config(BaseModel):
|
|
268
|
-
tools: ToolsConfig = Field(default=ToolsConfig(), description="
|
|
274
|
+
tools: ToolsConfig = Field(default=ToolsConfig(), description="工具调用子系统")
|
|
269
275
|
stream: bool = Field(default=False, description="是否启用流式响应(逐字输出)")
|
|
270
276
|
memory_length_limit: int = Field(default=50, description="记忆上下文的最大消息数量")
|
|
271
277
|
max_tokens: int = Field(default=100, description="单次回复生成的最大token数")
|
|
@@ -294,14 +300,6 @@ class LLM_Config(BaseModel):
|
|
|
294
300
|
default=["你好,这个问题我暂时无法处理,请稍后再试。"],
|
|
295
301
|
description="触发安全熔断时随机返回的提示消息",
|
|
296
302
|
)
|
|
297
|
-
# 添加limit相关配置
|
|
298
|
-
limit: UsageLimitConfig = Field(
|
|
299
|
-
default=UsageLimitConfig(), description="使用限制配置"
|
|
300
|
-
)
|
|
301
|
-
limit_msg: list[str] = Field(
|
|
302
|
-
default=["使用次数已达上限,请明天再试。"],
|
|
303
|
-
description="达到使用限制时返回的消息",
|
|
304
|
-
)
|
|
305
303
|
|
|
306
304
|
|
|
307
305
|
class Config(BaseModel):
|
|
@@ -318,17 +316,11 @@ class Config(BaseModel):
|
|
|
318
316
|
autoreply: AutoReplyConfig = Field(
|
|
319
317
|
default=AutoReplyConfig(), description="自动回复设置"
|
|
320
318
|
)
|
|
321
|
-
# 添加与Core配置对应的function_config
|
|
322
|
-
function_config: ToolsConfig = Field(
|
|
323
|
-
default=ToolsConfig(), description="功能配置,对应Core的function_config"
|
|
324
|
-
)
|
|
325
319
|
function: FunctionConfig = Field(
|
|
326
320
|
default=FunctionConfig(), description="功能开关配置"
|
|
327
321
|
)
|
|
328
322
|
extended: ExtendConfig = Field(default=ExtendConfig(), description="扩展行为设置")
|
|
329
|
-
llm: LLM_Config = Field(
|
|
330
|
-
default=LLM_Config(), description="大语言模型配置,对应Core的llm"
|
|
331
|
-
)
|
|
323
|
+
llm: LLM_Config = Field(default=LLM_Config(), description="LLM核心功能配置")
|
|
332
324
|
extra: dict[str, Any] = Field(default={}, description="扩展预留区")
|
|
333
325
|
usage_limit: UsageLimitConfig = Field(
|
|
334
326
|
default=UsageLimitConfig(), description="使用限额配置"
|
|
@@ -337,9 +329,6 @@ class Config(BaseModel):
|
|
|
337
329
|
parse_segments: bool = Field(
|
|
338
330
|
default=True, description="是否解析特殊消息段(如@提及/合并转发等)"
|
|
339
331
|
)
|
|
340
|
-
matcher_function: bool = Field(
|
|
341
|
-
default=True, description="是否启用 SuggarMatcher 高级匹配功能"
|
|
342
|
-
)
|
|
343
332
|
preset: str = Field(default="default", description="默认使用的模型预设配置名称")
|
|
344
333
|
group_prompt_character: str = Field(
|
|
345
334
|
default="default", description="群聊场景使用的提示词模板名称"
|
|
@@ -386,15 +375,15 @@ class Config(BaseModel):
|
|
|
386
375
|
def to_core_config(self) -> AmritaCoreConfig:
|
|
387
376
|
return AmritaCoreConfig(
|
|
388
377
|
function_config=CoreFunctionConfig(
|
|
389
|
-
use_minimal_context=self.
|
|
390
|
-
tool_calling_mode=self.
|
|
391
|
-
agent_tool_call_limit=self.
|
|
392
|
-
agent_tool_call_notice=self.
|
|
393
|
-
agent_thought_mode=self.
|
|
394
|
-
agent_reasoning_hide=self.
|
|
395
|
-
agent_middle_message=self.
|
|
396
|
-
agent_mcp_client_enable=self.
|
|
397
|
-
agent_mcp_server_scripts=self.
|
|
378
|
+
use_minimal_context=self.llm.tools.use_minimal_context,
|
|
379
|
+
tool_calling_mode=self.llm.tools.tool_calling_mode,
|
|
380
|
+
agent_tool_call_limit=self.llm.tools.agent_tool_call_limit,
|
|
381
|
+
agent_tool_call_notice=self.llm.tools.agent_tool_call_notice,
|
|
382
|
+
agent_thought_mode=self.llm.tools.agent_thought_mode,
|
|
383
|
+
agent_reasoning_hide=self.llm.tools.agent_reasoning_hide,
|
|
384
|
+
agent_middle_message=self.llm.tools.agent_middle_message,
|
|
385
|
+
agent_mcp_client_enable=self.llm.tools.agent_mcp_client_enable,
|
|
386
|
+
agent_mcp_server_scripts=self.llm.tools.agent_mcp_server_scripts,
|
|
398
387
|
),
|
|
399
388
|
llm=CoreLLMConfig(
|
|
400
389
|
require_tools=self.llm.tools.require_tools,
|
|
@@ -447,6 +436,7 @@ class Prompts:
|
|
|
447
436
|
f.write(prompt.text)
|
|
448
437
|
|
|
449
438
|
|
|
439
|
+
@final
|
|
450
440
|
class ConfigManager(EnvfulConfigManager[Config]):
|
|
451
441
|
config_dir: Path = CONFIG_DIR
|
|
452
442
|
private_prompts: Path = config_dir / "private_prompts"
|
|
@@ -461,8 +451,13 @@ class ConfigManager(EnvfulConfigManager[Config]):
|
|
|
461
451
|
_owner_name = store._try_get_caller_plugin().name
|
|
462
452
|
__lateinit__ = True
|
|
463
453
|
|
|
454
|
+
@override
|
|
455
|
+
def _update_cache(self, value: Config | None = None):
|
|
456
|
+
super()._update_cache(value)
|
|
457
|
+
set_config(self.config.to_core_config())
|
|
458
|
+
|
|
464
459
|
async def __apost_init__(self):
|
|
465
|
-
|
|
460
|
+
await self.load()
|
|
466
461
|
|
|
467
462
|
async def load(self):
|
|
468
463
|
"""_初始化配置目录_"""
|
|
@@ -524,7 +519,7 @@ class ConfigManager(EnvfulConfigManager[Config]):
|
|
|
524
519
|
if cache and self.models:
|
|
525
520
|
return [model for model, _ in self.models]
|
|
526
521
|
self.models.clear() # 清空模型列表
|
|
527
|
-
|
|
522
|
+
PresetManager()._presets.clear()
|
|
528
523
|
for file in self.custom_models_dir.glob("*.json"):
|
|
529
524
|
model_data = ModelPreset.load(file).model_dump()
|
|
530
525
|
preset_data = replace_env_vars(model_data)
|
|
@@ -533,6 +528,7 @@ class ConfigManager(EnvfulConfigManager[Config]):
|
|
|
533
528
|
model_preset = ModelPreset.model_validate(preset_data)
|
|
534
529
|
self._model_name2file[model_preset.name] = file
|
|
535
530
|
self.models.append((model_preset, file.stem))
|
|
531
|
+
PresetManager().add_preset(model_preset)
|
|
536
532
|
|
|
537
533
|
return [model for model, _ in self.models]
|
|
538
534
|
|
|
@@ -5,8 +5,10 @@ import random
|
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
|
|
7
7
|
from amrita_core import (
|
|
8
|
+
MemoryModel,
|
|
8
9
|
PresetManager,
|
|
9
10
|
SessionsManager,
|
|
11
|
+
TextContent,
|
|
10
12
|
UniResponse,
|
|
11
13
|
UniResponseUsage,
|
|
12
14
|
debug_log,
|
|
@@ -18,12 +20,17 @@ from amrita_core.protocol import (
|
|
|
18
20
|
MessageWithMetadata,
|
|
19
21
|
StringMessageContent,
|
|
20
22
|
)
|
|
23
|
+
from amrita_core.types import ImageContent, ImageUrl
|
|
21
24
|
from nonebot import get_driver
|
|
22
25
|
from nonebot.adapters.onebot.v11 import (
|
|
23
26
|
Bot,
|
|
24
27
|
MessageSegment,
|
|
25
28
|
)
|
|
26
|
-
from nonebot.adapters.onebot.v11.event import
|
|
29
|
+
from nonebot.adapters.onebot.v11.event import (
|
|
30
|
+
GroupMessageEvent,
|
|
31
|
+
MessageEvent,
|
|
32
|
+
Reply,
|
|
33
|
+
)
|
|
27
34
|
from nonebot.exception import MatcherException, NoneBotException, ProcessException
|
|
28
35
|
from nonebot.matcher import Matcher
|
|
29
36
|
from pytz import utc
|
|
@@ -31,9 +38,13 @@ from pytz import utc
|
|
|
31
38
|
from amrita.plugins.chat.config import ConfigManager, config_manager
|
|
32
39
|
from amrita.plugins.chat.matcher import ChatException
|
|
33
40
|
from amrita.plugins.chat.utils.app import CachedUserDataRepository, UserMetadataSchema
|
|
34
|
-
from amrita.plugins.chat.utils.functions import
|
|
41
|
+
from amrita.plugins.chat.utils.functions import (
|
|
42
|
+
get_friend_name,
|
|
43
|
+
split_message_into_chats,
|
|
44
|
+
synthesize_message,
|
|
45
|
+
)
|
|
35
46
|
from amrita.plugins.chat.utils.lock import get_group_lock, get_private_lock
|
|
36
|
-
from amrita.plugins.chat.utils.sql import InsightsModel, get_any_id
|
|
47
|
+
from amrita.plugins.chat.utils.sql import InsightsModel, get_any_id, get_uni_user_id
|
|
37
48
|
from amrita.utils.admin import send_to_admin
|
|
38
49
|
|
|
39
50
|
from ..runtime import AmritaChatObject
|
|
@@ -59,6 +70,72 @@ def add_usage(
|
|
|
59
70
|
ins.total_called_count += 1
|
|
60
71
|
|
|
61
72
|
|
|
73
|
+
async def handle_reply(
|
|
74
|
+
reply: Reply, bot: Bot, group_id: int | None, content: str
|
|
75
|
+
) -> str:
|
|
76
|
+
"""处理引用消息:
|
|
77
|
+
- 提取引用消息的内容和时间信息。
|
|
78
|
+
- 格式化为可读的引用内容。
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
reply: 回复消息
|
|
82
|
+
bot: Bot实例
|
|
83
|
+
group_id: 群组ID(私聊为None)
|
|
84
|
+
content: 原始内容
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
格式化后的内容
|
|
88
|
+
"""
|
|
89
|
+
if not reply.sender.user_id:
|
|
90
|
+
return content
|
|
91
|
+
dt_object = datetime.fromtimestamp(reply.time)
|
|
92
|
+
weekday = dt_object.strftime("%A")
|
|
93
|
+
formatted_time = dt_object.strftime("%Y-%m-%d %I:%M:%S %p")
|
|
94
|
+
role = await get_user_role(bot, group_id, reply.sender.user_id) if group_id else ""
|
|
95
|
+
|
|
96
|
+
reply_content = await synthesize_message(reply.message, bot)
|
|
97
|
+
result = f"{content}\n<MESSAGE_REFERED>\n{formatted_time} {weekday} [{role}]{reply.sender.nickname}(QQ:{reply.sender.user_id})说:{reply_content}\n</MESSAGE_REFERED>"
|
|
98
|
+
debug_log(f"处理引用消息完成: {result[:50]}..")
|
|
99
|
+
return result
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def get_reply_pics(event: MessageEvent) -> list[ImageContent]:
|
|
103
|
+
"""获取引用消息中的图片内容
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
图片内容列表
|
|
107
|
+
"""
|
|
108
|
+
if reply := event.reply:
|
|
109
|
+
msg = reply.message
|
|
110
|
+
images = [
|
|
111
|
+
ImageContent(image_url=ImageUrl(url=url))
|
|
112
|
+
for seg in msg
|
|
113
|
+
if seg.type == "image" and (url := seg.data.get("url")) is not None
|
|
114
|
+
]
|
|
115
|
+
debug_log(f"获取引用图片完成,共 {len(images)} 张")
|
|
116
|
+
return images
|
|
117
|
+
return []
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
async def get_user_role(bot: Bot, group_id: int, user_id: int) -> str:
|
|
121
|
+
"""获取用户在群聊中的身份(群主、管理员或普通成员)。
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
group_id: 群组ID
|
|
125
|
+
user_id: 用户ID
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
用户角色字符串
|
|
129
|
+
"""
|
|
130
|
+
role_data = await bot.get_group_member_info(group_id=group_id, user_id=user_id)
|
|
131
|
+
role = role_data["role"]
|
|
132
|
+
role_str = {"admin": "群管理员", "owner": "群主", "member": "普通成员"}.get(
|
|
133
|
+
role, "[获取身份失败]"
|
|
134
|
+
)
|
|
135
|
+
debug_log(f"获取用户角色完成: {role_str}")
|
|
136
|
+
return role_str
|
|
137
|
+
|
|
138
|
+
|
|
62
139
|
async def send_response(chat: AmritaChatObject, response: str):
|
|
63
140
|
"""发送聊天模型的回复,根据配置选择不同的发送方式。
|
|
64
141
|
|
|
@@ -79,6 +156,58 @@ async def send_response(chat: AmritaChatObject, response: str):
|
|
|
79
156
|
)
|
|
80
157
|
|
|
81
158
|
|
|
159
|
+
async def synthesize_message_to_msg(
|
|
160
|
+
event: MessageEvent,
|
|
161
|
+
role: str,
|
|
162
|
+
user_name: str,
|
|
163
|
+
user_id: str,
|
|
164
|
+
content: str,
|
|
165
|
+
):
|
|
166
|
+
"""将消息转换为Message
|
|
167
|
+
|
|
168
|
+
根据配置和多模态支持情况,将事件消息转换为适当的格式,
|
|
169
|
+
支持文本和图片内容的组合。
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
event: 消息事件
|
|
173
|
+
role: 用户角色
|
|
174
|
+
date: 时间戳
|
|
175
|
+
user_name: 用户名
|
|
176
|
+
user_id: 用户ID
|
|
177
|
+
content: 消息内容
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
转换后的消息内容
|
|
181
|
+
"""
|
|
182
|
+
is_multimodal: bool = (
|
|
183
|
+
any(
|
|
184
|
+
[
|
|
185
|
+
(await config_manager.get_preset(preset=preset)).multimodal
|
|
186
|
+
for preset in [
|
|
187
|
+
config_manager.config.preset,
|
|
188
|
+
*config_manager.config.preset_extension.backup_preset_list,
|
|
189
|
+
]
|
|
190
|
+
]
|
|
191
|
+
)
|
|
192
|
+
or len(config_manager.config.preset_extension.multi_modal_preset_list) > 0
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
if config_manager.config.parse_segments:
|
|
196
|
+
text = (
|
|
197
|
+
[TextContent(text=f"[{role}][{user_name}({user_id})]说:{content}")]
|
|
198
|
+
+ [
|
|
199
|
+
ImageContent(image_url=ImageUrl(url=seg.data["url"]))
|
|
200
|
+
for seg in event.message
|
|
201
|
+
if seg.type == "image" and seg.data.get("url")
|
|
202
|
+
]
|
|
203
|
+
if is_multimodal
|
|
204
|
+
else f"[{role}][{user_name}({user_id})]说:{content}"
|
|
205
|
+
)
|
|
206
|
+
else:
|
|
207
|
+
text = event.message.extract_plain_text()
|
|
208
|
+
return text
|
|
209
|
+
|
|
210
|
+
|
|
82
211
|
async def entry(event: MessageEvent, matcher: Matcher, bot: Bot):
|
|
83
212
|
"""聊天处理器入口函数
|
|
84
213
|
|
|
@@ -98,11 +227,7 @@ async def entry(event: MessageEvent, matcher: Matcher, bot: Bot):
|
|
|
98
227
|
if prefix.strip()
|
|
99
228
|
):
|
|
100
229
|
matcher.skip()
|
|
101
|
-
session_id = (
|
|
102
|
-
f"{event.group_id}_{event.user_id}"
|
|
103
|
-
if isinstance(event, GroupMessageEvent)
|
|
104
|
-
else f"private_{event.user_id}"
|
|
105
|
-
)
|
|
230
|
+
session_id = get_uni_user_id(event)
|
|
106
231
|
train = (
|
|
107
232
|
config_manager.group_train
|
|
108
233
|
if isinstance(event, GroupMessageEvent)
|
|
@@ -114,7 +239,9 @@ async def entry(event: MessageEvent, matcher: Matcher, bot: Bot):
|
|
|
114
239
|
|
|
115
240
|
async def filter(message: COMPLETION_RETURNING):
|
|
116
241
|
nonlocal can_send_message
|
|
117
|
-
if isinstance(message,
|
|
242
|
+
if isinstance(message, str):
|
|
243
|
+
return
|
|
244
|
+
elif isinstance(message, MessageWithMetadata):
|
|
118
245
|
match message.metadata.get("type", ""):
|
|
119
246
|
case "system":
|
|
120
247
|
if (
|
|
@@ -156,15 +283,56 @@ async def entry(event: MessageEvent, matcher: Matcher, bot: Bot):
|
|
|
156
283
|
msg = MessageSegment.image(await message.get_image())
|
|
157
284
|
await matcher.send(msg)
|
|
158
285
|
|
|
286
|
+
content = await synthesize_message(event.get_message(), bot)
|
|
287
|
+
debug_log(f"合成消息完成: {content}")
|
|
288
|
+
|
|
289
|
+
if content.strip() == "":
|
|
290
|
+
content = ""
|
|
291
|
+
if event.reply:
|
|
292
|
+
group_id = event.group_id if isinstance(event, GroupMessageEvent) else None
|
|
293
|
+
debug_log("处理引用消息..")
|
|
294
|
+
content = await handle_reply(event.reply, bot, group_id, content)
|
|
295
|
+
|
|
296
|
+
reply_pics = get_reply_pics(event)
|
|
297
|
+
debug_log(f"获取引用图片完成,共 {len(reply_pics)} 张")
|
|
298
|
+
if isinstance(event, GroupMessageEvent):
|
|
299
|
+
# 群聊消息处理
|
|
300
|
+
debug_log("处理群聊消息")
|
|
301
|
+
group_id = event.group_id
|
|
302
|
+
|
|
303
|
+
user_name = (
|
|
304
|
+
(await bot.get_group_member_info(group_id=group_id, user_id=event.user_id))[
|
|
305
|
+
"nickname"
|
|
306
|
+
]
|
|
307
|
+
if not config.function.use_user_nickname
|
|
308
|
+
else event.sender.nickname
|
|
309
|
+
)
|
|
310
|
+
else:
|
|
311
|
+
debug_log("处理私聊消息")
|
|
312
|
+
user_name = (
|
|
313
|
+
await get_friend_name(event.user_id, bot=bot)
|
|
314
|
+
if not isinstance(event, GroupMessageEvent)
|
|
315
|
+
else event.sender.nickname
|
|
316
|
+
)
|
|
317
|
+
role = (
|
|
318
|
+
await get_user_role(bot, event.group_id, event.user_id)
|
|
319
|
+
if isinstance(event, GroupMessageEvent)
|
|
320
|
+
else ""
|
|
321
|
+
)
|
|
322
|
+
content = await synthesize_message_to_msg(
|
|
323
|
+
event, role, str(user_name), str(event.user_id), content
|
|
324
|
+
)
|
|
325
|
+
if isinstance(content, list):
|
|
326
|
+
content.extend(reply_pics)
|
|
159
327
|
chat: AmritaChatObject = AmritaChatObject(
|
|
160
328
|
event=event,
|
|
161
329
|
matcher=matcher,
|
|
162
330
|
bot=bot,
|
|
163
331
|
session_id=session_id,
|
|
164
332
|
train=train,
|
|
165
|
-
auto_create_session=
|
|
166
|
-
|
|
167
|
-
|
|
333
|
+
auto_create_session=False,
|
|
334
|
+
user_input=content,
|
|
335
|
+
context=MemoryModel(),
|
|
168
336
|
preset=PresetManager().get_preset(config.preset),
|
|
169
337
|
hook_args=(event, matcher, bot),
|
|
170
338
|
exception_ignored=(ProcessException, MatcherException),
|
|
@@ -225,7 +393,6 @@ async def entry(event: MessageEvent, matcher: Matcher, bot: Bot):
|
|
|
225
393
|
):
|
|
226
394
|
d.called_count # 增加使用次数
|
|
227
395
|
add_usage(d, response.usage)
|
|
228
|
-
debug_log(f"更新记忆数据,使用次数: {d.usage}")
|
|
229
396
|
await cudr.update_metadata(d)
|
|
230
397
|
SessionsManager().drop_session(session_id)
|
|
231
398
|
chat._pending = False
|
|
@@ -27,14 +27,14 @@ async def insights(event: MessageEvent, matcher: Matcher, args: Message = Comman
|
|
|
27
27
|
is_admin = await is_bot_admin(event)
|
|
28
28
|
|
|
29
29
|
msg = (
|
|
30
|
-
f"您今日的使用次数为:{data.
|
|
30
|
+
f"您今日的使用次数为:{data.called_count}/{user_limit if (user_limit != -1 and enable_limit and not is_admin) else '♾'}次"
|
|
31
31
|
+ f"\n您今日的token使用量为:{data.tokens_input + data.tokens_output}/{user_token_limit if (user_token_limit != -1 and enable_limit and not is_admin) else '♾'}tokens"
|
|
32
32
|
+ f"(输入:{data.tokens_input},输出:{data.tokens_output})"
|
|
33
33
|
)
|
|
34
34
|
if isinstance(event, GroupMessageEvent):
|
|
35
35
|
data = await CachedUserDataRepository().get_metadata(*get_any_id(event))
|
|
36
36
|
msg = (
|
|
37
|
-
f"群组使用次数为:{data.
|
|
37
|
+
f"群组使用次数为:{data.called_count}/{group_limit if (group_limit != -1 and enable_limit) else '♾'}次"
|
|
38
38
|
+ f"\n群组使用token为:{data.tokens_input + data.tokens_output}/{group_token_limit if (group_token_limit != -1 and enable_limit) else '♾'}tokens"
|
|
39
39
|
+ f"(输入:{data.tokens_input},输出:{data.tokens_output})"
|
|
40
40
|
+ f"\n\n{msg}"
|
|
@@ -72,15 +72,15 @@ async def mcp_status(bot: Bot, matcher: Matcher, event: MessageEvent, arg: list[
|
|
|
72
72
|
async def add_mcp_server(
|
|
73
73
|
matcher: Matcher, bot: Bot, event: MessageEvent, mcp_server: str
|
|
74
74
|
):
|
|
75
|
-
|
|
75
|
+
config = config_manager.config
|
|
76
|
+
if not config.llm.tools.agent_mcp_client_enable:
|
|
76
77
|
return
|
|
77
|
-
config = config_manager.ins_config
|
|
78
78
|
if not mcp_server:
|
|
79
79
|
await matcher.finish("请输入MCP Server脚本路径")
|
|
80
80
|
if mcp_server in config.llm.tools.agent_mcp_server_scripts:
|
|
81
81
|
await matcher.finish("MCP Server脚本已存在")
|
|
82
82
|
try:
|
|
83
|
-
await ClientManager().initialize_this(mcp_server)
|
|
83
|
+
await ClientManager().initialize_this(mcp_server, True)
|
|
84
84
|
config.llm.tools.agent_mcp_server_scripts.append(mcp_server)
|
|
85
85
|
await config_manager.save_config()
|
|
86
86
|
await matcher.send("添加成功")
|
|
@@ -447,7 +447,7 @@ async def add_mcp_server(request: Request):
|
|
|
447
447
|
|
|
448
448
|
# 尝试初始化MCP服务器
|
|
449
449
|
client_manager = ClientManager()
|
|
450
|
-
await client_manager.initialize_this(server_script)
|
|
450
|
+
await client_manager.initialize_this(server_script, True)
|
|
451
451
|
|
|
452
452
|
# 保存到配置
|
|
453
453
|
config.llm.tools.agent_mcp_server_scripts.append(server_script)
|
|
@@ -500,7 +500,7 @@ async def update_mcp_server(request: Request, server_script: str | None = None):
|
|
|
500
500
|
await client_manager.unregister_client(old_server_script)
|
|
501
501
|
|
|
502
502
|
# 尝试初始化新MCP服务器
|
|
503
|
-
await client_manager.initialize_this(new_server_script)
|
|
503
|
+
await client_manager.initialize_this(new_server_script, True)
|
|
504
504
|
|
|
505
505
|
# 添加新服务器到配置
|
|
506
506
|
config.llm.tools.agent_mcp_server_scripts.append(new_server_script)
|