Restore toolbar background to bg-nebula; add toolbar backdrop blur
This commit is contained in:
@@ -14,6 +14,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -166,7 +167,9 @@ final class AutoTagArtworkJob implements ShouldQueue
|
||||
->timeout(max(1, $timeout))
|
||||
->retry(max(0, $retries), max(0, $delay), throw: false)
|
||||
->post($url, [
|
||||
'url' => $imageUrl,
|
||||
'image_url' => $imageUrl,
|
||||
'limit' => 8,
|
||||
'artwork_id' => $this->artworkId,
|
||||
'hash' => $this->hash,
|
||||
]);
|
||||
@@ -182,6 +185,41 @@ final class AutoTagArtworkJob implements ShouldQueue
|
||||
|
||||
if (! $response->ok()) {
|
||||
Log::warning('CLIP analyze non-ok response', ['ref' => $ref, 'status' => $response->status(), 'body' => $this->safeBody($response->body())]);
|
||||
|
||||
// Fallback: try uploading the local derivative file to the gateway's file upload
|
||||
// endpoint (`/analyze/all/file`) if the gateway cannot fetch the public URL.
|
||||
try {
|
||||
$variant = (string) config('vision.image_variant', 'md');
|
||||
$row = DB::table('artwork_files')
|
||||
->where('artwork_id', $this->artworkId)
|
||||
->where('variant', $variant)
|
||||
->first();
|
||||
|
||||
if ($row && ! empty($row->path)) {
|
||||
$storageRoot = rtrim((string) config('uploads.storage_root', ''), DIRECTORY_SEPARATOR);
|
||||
$absolute = $storageRoot . DIRECTORY_SEPARATOR . str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $row->path);
|
||||
if (is_file($absolute) && is_readable($absolute)) {
|
||||
$uploadUrl = rtrim($base, '/') . '/analyze/all/file';
|
||||
try {
|
||||
$attach = file_get_contents($absolute);
|
||||
if ($attach !== false) {
|
||||
$uploadResp = Http::attach('file', $attach, basename($absolute))
|
||||
->post($uploadUrl, ['limit' => 5]);
|
||||
|
||||
if ($uploadResp->ok()) {
|
||||
return $this->extractTagList($uploadResp->json());
|
||||
}
|
||||
Log::warning('CLIP upload fallback non-ok', ['ref' => $ref, 'status' => $uploadResp->status(), 'body' => $this->safeBody($uploadResp->body())]);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('CLIP upload fallback failed', ['ref' => $ref, 'error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('CLIP fallback check failed', ['ref' => $ref, 'error' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -216,7 +254,9 @@ final class AutoTagArtworkJob implements ShouldQueue
|
||||
->timeout(max(1, $timeout))
|
||||
->retry(max(0, $retries), max(0, $delay), throw: false)
|
||||
->post($url, [
|
||||
'url' => $imageUrl,
|
||||
'image_url' => $imageUrl,
|
||||
'conf' => 0.25,
|
||||
'artwork_id' => $this->artworkId,
|
||||
'hash' => $this->hash,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user