mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 15:09:46 +08:00
Merge remote-tracking branch 'origin/v3' into v3
# Conflicts: # app/api/endpoints/agent.py # app/api/endpoints/anthropic.py # app/api/endpoints/openai.py # app/chain/__init__.py # app/chain/message.py # app/chain/site.py # app/chain/subscribe.py # app/chain/transfer.py # app/modules/discord/__init__.py # app/modules/qqbot/__init__.py # app/modules/slack/__init__.py # app/modules/telegram/__init__.py # app/modules/wechat/__init__.py # app/runtime/extensions/module_manager.py # app/runtime/extensions/service_registry.py # tests/test_agent_interaction.py # tests/test_slash_command_interactions.py # tests/test_web_agent_stream.py
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Any, List, Optional, Tuple, Union
|
||||
from app.domain.context import Context, MediaInfo
|
||||
from app.application.messaging.agent import register_channel_admin_resolver, resolve_config_principal_ids
|
||||
from app.runtime.log import logger
|
||||
from app.modules import _ModuleBase, _MessageBase
|
||||
from app.modules._base import _MessageChannelModuleBase
|
||||
from app.modules.feishu.feishu import Feishu
|
||||
from app.schemas import IncomingMessage, NotificationChannel, MessageResponse, Message
|
||||
from app.schemas.types import ModuleType
|
||||
@@ -17,7 +17,7 @@ register_channel_admin_resolver(
|
||||
)
|
||||
|
||||
|
||||
class FeishuModule(_ModuleBase, _MessageBase[Feishu]):
|
||||
class FeishuModule(_MessageChannelModuleBase[Feishu]):
|
||||
def init_module(self) -> None:
|
||||
super().init_service(service_name=Feishu.__name__.lower(), service_type=Feishu)
|
||||
self._channel = NotificationChannel.Feishu
|
||||
@@ -38,6 +38,13 @@ class FeishuModule(_ModuleBase, _MessageBase[Feishu]):
|
||||
def get_priority() -> int:
|
||||
return 2
|
||||
|
||||
def _commands_enabled(self, config: Optional[dict]) -> bool:
|
||||
"""
|
||||
飞书机器人无斜杠命令概念,lark_oapi Client 也不提供命令注册/删除 API,
|
||||
跳过命令注册,避免基类默认钩子调用不存在的 client.register_commands。
|
||||
"""
|
||||
return False
|
||||
|
||||
def stop(self) -> None:
|
||||
"""停止模块"""
|
||||
for client in self.get_instances().values():
|
||||
@@ -46,15 +53,6 @@ class FeishuModule(_ModuleBase, _MessageBase[Feishu]):
|
||||
except Exception as err:
|
||||
logger.error(f"停止飞书模块实例失败:{err}")
|
||||
|
||||
def test(self) -> Optional[Tuple[bool, str]]:
|
||||
if not self.get_instances():
|
||||
return None
|
||||
for name, client in self.get_instances().items():
|
||||
state = client.get_state()
|
||||
if not state:
|
||||
return False, f"飞书 {name} 未就绪"
|
||||
return True, ""
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
"""通知模块通过系统通知配置控制实例化,这里不额外设置环境开关。"""
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user