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