Add (badge)
This commit is contained in:
@@ -18,7 +18,6 @@ public static function getRssPostMetaGpt3($user_prompt, $model_max_tokens = 1536
|
||||
return self::getChatCompletion($user_prompt, $system_prompt, $openai_config, $model_max_tokens, $timeout);
|
||||
}
|
||||
|
||||
|
||||
public static function getRssPostMeta($user_prompt, $model_max_tokens = 1536, $timeout = 60)
|
||||
{
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ public static function handleMulti($hours = 3)
|
||||
{
|
||||
$rss_urls = config('platform.global.rss');
|
||||
|
||||
|
||||
$raw_posts = [];
|
||||
|
||||
foreach ($rss_urls as $rss_url) {
|
||||
@@ -29,7 +28,6 @@ public static function handleSingle($rss_url, $hours = 3)
|
||||
{
|
||||
$blacklist_rss_post_domain = config('platform.global.blacklist_rss_post_domain');
|
||||
|
||||
|
||||
$f = FeedReader::read($rss_url);
|
||||
|
||||
$raw_posts = [];
|
||||
@@ -44,17 +42,12 @@ public static function handleSingle($rss_url, $hours = 3)
|
||||
$title = trim($item->get_title());
|
||||
$description = trim($item->get_content());
|
||||
|
||||
|
||||
$domain = get_domain_from_url($item->get_link());
|
||||
|
||||
if (in_array($domain, $blacklist_rss_post_domain))
|
||||
{
|
||||
continue ;
|
||||
if (in_array($domain, $blacklist_rss_post_domain)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$raw_posts[] = (object) [
|
||||
'source' => $f->get_title(),
|
||||
'source_url' => $rss_url,
|
||||
|
||||
@@ -141,22 +141,15 @@ 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';
|
||||
if (is_empty($rss_post->bites)) {
|
||||
$rss_post->status = 'blocked';
|
||||
} else {
|
||||
$rss_post->status = 'published';
|
||||
}
|
||||
else
|
||||
{
|
||||
$rss_post->status = 'published';
|
||||
}
|
||||
|
||||
|
||||
if ($rss_post->save()) {
|
||||
|
||||
|
||||
if ($rss_post->status == 'published')
|
||||
{
|
||||
if ($rss_post->status == 'published') {
|
||||
|
||||
$has_saved_keyword = false;
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
],
|
||||
|
||||
'blacklist_rss_post_domain' => [
|
||||
'www.techinasia.com',
|
||||
'www.marktechpost.com',
|
||||
'twitter.com',
|
||||
'www.youtube.com',
|
||||
'www.techinasia.com',
|
||||
'www.marktechpost.com',
|
||||
'twitter.com',
|
||||
'www.youtube.com',
|
||||
],
|
||||
|
||||
'rss' => [
|
||||
|
||||
@@ -15,4 +15,5 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
@@ -14,82 +14,91 @@
|
||||
@if ($post->entities)
|
||||
@foreach ($post->entities_keywords as $keyword)
|
||||
@if ($keyword->type == 'entity')
|
||||
@if ($keyword->is_main)
|
||||
<h4
|
||||
class="mb-1 pb-1 d-inline badge bg-secondary border-secondary text-white border me-1 small fw-bold">
|
||||
{{ $keyword->value }}
|
||||
</h4>
|
||||
@else
|
||||
@if ($loop->iteration <= 2)
|
||||
@if ($keyword->is_main)
|
||||
<h4
|
||||
class="mb-1 pb-1 d-inline badge bg-secondary border-secondary text-white border me-1 small fw-bold">
|
||||
{{ $keyword->value }}
|
||||
</h4>
|
||||
@else
|
||||
<h4
|
||||
class="mb-1 pb-1 d-inline badge text-bg-light border me-1 small fw-normal">
|
||||
{{ $keyword->value }}
|
||||
</h4>
|
||||
@endif
|
||||
@elseif ($loop->iteration == 3)
|
||||
<h4
|
||||
class="mb-1 pb-1 d-inline badge text-bg-light border me-1 small fw-normal">
|
||||
{{ $keyword->value }}
|
||||
+{{ count($post->entities_keywords) - 3 }} more
|
||||
</h4>
|
||||
@endif
|
||||
@break
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
@if ($post->impact_level == 'high')
|
||||
<h4
|
||||
class="font-family-roboto-condensed mb-1 pb-1 d-inline badge bg-danger border-danger text-white border me-1 small fw-bold text-uppercase">
|
||||
🔥 High Impact
|
||||
</h4>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="small">
|
||||
@if ($post->category)
|
||||
<span class="d-inline text-secondary small">{{ $post->category->name }}</span>
|
||||
<i class="bi bi-dot"></i>
|
||||
@endif
|
||||
|
||||
<span class="d-inline text-secondary small">
|
||||
@if ($post->published_at->isBetween(now()->subDays(1), now()))
|
||||
{{ $post->published_at->diffForHumans() }}
|
||||
@else
|
||||
{{ $post->published_at->format('d M') }}
|
||||
@endif
|
||||
|
||||
</span>
|
||||
<i class="bi bi-dot"></i>
|
||||
<span class="d-inline text-secondary small">{{ min_read($post->bites) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse{{ $key }}" class="accordion-collapse collapse"
|
||||
aria-labelledby="heading{{ $key }}" data-bs-parent="#accordionTechBites">
|
||||
<div class="accordion-body small">
|
||||
|
||||
@if (!is_empty($post->bites))
|
||||
<div class="fw-bold">The Bite:</div>
|
||||
<div class="mb-3">{{ $post->bites }}</div>
|
||||
@endif
|
||||
|
||||
@if (in_array($post->impact_level, ['medium', 'high']))
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<div class="fw-bold">Social Impact:</div>
|
||||
<div>{{ $post->impact }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($post->entities)
|
||||
<div class="mb-2 text-wrap">
|
||||
More about: @foreach ($post->entities_keywords as $keyword)
|
||||
<a class="word-wrap-break-word ms-2"
|
||||
href="{{ get_route_search_result($keyword->value_lowercased) }}">#{{ $keyword->value_lowercased }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
Read more at:
|
||||
<a class="" target="_blank" rel="nofollow noopener noreferrer"
|
||||
href="{{ $post->post_url }}"> {{ get_domain_from_url($post->post_url) }} </a>
|
||||
|
||||
@endif
|
||||
@if ($post->impact_level == 'high')
|
||||
<h4
|
||||
class="font-family-roboto-condensed mb-1 pb-1 d-inline badge bg-danger border-danger text-white border me-1 small fw-bold text-uppercase">
|
||||
🔥 High Impact
|
||||
</h4>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="small">
|
||||
@if ($post->category)
|
||||
<span class="d-inline text-secondary small">{{ $post->category->name }}</span>
|
||||
<i class="bi bi-dot"></i>
|
||||
@endif
|
||||
|
||||
<span class="d-inline text-secondary small">
|
||||
@if ($post->published_at->isBetween(now()->subDays(1), now()))
|
||||
{{ $post->published_at->diffForHumans() }}
|
||||
@else
|
||||
{{ $post->published_at->format('d M') }}
|
||||
@endif
|
||||
|
||||
</span>
|
||||
<i class="bi bi-dot"></i>
|
||||
<span class="d-inline text-secondary small">{{ min_read($post->bites) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse{{ $key }}" class="accordion-collapse collapse"
|
||||
aria-labelledby="heading{{ $key }}" data-bs-parent="#accordionTechBites">
|
||||
<div class="accordion-body small">
|
||||
|
||||
@if (!is_empty($post->bites))
|
||||
<div class="fw-bold">The Bite:</div>
|
||||
<div class="mb-3">{{ $post->bites }}</div>
|
||||
@endif
|
||||
|
||||
@if (in_array($post->impact_level, ['medium', 'high']))
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<div class="fw-bold">Social Impact:</div>
|
||||
<div>{{ $post->impact }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($post->entities)
|
||||
<div class="mb-2 text-wrap">
|
||||
More about: @foreach ($post->entities_keywords as $keyword)
|
||||
<a class="word-wrap-break-word ms-2"
|
||||
href="{{ get_route_search_result($keyword->value_lowercased) }}">#{{ $keyword->value_lowercased }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
Read the full article:
|
||||
<a target="_blank" rel="nofollow noopener noreferrer" href="{{ $post->post_url }}">
|
||||
{{ get_domain_from_url($post->post_url) }} </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -62,10 +62,9 @@
|
||||
for ($i = 1; $i <= $last_record->id; $i++) {
|
||||
$rss_post = RssPost::find($i);
|
||||
|
||||
if (!is_null($rss_post))
|
||||
{
|
||||
$rss_post->post_domain = get_domain_from_url($rss_post->post_url);
|
||||
$rss_post->save();
|
||||
if (! is_null($rss_post)) {
|
||||
$rss_post->post_domain = get_domain_from_url($rss_post->post_url);
|
||||
$rss_post->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user