Update (rss)
This commit is contained in:
@@ -13,7 +13,7 @@ public static function getRssPostMetaGpt3($user_prompt, $model_max_tokens = 1536
|
||||
|
||||
$openai_config = 'openai-gpt-3-5-turbo-1106';
|
||||
|
||||
$system_prompt = "Based on given article, populate the following in valid JSON format:\n{\n\"title\":\"(Title based on article)\",\n\"is_ai_or_tech_news\":(true|false),\n\"is_government_or_political_news\":(true|false),\n\"keywords\":[\"(Important keywords in 1-2 words per keyword, letters only)\"],\n\"category\":\"(Updates|Opinions|Features|New Launches|How Tos|Reviews)\",\n\"summary\":\"(Summarise in 50-80 words to help readers understand this article, US grade 9 english)\",\n\"entities\":[\"(List of identified human or business legal entites in 1-2 words per entity, letters only)\"],\n\"society_impact\":\"(Explain in 30-50 words how it impact society on technological aspect, US grade 9 english)\",\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\"is_ai_or_tech_news\":(true|false),\n\"is_government_or_political_news\":(true|false),\n\"keywords\":[\"(Important keywords in 1-2 words per keyword, letters only)\"],\n\"category\":\"(Updates|Opinions|Features|New Launches|How Tos|Reviews)\",\n\"entities\":[\"(List of identified human or business legal entites in 1-2 words per entity, letters only)\"],\n\"society_impact_level\":\"(low|medium|high)\"\n}";
|
||||
|
||||
return self::getChatCompletion($user_prompt, $system_prompt, $openai_config, $model_max_tokens, $timeout);
|
||||
}
|
||||
|
||||
@@ -46,13 +46,15 @@ public function handle(): void
|
||||
$rss_post->post_domain = get_domain_from_url($raw_post->link);
|
||||
$rss_post->source = $raw_post->source;
|
||||
$rss_post->source_url = $raw_post->source_url;
|
||||
$rss_post->body = $raw_post->description;
|
||||
$rss_post->title = remove_newline($raw_post->title);
|
||||
$rss_post->slug = str_slug(remove_newline($raw_post->title));
|
||||
$rss_post->published_at = $raw_post->date;
|
||||
$rss_post->status = 'draft';
|
||||
|
||||
if ($rss_post->save()) {
|
||||
CrawlRssPostJob::dispatch($rss_post->id)->onConnection('default')->onQueue('default');
|
||||
//CrawlRssPostJob::dispatch($rss_post->id)->onConnection('default')->onQueue('default');
|
||||
ParseRssPostMetadataJob::dispatch($rss_post->id)->onConnection('default')->onQueue('default');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ public static function handle(int $rss_post_id)
|
||||
return;
|
||||
}
|
||||
|
||||
if (count_words($rss_post->body) < 250)
|
||||
$final_content = "TITLE: {$rss_post->title} \n BODY:" . $rss_post->body;
|
||||
|
||||
if (count_words($final_content) < 250)
|
||||
{
|
||||
$rss_post->status = 'blocked';
|
||||
$rss_post->save();
|
||||
@@ -33,7 +35,7 @@ public static function handle(int $rss_post_id)
|
||||
if (! is_null($rss_post->metadata)) {
|
||||
$post_meta_response = $rss_post->metadata;
|
||||
} else {
|
||||
$post_meta_response = OpenAI::getRssPostMetaGpt3($rss_post->body, 1536, 30);
|
||||
$post_meta_response = OpenAI::getRssPostMetaGpt3($final_content, 1536, 30);
|
||||
|
||||
if ((isset($post_meta_response->output)) && (! is_null($post_meta_response->output))) {
|
||||
$service_cost_usage = new ServiceCostUsage;
|
||||
@@ -149,11 +151,11 @@ public static function handle(int $rss_post_id)
|
||||
|
||||
$rss_post->keyword_list = implode(',', $words_to_add_in_keyword_list);
|
||||
|
||||
if (is_empty($rss_post->bites)) {
|
||||
$rss_post->status = 'blocked';
|
||||
} else {
|
||||
$rss_post->status = 'published';
|
||||
}
|
||||
// if (is_empty($rss_post->bites)) {
|
||||
// $rss_post->status = 'blocked';
|
||||
// } else {
|
||||
// $rss_post->status = 'published';
|
||||
// }
|
||||
|
||||
if (!$rss_post->status != 'blocked')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user