作者 liyuhang

gx

@@ -47,17 +47,17 @@ class Common @@ -47,17 +47,17 @@ class Common
47 * @author :liyuhang 47 * @author :liyuhang
48 * @method 48 * @method
49 */ 49 */
50 - public function send_openai_msg($url){  
51 - $this->param = request()->post(); 50 + public static function send_openai_msg($url){
  51 + $param = request()->post();
52 $url = HTTP_OPENAI_URL.$url; 52 $url = HTTP_OPENAI_URL.$url;
53 $aiCommandModel = New AiCommandModel(); 53 $aiCommandModel = New AiCommandModel();
54 //指定库获取指令 54 //指定库获取指令
55 - $info = $aiCommandModel->read(['key'=>$this->param['key']]); 55 + $info = $aiCommandModel->read(['key'=>$param['key']]);
56 if($info === false){ 56 if($info === false){
57 response('指令不存在',400); 57 response('指令不存在',400);
58 } 58 }
59 //替换关键字 59 //替换关键字
60 - $content = str_replace('$keyword$', $this->param['keywords'], $info['ai']); 60 + $content = str_replace('$keyword$', $param['keywords'], $info['ai']);
61 $data = [ 61 $data = [
62 'messages'=>[ 62 'messages'=>[
63 ['role'=>'system','content'=>$info['scene']], 63 ['role'=>'system','content'=>$info['scene']],