small fixes

This commit is contained in:
Doar Mihai
2026-05-02 02:49:38 +03:00
parent 462eb2fc61
commit 41b756a858
3 changed files with 17 additions and 6 deletions
+7 -5
View File
@@ -71,13 +71,11 @@ class CurateJobs extends Command
'CF-Access-Client-Secret' => 'adeeed2f75236053953cc9dd898c7756bab5e00f7d0901bf7d488b6db8aba336', 'CF-Access-Client-Secret' => 'adeeed2f75236053953cc9dd898c7756bab5e00f7d0901bf7d488b6db8aba336',
]) ])
->post($apiUrl, [ ->post($apiUrl, [
'model' => 'mixtral', 'model' => 'granite4.1:3b',
'stream' => false, 'stream' => false,
'prompt' => $body, 'prompt' => $body,
]); ]);
var_dump($response->json());
if ($response->successful()) { if ($response->successful()) {
$responseArray = $response->json(); $responseArray = $response->json();
@@ -89,11 +87,15 @@ class CurateJobs extends Command
continue; continue;
} }
$tags = array_flip($tags); //$tags = array_flip($tags);
if (is_array($tags) && !empty($tags)) { if (is_array($tags) && !empty($tags)) {
$tagIds = []; $tagIds = [];
if (isset($tags['tags'])) {
$tags = $tags['tags'];
}
foreach ($tags as $tagName) { foreach ($tags as $tagName) {
// Find or create tag // Find or create tag
$tag = Tag::firstOrCreate( $tag = Tag::firstOrCreate(
@@ -121,7 +123,7 @@ class CurateJobs extends Command
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$failedCount++; $failedCount++;
$log->error("Error curating job #{$job->id}: {$e->getMessage()}"); $log->error("Error curating job #{$job->id}: {$e->getMessage()} {$e->getTraceAsString()}");
} }
$progressBar->advance(); $progressBar->advance();
@@ -48,6 +48,13 @@ class FetchAdzunaDescriptionCommand extends Command
private function fetchLatest() private function fetchLatest()
{ {
$adzunaSources = [
'Adzuna',
'AdzunaGB',
'AdzunaDE',
'AdzunaFR',
];
$jobSource = JobSource::where('name', 'Adzuna')->first(); $jobSource = JobSource::where('name', 'Adzuna')->first();
$jobs = Job::where('job_source_id', $jobSource->id)->latest()->limit(50)->get(); $jobs = Job::where('job_source_id', $jobSource->id)->latest()->limit(50)->get();
+3 -1
View File
@@ -16,7 +16,9 @@ class Tag extends Model
static::creating(function ($tag) { static::creating(function ($tag) {
if (empty($tag->slug)) { if (empty($tag->slug)) {
$tag->slug = Str::slug($tag->name); if (is_string($tag->name)) {
$tag->slug = Str::slug($tag->name);
}
} }
}); });
} }