更新星火认知模型聊天

This commit is contained in:
yaooo 2023-10-14 15:55:48 +08:00
parent bd77a97d2f
commit 36d86f82e2

View File

@ -152,10 +152,7 @@ class XunFeiController extends BaseApiController
if($code == 0){ if($code == 0){
$status = $resp["header"]["status"]; $status = $resp["header"]["status"];
$content = $resp['payload']['choices']['text'][0]['content'] ?? ''; $content = $resp['payload']['choices']['text'][0]['content'] ?? '';
$content = trim(str_replace(['\n', '\n\n', '\t', '\r', ' '], '', $content)); $answer .= $content;
if ($content) {
$answer .= $content;
}
if($status == 2){ if($status == 2){
break; break;
} }
@ -165,16 +162,10 @@ class XunFeiController extends BaseApiController
} }
} }
$data = [ $data = [
'informationg_demand_id' => $informationg_demand_id, 'ai_aianalyse' => $answer,
'information_id' => $informationg['information_id'] ?? 0,
'category_id' => $informationg['category_id'] ?? 0,
'category_child' => $informationg['category_child'] ?? 0,
'send_data' => $question,
'receive_data' => $answer,
'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
]; ];
$res = Db::name('user_informationg_aianalyse')->insert($data); $res = Db::name('user_informationg_demand')->where('id', $informationg_demand_id)->update($data);
if (!$res) { if (!$res) {
return $this->fail('AI分析信息失败'); return $this->fail('AI分析信息失败');
} }