作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2557
@@ -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 ];
@@ -294,6 +312,17 @@ class GeoQuestionRes extends Command @@ -294,6 +312,17 @@ class GeoQuestionRes extends Command
294 } 312 }
295 313
296 /** 314 /**
  315 + * @remark :预期结果对比
  316 + * @name :getExpectResult
  317 + * @author :lyh
  318 + * @method :post
  319 + * @time :2025/8/12 13:51
  320 + */
  321 + public function getExpectResult($question,$answer,$expect){
  322 + $str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否";
  323 + }
  324 +
  325 + /**
297 * 获取待执行任务ID 326 * 获取待执行任务ID
298 * @return mixed 327 * @return mixed
299 */ 328 */
@@ -50,17 +50,22 @@ class lyhDemo extends Command @@ -50,17 +50,22 @@ class lyhDemo extends Command
50 protected $description = '更新路由'; 50 protected $description = '更新路由';
51 51
52 public function handle(){ 52 public function handle(){
53 - echo 'start.'. PHP_EOL;  
54 - $ticketModel = new Tickets();  
55 - $list = $ticketModel->list(['id'=>['!=',0]],'id',['id','plan_end_at']);  
56 - foreach ($list as $item){  
57 - echo '执行数据id:'.$item['id'].PHP_EOL;  
58 - $ticketLogModel = new TicketLog();  
59 - $ticketLogModel->edit(['plan_end_at'=>$item['plan_end_at']],['ticket_id'=>$item['id']]);  
60 - } 53 + return $this->getExpectResult();
61 return true; 54 return true;
62 } 55 }
63 56
  57 + public function getExpectResult(){
  58 + $geo_service = new GeoService();
  59 + $question = 'Top AI Coffee Robot';
  60 + $answer = "Top AI Coffee Robot\" refers to advanced robotic systems that combine **precision automation, artificial intelligence, and specialty coffee expertise** to create high-quality beverages with minimal human intervention. Here's a breakdown of key features, leading examples, and benefits:\n\n### Core Features of Top AI Coffee Robots:\n1. **AI-Driven Customization** \n - Analyzes user preferences (strength, milk type, sweetness) via app profiles or voice commands. \n - Learns from feedback to refine future orders (e.g., \"less bitter than last time\"). \n2. **Robotic Precision Brewing** \n - Industrial arms handle grinding, tamping, steaming milk, and latte art with sub-millimeter accuracy. \n - Sensors monitor temperature, extraction time, and pressure for optimal flavor.";
  61 + $expect = "While I don't have specific information on the RobotAnno coffee machine, in general";
  62 + $str = "客户提出的问题:{$question},客户得到的回复:{$answer},客户需要预期:{$expect},请分析得到的回复和预期是否一致,仅回复我是或者否";
  63 + $data = $geo_service->getChatResult($str, 'gpt-4o-mini');
  64 + if(isset($data['text']) && $data['text'] == '是'){
  65 +
  66 + }
  67 + }
  68 +
64 /** 69 /**
65 * @remark :查看路由是否为空 70 * @remark :查看路由是否为空
66 * @name :_actionRoute 71 * @name :_actionRoute
@@ -48,7 +48,7 @@ class GeoQuestionResLogic extends BaseLogic @@ -48,7 +48,7 @@ class GeoQuestionResLogic extends BaseLogic
48 */ 48 */
49 public function getResultList($map = [],$page = 1,$row = 20){ 49 public function getResultList($map = [],$page = 1,$row = 20){
50 $map['project_id'] = $this->user['project_id']; 50 $map['project_id'] = $this->user['project_id'];
51 - $filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at']; 51 + $filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','created_at','updated_at'];
52 if(!empty($map['created_at'])){ 52 if(!empty($map['created_at'])){
53 $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']]; 53 $map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
54 $this->model = new GeoQuestionLog(); 54 $this->model = new GeoQuestionLog();