|
@@ -27,6 +27,42 @@ class robot{
|
|
|
}
|
|
}
|
|
|
return self::$_robot;
|
|
return self::$_robot;
|
|
|
}
|
|
}
|
|
|
|
|
+ public function robot_chat() {
|
|
|
|
|
+ $operate = utils::_get('operate');
|
|
|
|
|
+ $operate = strtolower($operate);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * index page
|
|
|
|
|
+ */
|
|
|
|
|
+ if (empty($operate)) {
|
|
|
|
|
+ $column = column::getInstance()->getDisplayColumn('Robot_Chat_Search');
|
|
|
|
|
+ $OperationTableColumns = column::getInstance()->tableColumns('Operation_Search',$column);
|
|
|
|
|
+ $data['OperationTableColumns'] = $OperationTableColumns;
|
|
|
|
|
+ common::echo_json_encode(200,$data);
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+ /*
|
|
|
|
|
+ * operation_search search
|
|
|
|
|
+ */
|
|
|
|
|
+ if ($operate == "search") {
|
|
|
|
|
+ //$this->_operation_search();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($operate == "excel") {
|
|
|
|
|
+ $sql = common::deCode($_POST ['tmp_search'], 'D');
|
|
|
|
|
+ $sql = substr($sql, 0, strripos($sql, " limit"));
|
|
|
|
|
+ if(!empty($sql)){
|
|
|
|
|
+ $rss = common::excuteListSql($sql);
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach($rss as $key =>$val){
|
|
|
|
|
+ $rss[$key]['Operation Time'] = $rss[$key]['_operation_time'];
|
|
|
|
|
+ }
|
|
|
|
|
+ common::echo_json_encode(200,array("msg"=>"success","Data" => $rss));
|
|
|
|
|
+ exit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function robot_prompt_configuration() {
|
|
public function robot_prompt_configuration() {
|
|
|
$operate = utils::_get('operate');
|
|
$operate = utils::_get('operate');
|
|
|
$operate = strtolower($operate);
|
|
$operate = strtolower($operate);
|
|
@@ -230,8 +266,8 @@ class robot{
|
|
|
|
|
|
|
|
$ai_model = common::check_input($model);
|
|
$ai_model = common::check_input($model);
|
|
|
$input_token = common::check_input($input_token);
|
|
$input_token = common::check_input($input_token);
|
|
|
- $request_content = common::check_input($response['data']);
|
|
|
|
|
- $ai_response_content = common::check_input($response['full_response']);
|
|
|
|
|
|
|
+ $request_content = common::check_input(json_encode($response['data']));
|
|
|
|
|
+ $ai_response_content = common::check_input(json_encode($response['full_response']));
|
|
|
$output_token = common::check_input($output_token);
|
|
$output_token = common::check_input($output_token);
|
|
|
|
|
|
|
|
$sql = "INSERT INTO public.kln_robot_chat_log( question_id, user_name, user_type, question_type, question_content,
|
|
$sql = "INSERT INTO public.kln_robot_chat_log( question_id, user_name, user_type, question_type, question_content,
|
|
@@ -241,7 +277,7 @@ class robot{
|
|
|
response_duration)
|
|
response_duration)
|
|
|
VALUES ('$question_id', '$user_name', '$user_type', '$question_type', '$question_content',
|
|
VALUES ('$question_id', '$user_name', '$user_type', '$question_type', '$question_content',
|
|
|
'$answer_type', '$answer', '', '$response_duration', '$request_question_time',
|
|
'$answer_type', '$answer', '', '$response_duration', '$request_question_time',
|
|
|
- '$question_time', '$request_id', '$ai_model', '$input_token', '$request_content',
|
|
|
|
|
|
|
+ '$question_time', '$request_id', '$ai_model','$request_content', '$input_token',
|
|
|
'$ai_response_content', '$output_token', '$request_question_time', '$response_time',
|
|
'$ai_response_content', '$output_token', '$request_question_time', '$response_time',
|
|
|
'$response_duration');";
|
|
'$response_duration');";
|
|
|
$rs = common::excuteUpdateSql($sql);
|
|
$rs = common::excuteUpdateSql($sql);
|
|
@@ -261,6 +297,15 @@ class robot{
|
|
|
common::echo_json_encode(200,$rs);
|
|
common::echo_json_encode(200,$rs);
|
|
|
exit();
|
|
exit();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if ($operate == "download"){
|
|
|
|
|
+ $sql = common::deCode($_POST ['tmp_search'], 'D');
|
|
|
|
|
+ if(!empty($sql)){
|
|
|
|
|
+ $rs = common::excuteListSql($sql);
|
|
|
|
|
+ }
|
|
|
|
|
+ common::echo_json_encode(200,array("msg"=>"success","Data" => $rs));
|
|
|
|
|
+ exit;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function dealPromptFormatAndVue($configuration){
|
|
public function dealPromptFormatAndVue($configuration){
|