mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
- Add call_vision method to all bot implementations (DashScope, Claude, Gemini, ZhipuAI, MiniMax, Doubao, Moonshot, OpenAICompatibleBot) using each vendor's native multimodal API format - Remove call_with_tools/call_vision from Bot base class to fix MRO shadowing issue with OpenAICompatibleBot mixin - Refactor vision tool provider resolution: MainModel → other configured models (auto-discovered) → OpenAI → LinkAI, with automatic fallback - Return actual model name used in call_vision responses - Sync config.json API keys to .env bidirectionally on startup - Fix bot instance cache to detect bot_type/use_linkai config changes - Add SSE reconnection support for web console - Preserve image path hints in Gemini text for correct vision tool calls - Update docs/tools/vision.mdx
33 lines
945 B
Python
33 lines
945 B
Python
"""
|
|
Auto-replay chat robot abstract class
|
|
"""
|
|
|
|
from bridge.context import Context
|
|
from bridge.reply import Reply
|
|
|
|
|
|
class Bot(object):
|
|
"""
|
|
Base class for all chat-bot implementations.
|
|
|
|
Subclasses may also implement:
|
|
|
|
call_with_tools(messages, tools=None, stream=False, **kwargs)
|
|
-> dict | generator (OpenAI-compatible format)
|
|
|
|
call_vision(image_url, question, model=None, max_tokens=1000)
|
|
-> dict with keys: model, content, usage (or error/message)
|
|
|
|
These are NOT defined here to avoid shadowing concrete implementations
|
|
provided by mixin classes (e.g. OpenAICompatibleBot) in the MRO.
|
|
Use ``hasattr(bot, 'call_vision')`` to detect support at runtime.
|
|
"""
|
|
|
|
def reply(self, query, context: Context = None) -> Reply:
|
|
"""
|
|
bot auto-reply content
|
|
:param req: received message
|
|
:return: reply content
|
|
"""
|
|
raise NotImplementedError
|