소스 검색

#5406 AI Agents revamp: minor fixes for different models

Aleksandr Trofimov 4 달 전
부모
커밋
a0ba4d9a03
2개의 변경된 파일과 7개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 1
      inc/classes/BxDolAI.php
  2. 3 3
      inc/classes/BxDolAIToolCmtsAdd.php

+ 4 - 1
inc/classes/BxDolAI.php

@@ -379,7 +379,10 @@ class BxDolAI extends BxDolFactory implements iBxDolSingleton
 
     public function callAgent($sType, $aAgent, $mixedParams = [])
     {
-        $sParams = is_string($mixedParams) ? $mixedParams : json_encode($mixedParams);
+        if ($mixedParams)
+            $sParams = is_string($mixedParams) ? $mixedParams : json_encode($mixedParams);
+        else
+            $sParams = 'START';
 
         // update sample data
         $a = ['webhook' => 'webhook_sample'];

+ 3 - 3
inc/classes/BxDolAIToolCmtsAdd.php

@@ -44,7 +44,7 @@ class BxDolAIToolCmtsAdd extends BxDolAITool
             new ToolProperty(
                 name: 'parent_comment_id',
                 type: PropertyType::INTEGER,
-                description: 'Parent comment ID, for comment replies.',
+                description: 'Parent comment ID, for comment replies, default 0.',
                 required: false
             ),
             new ToolProperty(
@@ -56,7 +56,7 @@ class BxDolAIToolCmtsAdd extends BxDolAITool
         ];
     }
 
-    public function __invoke(string $module, int $content_id, string $comment_text, int $parent_comment_id = 0, int $author_profile_id = 0): array
+    public function __invoke(string $module, int $content_id, string $comment_text, ?int $parent_comment_id = null, ?int $author_profile_id = null): array
     {
         if ($author_profile_id) {
             $GLOBALS['glForceCurrentProfileId'] = $author_profile_id;
@@ -68,7 +68,7 @@ class BxDolAIToolCmtsAdd extends BxDolAITool
             $aData = [
                 'sys' => $module,
                 'id' => $content_id,
-                'cmt_parent_id' => $parent_comment_id,
+                'cmt_parent_id' => $parent_comment_id ?? 0,
                 // 'cmt_image' => [],
                 'cmt_text' => $comment_text,
             ];