From d42c76eeee891923fc8ceb66bb2e486b5715439d Mon Sep 17 00:00:00 2001 From: Charles Teh Date: Thu, 23 Nov 2023 13:10:57 +0800 Subject: [PATCH] Add (category + rss): AI prompts --- app/Helpers/FirstParty/OpenAI/OpenAI.php | 2 +- config/platform/global.php | 1 + database/seeders/AiPromptCategorySeeder.php | 24 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 database/seeders/AiPromptCategorySeeder.php diff --git a/app/Helpers/FirstParty/OpenAI/OpenAI.php b/app/Helpers/FirstParty/OpenAI/OpenAI.php index 0566c76..0c9d182 100644 --- a/app/Helpers/FirstParty/OpenAI/OpenAI.php +++ b/app/Helpers/FirstParty/OpenAI/OpenAI.php @@ -13,7 +13,7 @@ public static function getRssPostMeta($user_prompt, $model_max_tokens = 1536, $t $openai_config = 'openai-gpt-4-turbo'; - $system_prompt = "Based on given article, populate the following in valid JSON format\n{\n\"title\":\"(Title based on article)\",\n\"keywords\":[\"(Important keywords in 1-2 words per keyword)\"],\n\"category\":\"(Updates|Opinions|Features|New Launches|How Tos|Reviews)\",\n\"summary\":\"(Summarise article in 60-90 words to help readers understand what article is about)\",\n\"entities\":[(List of companies, brands that are considered as main entites in 1-2 words. per entity)],\n\"society_impact\":\"(Explain in 30-50 words how this article content's can impact society on technological aspect)\",\n\"society_impact_level:\"(low|medium|high)\"\n}"; + $system_prompt = "Based on given article, populate the following in valid JSON format\n{\n\"title\":\"(Title based on article)\",\n\"keywords\":[\"(Important keywords in 1-2 words per keyword)\"],\n\"category\":\"(Updates|Opinions|Features|New Launches|How Tos|Reviews|AI Prompts)\",\n\"summary\":\"(Summarise article in 60-90 words to help readers understand what article is about)\",\n\"entities\":[(List of companies, brands that are considered as main entites in 1-2 words. per entity)],\n\"society_impact\":\"(Explain in 30-50 words how this article content's can impact society on technological aspect)\",\n\"society_impact_level:\"(low|medium|high)\"\n}"; return self::getChatCompletion($user_prompt, $system_prompt, $openai_config, $model_max_tokens, $timeout); } diff --git a/config/platform/global.php b/config/platform/global.php index f8d4a66..4066b82 100644 --- a/config/platform/global.php +++ b/config/platform/global.php @@ -53,6 +53,7 @@ 'https://deep-image.ai/blog/rss/', 'https://www.theinformation.com/feed', 'http://feeds.feedburner.com/blogspot/hsDu', + 'https://prompthero.tumblr.com/rss', ], 'whitelist_keywords_rss' => [ diff --git a/database/seeders/AiPromptCategorySeeder.php b/database/seeders/AiPromptCategorySeeder.php new file mode 100644 index 0000000..6aeeee7 --- /dev/null +++ b/database/seeders/AiPromptCategorySeeder.php @@ -0,0 +1,24 @@ + 'AI Prompts', 'short_name' => 'AI Prompts'], + ]; + + foreach ($categories as $category) { + $node = Category::create($category); + } + + } +}