started on auth, fixed the tags command and made a summary command
This commit is contained in:
@@ -21,7 +21,7 @@ class CurateJobs extends Command
|
||||
{
|
||||
$batchSize = (int) $this->option('batch');
|
||||
//$apiUrl = $this->option('api-url');
|
||||
$apiUrl = 'https://loki.c0rrup7.net';
|
||||
$apiUrl = 'https://olm.c0rrup7.net/api/generate';
|
||||
|
||||
if (empty($apiUrl)) {
|
||||
$this->error('API URL is required. Use --api-url option to provide the endpoint.');
|
||||
@@ -52,25 +52,29 @@ class CurateJobs extends Command
|
||||
|
||||
foreach ($uncuratedJobs as $job) {
|
||||
try {
|
||||
$body = 'This is the content of a job ad, you need to read it and extract the relevant tags from it. Respond only with the tags in JSON format, NO OTHER TEXT BEFOR OR AFTER THE JSON.';
|
||||
$body = 'This is the content of a job ad, you need to read it and extract the relevant tags from it. Respond only with the tags in JSON format, NO OTHER TEXT BEFORE OR AFTER THE JSON.';
|
||||
$body .= 'Title: '. htmlentities($job->title);
|
||||
$body .= 'Description: '. htmlentities($job->description);
|
||||
$body .= 'RETURN ONLY VALID JSON, NO TEXT BEFORE OR AFTER THE JSON!';
|
||||
|
||||
// Make POST request to API with job name and description
|
||||
$response = Http::timeout(130)
|
||||
->withHeaders([
|
||||
'Accept' => 'application/json',
|
||||
'X-Api-Key' => '1620539ff09a897a7281a8b626c145e5',
|
||||
'CF-Access-Client-Id' => '8c4cc272c7f08f8d7911a28eb5d7db44.access',
|
||||
'CF-Access-Client-Secret' => 'adeeed2f75236053953cc9dd898c7756bab5e00f7d0901bf7d488b6db8aba336',
|
||||
])
|
||||
->post($apiUrl, [
|
||||
'service' => 'ollama',
|
||||
'model' => 'llama3',
|
||||
'model' => 'mixtral',
|
||||
'stream' => false,
|
||||
'prompt' => $body,
|
||||
]);
|
||||
|
||||
if ($response->successful()) {
|
||||
$tags = $response->json();
|
||||
|
||||
$responseArray = $response->json();
|
||||
$responseTagsJson = $responseArray['response'];
|
||||
$tags = json_decode($responseTagsJson, true);
|
||||
$tags = array_flip($tags);
|
||||
|
||||
if (is_array($tags) && !empty($tags)) {
|
||||
$tagIds = [];
|
||||
|
||||
Reference in New Issue
Block a user