|
@@ -2496,6 +2496,15 @@ class common {
|
|
|
public static function aiApiLogRecord($sequence,$question_id,$ai_model,$request_content,$input_token,$ai_response_content,
|
|
public static function aiApiLogRecord($sequence,$question_id,$ai_model,$request_content,$input_token,$ai_response_content,
|
|
|
$output_token,$request_time,$response_time,$response_duration) {
|
|
$output_token,$request_time,$response_time,$response_duration) {
|
|
|
|
|
|
|
|
|
|
+ //处理一下参数
|
|
|
|
|
+ $sequence = common::check_input($sequence);
|
|
|
|
|
+ $question_id = common::check_input($question_id);
|
|
|
|
|
+ $ai_model = common::check_input($ai_model);
|
|
|
|
|
+ $input_token = common::check_input($input_token);
|
|
|
|
|
+ $request_content = common::check_input($request_content);
|
|
|
|
|
+ $ai_response_content = common::check_input($ai_response_content);
|
|
|
|
|
+ $output_token = common::check_input($output_token);
|
|
|
|
|
+
|
|
|
$name = $ai_model =="" ? "DS" : "CD";
|
|
$name = $ai_model =="" ? "DS" : "CD";
|
|
|
$request_id = "R".$name."".date("YYYYMMDD")."".$sequence;
|
|
$request_id = "R".$name."".date("YYYYMMDD")."".$sequence;
|
|
|
$sql = "INSERT INTO public.kln_robot_ai_api_log(
|
|
$sql = "INSERT INTO public.kln_robot_ai_api_log(
|
|
@@ -2507,7 +2516,6 @@ class common {
|
|
|
$rs = common::excuteUpdateSql($sql);
|
|
$rs = common::excuteUpdateSql($sql);
|
|
|
if (!$rs) {
|
|
if (!$rs) {
|
|
|
$data = array("msg" => "save Error");
|
|
$data = array("msg" => "save Error");
|
|
|
- $data = array("msg" => "save Successful");
|
|
|
|
|
common::echo_json_encode(200,$data);
|
|
common::echo_json_encode(200,$data);
|
|
|
exit();
|
|
exit();
|
|
|
}
|
|
}
|