Add (scraper)

Update (ai): integrate scraper
This commit is contained in:
2023-09-25 19:39:13 +08:00
parent b6f36e3ccd
commit c53918d03b
7 changed files with 262 additions and 45 deletions

View File

@@ -45,6 +45,30 @@ public static function writeArticle($title, $description, $article_type, $min, $
}
public static function createNewArticleTitle($current_title, $supporting_data)
{
$system_prompt = "Based on provided article title, identify the main keyword in 1-2 words. Once identified, use the main keyword only to generate an easy-to-read unique, helpful article title.\n\n
Requirements:\n
2 descriptive photos keywords to represent article title when put together side-by-side\n
No realtime information required\n
No guides and how tos\n
No punctuation in titles especially colons :\n
90-130 characters\n\n
return in following json format {\"main_keyword\":\"(Main Keyword)\",\"title\":\"(Title in 90-130 letters)\",\"short_title\":\"(Short Title in 30-40 letters)\",\"article_type\":\"(How-tos|Guides|Interview|Review|Commentary|Feature|News|Editorial|Report|Research|Case-study|Overview|Tutorial|Update|Spotlight|Insights)\",\"description\":\"(SEO description based on main keyword)\",\"photo_keywords\":[\"photo keyword 1\",\"photo keyword 2\"]}";
$user_prompt = "Article Title: {$current_title}\n Article Description: {$supporting_data}\n";
$reply = self::chatCompletion($system_prompt, $user_prompt, 'gpt-3.5-turbo');
try {
return json_decode($reply, false);
} catch (Exception $e) {
return null;
}
}
public static function suggestArticleTitles($current_title, $supporting_data, $suggestion_counts)
{
$system_prompt = "Based on provided article title, identify the main keyword in 1-2 words. Once identified, use the main keyword only to generate {$suggestion_counts} easy-to-read unique, helpful title articles.\n\n