作者 lyh

变更数据

... ... @@ -2,6 +2,8 @@
namespace App\Http\Logic\Bside\Ai;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
... ... @@ -174,17 +176,32 @@ class AiBlogLogic extends BaseLogic
$param['route'] = generateRoute(Translate::tran($param['route'] ?? $param['new_title'], 'en'));
//推送到ai的数据结构
$data = [
'title'=>$param['new_title'], 'thumb'=>$param['image'], 'foreword'=>$param['description'],
'title'=>$param['new_title'], 'thumb'=>$param['image'], 'foreword'=>$param['description'] ?? '',
'author_id'=>$this->param['author_id'], 'url'=>$param['route'],
];
if(isset($param['id']) && !empty($param['id'])){
$id = $param['id'];
$data['task_id'] = $param['task_id'];
if(empty($param['seo_keyword'])){
if(!isset($param['seo_keyword']) || empty($param['seo_keyword'])){
$ai = "contains keyword {$param['title']} recommend 8 purchaser search keywords, separated by commas";
}
if(empty($param['seo_description'])){
$ai = "According to the keyword {keyword}, write a seo meta description show to purchaser within 200 characters";
$text = Gpt::instance()->openai_chat_qqs($ai);
$text = Common::deal_keywords($text);
$text = Common::deal_str($text);
$param['seo_keyword'] = $text;
}
if(!isset($param['seo_description']) && empty($param['seo_description'])){
$ai = "According to the keyword {$param['title']}, write a seo meta description show to purchaser within 200 characters";
$text1 = Gpt::instance()->openai_chat_qqs($ai);
$text1 = Common::deal_keywords($text1);
$text1 = Common::deal_str($text1);
$param['seo_keyword'] = $text1;
}
if(!isset($param['description']) || empty($param['description'])){
$ai = "According to the keyword {$param['title']}, write a seo meta description show to purchaser within 100 characters";
$text2 = Gpt::instance()->openai_chat_qqs($ai);
$text2 = Common::deal_keywords($text2);
$text2 = Common::deal_str($text2);
$param['description'] = $text2;
}
$param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
$this->model->edit($param,['id'=>$param['id']]);
... ...