This commit is contained in:
ct
2025-06-13 13:14:13 +08:00
parent c36fbb90e5
commit 63a516b124
2 changed files with 4 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ public static function getVectorEmbeddingBgeSmall($embedding_query)
// Use the new API endpoint // Use the new API endpoint
$response = Http::withHeaders([])->withOptions(['verify' => (app()->environment() == 'local') ? false : true])->timeout(800) $response = Http::withHeaders([])->withOptions(['verify' => (app()->environment() == 'local') ? false : true])->timeout(800)
->get( ->get(
'hhttps://worker-embedding-mag.prime-42b.workers.dev', 'https://worker-embedding-mag.prime-42b.workers.dev',
[ [
'query' => $embedding_query, 'query' => $embedding_query,
] ]
@@ -44,6 +44,7 @@ public static function getVectorEmbeddingBgeSmall($embedding_query)
} catch (Exception $e) { } catch (Exception $e) {
$currentAttempt++; $currentAttempt++;
if ($currentAttempt >= $maxRetries) { if ($currentAttempt >= $maxRetries) {
throw $e;
// we can throw exception here // we can throw exception here
} }
// Optional: Add sleep for a few seconds if you want to delay the next attempt // Optional: Add sleep for a few seconds if you want to delay the next attempt

View File

@@ -197,6 +197,8 @@ private function importSingleMeme(array $meme_record): bool
$embedding = null; // Continue without embedding $embedding = null; // Continue without embedding
} }
// dd($embedding);
// Check if record exists one more time within transaction // Check if record exists one more time within transaction
$existing_meme = MemeMedia::where('original_id', $meme_record['filename'])->first(); $existing_meme = MemeMedia::where('original_id', $meme_record['filename'])->first();