From 56ec44eb07f26dd1e8f0d82abd53aa0f8eb5ff4d Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 2 May 2026 15:00:33 +0800 Subject: [PATCH] chore: remove redundant logger messages and improve log clarity Co-authored-by: Copilot --- astrbot/core/knowledge_base/kb_mgr.py | 2 - astrbot/core/provider/func_tool_manager.py | 2 +- astrbot/dashboard/routes/config.py | 5 -- astrbot/dashboard/routes/plugin.py | 19 +++--- .../src/components/shared/ExtensionCard.vue | 19 +++--- dashboard/src/views/ExtensionPage.vue | 66 +++++++++++-------- .../views/knowledge-base/DocumentDetail.vue | 2 +- dashboard/src/views/knowledge-base/index.vue | 2 +- runtime_bootstrap.py | 2 - 9 files changed, 60 insertions(+), 59 deletions(-) diff --git a/astrbot/core/knowledge_base/kb_mgr.py b/astrbot/core/knowledge_base/kb_mgr.py index 8dea163cb..3285d42c7 100644 --- a/astrbot/core/knowledge_base/kb_mgr.py +++ b/astrbot/core/knowledge_base/kb_mgr.py @@ -36,8 +36,6 @@ class KnowledgeBaseManager: async def initialize(self) -> None: """初始化知识库模块""" try: - logger.info("正在初始化知识库模块...") - # 初始化数据库 await self._init_kb_database() diff --git a/astrbot/core/provider/func_tool_manager.py b/astrbot/core/provider/func_tool_manager.py index bf16a3ec9..ab6dd037f 100644 --- a/astrbot/core/provider/func_tool_manager.py +++ b/astrbot/core/provider/func_tool_manager.py @@ -311,7 +311,7 @@ class FunctionToolManager: handler=handler, ), ) - logger.info(f"添加函数调用工具: {name}") + logger.info(f"Added llm tool: {name}") def remove_func(self, name: str) -> None: """删除一个函数调用工具。""" diff --git a/astrbot/dashboard/routes/config.py b/astrbot/dashboard/routes/config.py index c82b8088d..9ec24d254 100644 --- a/astrbot/dashboard/routes/config.py +++ b/astrbot/dashboard/routes/config.py @@ -304,7 +304,6 @@ def save_config( ) -> None: """验证并保存配置""" errors = None - logger.info(f"Saving config, is_core={is_core}") # Snapshot old Computer config for change detection if is_core: @@ -993,10 +992,6 @@ class ConfigRoute(Route): if inspect.iscoroutinefunction(terminate_fn): await terminate_fn() - logger.info( - f"获取到 provider_source {provider_source_id} 的模型列表: {models}", - ) - return ( Response() .ok({"models": models, "model_metadata": metadata_map}) diff --git a/astrbot/dashboard/routes/plugin.py b/astrbot/dashboard/routes/plugin.py index a4f73b7a8..fbb2ede03 100644 --- a/astrbot/dashboard/routes/plugin.py +++ b/astrbot/dashboard/routes/plugin.py @@ -260,7 +260,7 @@ class PluginRoute(Route): cache_data = json.load(f) return cache_data.get("md5") except Exception as e: - logger.warning(f"加载缓存MD5失败: {e}") + logger.warning(f"Failed to load cached MD5: {e}") return None async def _fetch_remote_md5(self, md5_url: str | None) -> str | None: @@ -283,7 +283,7 @@ class PluginRoute(Route): data = await response.json() return data.get("md5", "") except Exception as e: - logger.debug(f"获取远程MD5失败: {e}") + logger.debug(f"Failed to fetch remote MD5: {e}") return None async def _is_cache_valid(self, source: RegistrySource) -> bool: @@ -291,17 +291,17 @@ class PluginRoute(Route): try: cached_md5 = self._load_cached_md5(source.cache_file) if not cached_md5: - logger.debug("缓存文件中没有MD5信息") + logger.debug("MD5 not found in cache, treating cache as invalid") return False remote_md5 = await self._fetch_remote_md5(source.md5_url) if remote_md5 is None: - logger.warning("无法获取远程MD5,将使用缓存") + logger.warning("Cannot fetch remote MD5, using cache without validation") return True # 如果无法获取远程MD5,认为缓存有效 is_valid = cached_md5 == remote_md5 logger.debug( - f"插件数据MD5: 本地={cached_md5}, 远程={remote_md5}, 有效={is_valid}", + f"Plugin cache: local={cached_md5}, remote={remote_md5}, effective={is_valid}", ) return is_valid @@ -318,11 +318,11 @@ class PluginRoute(Route): # 检查缓存是否有效 if "data" in cache_data and "timestamp" in cache_data: logger.debug( - f"加载缓存文件: {cache_file}, 缓存时间: {cache_data['timestamp']}", + f"Loading cached file: {cache_file}, Cache time: {cache_data['timestamp']}", ) return cache_data["data"] except Exception as e: - logger.warning(f"加载插件市场缓存失败: {e}") + logger.warning(f"Failed to load plugin market cache: {e}") return None def _save_plugin_cache(self, cache_file: str, data, md5: str | None = None) -> None: @@ -339,9 +339,9 @@ class PluginRoute(Route): with open(cache_file, "w", encoding="utf-8") as f: json.dump(cache_data, f, ensure_ascii=False, indent=2) - logger.debug(f"插件市场数据已缓存到: {cache_file}, MD5: {md5}") + logger.debug(f"Cached plugin market data: {cache_file}, MD5: {md5}") except Exception as e: - logger.warning(f"保存插件市场缓存失败: {e}") + logger.warning(f"Failed to save plugin market cache: {e}") async def get_plugin_logo_token(self, logo_path: str): try: @@ -742,7 +742,6 @@ class PluginRoute(Route): async def get_plugin_readme(self): plugin_name = request.args.get("name") - logger.debug(f"正在获取插件 {plugin_name} 的README文件内容") if not plugin_name: logger.warning("插件名称为空") diff --git a/dashboard/src/components/shared/ExtensionCard.vue b/dashboard/src/components/shared/ExtensionCard.vue index 07dfb3dbe..98391b8c6 100644 --- a/dashboard/src/components/shared/ExtensionCard.vue +++ b/dashboard/src/components/shared/ExtensionCard.vue @@ -290,7 +290,7 @@ const togglePin = () => { - + {{ isPinned ? tm("buttons.unpin") : tm("buttons.pin") }} @@ -317,7 +317,7 @@ const togglePin = () => { size="small" variant="tonal" color="info" - @click="viewReadme" + @click.stop="viewReadme" > @@ -330,7 +330,7 @@ const togglePin = () => { size="small" variant="tonal" color="primary" - @click="configure" + @click.stop="configure" > @@ -343,7 +343,7 @@ const togglePin = () => { size="small" variant="tonal" color="primary" - @click="reloadExtension" + @click.stop="reloadExtension" > @@ -356,14 +356,15 @@ const togglePin = () => { size="small" variant="tonal" color="secondary" + @click.stop > - + {{ tm("buttons.viewInfo") }} - + {{ extension.has_update ? tm("card.actions.updateTo") + " " + extension.online_version @@ -371,13 +372,13 @@ const togglePin = () => { }} - + {{ tm("card.actions.uninstallPlugin") }} diff --git a/dashboard/src/views/ExtensionPage.vue b/dashboard/src/views/ExtensionPage.vue index f8b3db9b7..5c33393cf 100644 --- a/dashboard/src/views/ExtensionPage.vue +++ b/dashboard/src/views/ExtensionPage.vue @@ -282,44 +282,48 @@ const installDialogPluginLogo = computed(() => { -
-
-

{{ tm("tabs.installedMcpServers") }}

-
- {{ t("features.tooluse.mcpServers.description") }} +
+
+
+

{{ tm("tabs.installedMcpServers") }}

+
+ {{ t("features.tooluse.mcpServers.description") }} +
+ + + + +
- - - - - -
-
-

{{ tm("tabs.skills") }}

-
- {{ tm("skills.runtimeHint") }} +
+
+
+

{{ tm("tabs.skills") }}

+
+ {{ tm("skills.runtimeHint") }} +
+ + + + +
- - - - - @@ -1101,6 +1105,12 @@ const installDialogPluginLogo = computed(() => { box-shadow: 0 12px 20px rgba(var(--v-theme-primary), 0.4); } +.extension-detail-width { + margin: 0 auto; + max-width: 1040px; + width: 100%; +} + .market-install-confirm { padding: 8px; } diff --git a/dashboard/src/views/knowledge-base/DocumentDetail.vue b/dashboard/src/views/knowledge-base/DocumentDetail.vue index 42c858212..921315e62 100644 --- a/dashboard/src/views/knowledge-base/DocumentDetail.vue +++ b/dashboard/src/views/knowledge-base/DocumentDetail.vue @@ -422,7 +422,7 @@ onMounted(() => {