This commit is contained in:
wangjinlei
2023-05-06 18:23:28 +08:00
parent 152a6be6b8
commit d9658b40d6
2 changed files with 34 additions and 7 deletions

View File

@@ -334,14 +334,19 @@ function freshContent($production_obj){
function pushGpt($content){
// die;
$url = 'https://api.openai.com/v1/edits';
$url = 'https://api.openai.com/v1/chat/completions';
$api_key = Env::get("gpt.api_key");
// Request data
$mes['role'] = "user";
$mes['content'] = $content;
$data = array(
'model' => 'text-davinci-edit-001',
'input' => $content,
'instruction'=>"改正拼写错误;改正时态错误;改正书写格式错误;"
);
'model' => 'gpt-3.5-turbo',
'messages' => [$mes],
'temperature' => 0.2,
'max_tokens' => 2048,
'n' => 1,
'stop' => ''
);
$headers = array(
'Content-Type: application/json',