作者 lyh

gx

@@ -113,6 +113,23 @@ class GeoQuestionRes extends Command @@ -113,6 +113,23 @@ class GeoQuestionRes extends Command
113 } 113 }
114 // 命中文案 114 // 命中文案
115 $hit_data[] = $result['text']; 115 $hit_data[] = $result['text'];
  116 + if(!empty($taskInfo['expect_result'])){
  117 + $str = "客户提出的问题:{$question},客户得到的回复:{$result['text']},客户需要预期:{$taskInfo['expect_result']},请分析得到的回复和预期是否一致,仅回复我是或者否";
  118 + $data = $geo_service->getChatResult($str, 'gpt-4o-mini');
  119 + if(isset($data['text']) && !empty($data['text'])){
  120 + switch ($data['text']){
  121 + case '是':
  122 + $is_match = 1;
  123 + break;
  124 + case '否':
  125 + $is_match = 2;
  126 + break;
  127 + default:
  128 + $is_match = 0;
  129 + break;
  130 + }
  131 + }
  132 + }
116 if(!empty($result['annotations'])){ 133 if(!empty($result['annotations'])){
117 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url'); 134 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
118 $title = array_column(array_column($result['annotations'], 'url_citation'), 'title'); 135 $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');
@@ -144,6 +161,7 @@ class GeoQuestionRes extends Command @@ -144,6 +161,7 @@ class GeoQuestionRes extends Command
144 'hit' => $hit ?? 0, 161 'hit' => $hit ?? 0,
145 'keywords_num'=>$keyword_num ?? [], 162 'keywords_num'=>$keyword_num ?? [],
146 'url_num'=>$url_num ?? [], 163 'url_num'=>$url_num ?? [],
  164 + 'is_match'=>$is_match ?? 0,
147 'created_at'=>date('Y-m-d H:i:s'), 165 'created_at'=>date('Y-m-d H:i:s'),
148 'updated_at'=>date('Y-m-d H:i:s'), 166 'updated_at'=>date('Y-m-d H:i:s'),
149 ]; 167 ];
@@ -61,7 +61,9 @@ class lyhDemo extends Command @@ -61,7 +61,9 @@ class lyhDemo extends Command
61 $expect = "While I don't have specific information on the RobotAnno coffee machine, in general"; 61 $expect = "While I don't have specific information on the RobotAnno coffee machine, in general";
62 $str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否"; 62 $str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否";
63 $data = $geo_service->getChatResult($str, 'gpt-4o-mini'); 63 $data = $geo_service->getChatResult($str, 'gpt-4o-mini');
64 - dd($data); 64 + if(isset($data['text']) && $data['text'] == '是'){
  65 +
  66 + }
65 } 67 }
66 68
67 /** 69 /**