Refactor web search plugin and clean up code

Refactored the web search plugin by removing the old Bing search implementation and reorganizing the plugin structure. Introduced modular search engine classes under 'web_search_tool/engines' and utility tools under 'web_search_tool/tools' and 'web_search_tool/utils'. Updated references and initialization logic to support multiple search engines and improved maintainability. Also performed minor code cleanups and replaced 'except ...: pass' with 'except ...: ...' for brevity.
This commit is contained in:
雅诺狐
2025-08-21 23:42:16 +08:00
committed by Windpicker-owo
parent 2d1f23af88
commit 1b9c86abef
26 changed files with 1366 additions and 1111 deletions

View File

@@ -786,9 +786,8 @@ def build_pic_mapping_info(pic_id_mapping: Dict[str, str]) -> str:
image = session.execute(select(Images).where(Images.image_id == pic_id)).scalar()
if image and image.description:
description = image.description
except Exception:
except Exception: ...
# 如果查询失败,保持默认描述
pass
mapping_lines.append(f"[{display_name}] 的内容:{description}")

View File

@@ -70,8 +70,8 @@ class PromptContext:
# 如果reset失败尝试直接设置
try:
self._current_context = previous_context
except Exception:
pass # 静默忽略恢复失败
except Exception: ...
# 静默忽略恢复失败
async def get_prompt_async(self, name: str) -> Optional["Prompt"]:
"""异步获取当前作用域中的提示模板"""

View File

@@ -384,8 +384,7 @@ class ImageManager:
# 确保是RGB格式方便比较
frame = gif.convert("RGB")
all_frames.append(frame.copy())
except EOFError:
pass # 读完啦
except EOFError: ... # 读完啦
if not all_frames:
logger.warning("GIF中没有找到任何帧")