新增点歌插件。
This commit is contained in:
@@ -41,13 +41,10 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
try:
|
||||
|
||||
# 从插件配置中获取API密钥和URL
|
||||
api_config = self._config.get("api", {})
|
||||
self._api_key = api_config.get("api_key", "app-McGLzBhBjeBCSEi7n83MtuTo")
|
||||
self._api_url = api_config.get("api_url", "http://192.168.2.240/v1/chat-messages")
|
||||
|
||||
self.all_contacts = context["all_contacts"]
|
||||
self.message_storage = MessageStorage()
|
||||
|
||||
self.LOG.info(f"初始化 {self.name} 插件成功")
|
||||
@@ -96,11 +93,13 @@ class MessageSummaryPlugin(MessagePluginInterface):
|
||||
if gbm and gbm.get_group_permission(group_id, Feature.AI_CAPABILITY) == PermissionStatus.DISABLED:
|
||||
return True, None
|
||||
# 从消息历史中获取群聊记录
|
||||
chat_content = self.message_storage.get_messages(group_id, self.all_contacts)
|
||||
all_contacts: dict = message.get("all_contacts")
|
||||
|
||||
chat_content = self.message_storage.get_messages(group_id, all_contacts)
|
||||
if len(chat_content) < 100:
|
||||
return False, None
|
||||
# 生成总结
|
||||
summary, image_path = self._generate_summary(chat_content, self.all_contacts.get(group_id, group_id))
|
||||
summary, image_path = self._generate_summary(chat_content, all_contacts.get(group_id, group_id))
|
||||
|
||||
# 发送总结结果
|
||||
wcf = message.get("wcf")
|
||||
|
||||
Reference in New Issue
Block a user