|
...
|
...
|
@@ -10,12 +10,34 @@ |
|
|
|
namespace App\Http\Logic\Bside\Gpt;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Gpt\Chat;
|
|
|
|
|
|
|
|
class ChatLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->model = new Count();
|
|
|
|
$this->model = new Chat();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sendMessage(){
|
|
|
|
if(isset($this->param['task_id'])){
|
|
|
|
$chatInfo = $this->model->read(['id'=>$this->param['task_id']]);
|
|
|
|
if($chatInfo === false){
|
|
|
|
$this->fail('会话不存在');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//创建一个会话
|
|
|
|
$saveData = [
|
|
|
|
'user_id'=>$this->user['id'],
|
|
|
|
'input_content'=>$this->param['input_content'],
|
|
|
|
];
|
|
|
|
$id = $this->model->addReturnId();
|
|
|
|
$saveData = [
|
|
|
|
'user_id'=>$this->user['id'],
|
|
|
|
'is_reply'=>1,
|
|
|
|
'input_content'=>$this->param['input_content'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|