Prechádzať zdrojové kódy

Update message_notifier: add multimodal message output

StrayWarrior 3 týždňov pred
rodič
commit
bc9922602e
1 zmenil súbory, kde vykonal 23 pridanie a 2 odobranie
  1. 23 2
      pqai_agent/toolkit/message_notifier.py

+ 23 - 2
pqai_agent/toolkit/message_notifier.py

@@ -1,3 +1,5 @@
+from typing import List, Dict
+
 from pqai_agent.logging_service import logger
 from pqai_agent.toolkit.base import BaseToolkit
 from pqai_agent.toolkit.function_tool import FunctionTool
@@ -16,7 +18,26 @@ class MessageNotifier(BaseToolkit):
         """
 
         logger.info(f"Message to user: {message}")
-        return 'Message sent successfully.'
+        return 'success'
+
+    def output_multimodal_message(self, message: Dict[str, str]) -> str:
+        """Outputs a multimodal message to the user.
+        Args:
+            message (Dict[str, str]): The message to output. Message schema:
+            {
+                "type": "text|image|gif|video|mini_program",
+                "content": "message content",
+                "title": "only needed if type is video or mini_program",
+                "cover_image": "only needed if type is mini_program",
+            }
+            if message type is image, gif, video or mini_program, the content should be a URL.
+        Returns:
+            str: A confirmation message.
+        """
+        logger.info(f"Multimodal message to user: {message}")
+        return 'success'
+
 
     def get_tools(self):
-        return [FunctionTool(self.message_notify_user)]
+        return [FunctionTool(self.message_notify_user),
+                FunctionTool(self.output_multimodal_message)]