对接
This commit is contained in:
@@ -76,20 +76,30 @@ class Aiarticle extends Base
|
||||
$oOpenAi = new OpenAi;
|
||||
if($sArticleType == 'default'){
|
||||
$aMessage = $oOpenAi->buildDefaultPrompt($aSearch);
|
||||
if(empty($aMessage)){
|
||||
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
||||
}
|
||||
$aParam = ['messages' => $aMessage,'model' => empty($aParam['api_model']) ? 'gpt-4.1' : $aParam['api_model'],'redis_id' => empty($aSearch['article_id']) ? 0 : $aSearch['article_id']];
|
||||
$aResult = json_decode($oOpenAi->createWechatContent($aParam),true);
|
||||
}
|
||||
if($sArticleType == 'Review'){
|
||||
$aMessage = $oOpenAi->buildReviewPrompt($aSearch);
|
||||
if(empty($aMessage)){
|
||||
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
||||
}
|
||||
$aParam = ['messages' => $aMessage,'model' => empty($aParam['api_model']) ? 'gpt-4.1' : $aParam['api_model'],'redis_id' => empty($aSearch['article_id']) ? 0 : $aSearch['article_id']];
|
||||
$aResult = json_decode($oOpenAi->createWechatContent($aParam),true);
|
||||
}
|
||||
if($sArticleType == 1){
|
||||
$aMessage = $oOpenAi->buildTranslatePrompt($aSearch);
|
||||
}
|
||||
if(empty($aMessage)){
|
||||
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
||||
if(empty($aMessage)){
|
||||
return json_encode(['status' => 5,'msg' => 'AI Q&A content not obtained']);
|
||||
}
|
||||
$aParam = ['messages' => $aMessage,'model' => empty($aParam['api_model']) ? 'gpt-4.1' : $aParam['api_model']];
|
||||
$aResult = json_decode($oOpenAi->curlOpenAI($aParam),true);
|
||||
}
|
||||
|
||||
//请求OPENAI接口
|
||||
$aParam = ['messages' => $aMessage,'model' => empty($aParam['api_model']) ? 'gpt-4.1' : $aParam['api_model'],'redis_id' => $aSearch['article_id']];
|
||||
$aResult = json_decode($oOpenAi->createWechatContent($aParam),true);
|
||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||
if($iStatus != 1){
|
||||
return json_encode($aResult);
|
||||
|
||||
Reference in New Issue
Block a user