feat(ai-edits): add output storage backfill flow and coverage
This commit is contained in:
@@ -72,28 +72,39 @@ function resolveOutputUrl(request: GuestAiEditRequest | null): string | null {
|
||||
(output) =>
|
||||
output.is_primary
|
||||
&& (
|
||||
(typeof output.provider_url === 'string' && output.provider_url)
|
||||
(typeof output.url === 'string' && output.url)
|
||||
|| (typeof output.storage_path === 'string' && output.storage_path)
|
||||
|| (typeof output.provider_url === 'string' && output.provider_url)
|
||||
)
|
||||
);
|
||||
if (primary?.provider_url) {
|
||||
return primary.provider_url;
|
||||
if (primary?.url) {
|
||||
return primary.url;
|
||||
}
|
||||
if (primary?.storage_path) {
|
||||
return normalizeStorageUrl(primary.storage_path);
|
||||
}
|
||||
if (primary?.provider_url) {
|
||||
return primary.provider_url;
|
||||
}
|
||||
|
||||
const first = request.outputs.find(
|
||||
(output) =>
|
||||
(typeof output.provider_url === 'string' && output.provider_url)
|
||||
(typeof output.url === 'string' && output.url)
|
||||
|| (typeof output.storage_path === 'string' && output.storage_path)
|
||||
|| (typeof output.provider_url === 'string' && output.provider_url)
|
||||
);
|
||||
|
||||
if (first?.url) {
|
||||
return first.url;
|
||||
}
|
||||
if (first?.storage_path) {
|
||||
return normalizeStorageUrl(first.storage_path);
|
||||
}
|
||||
if (first?.provider_url) {
|
||||
return first.provider_url;
|
||||
}
|
||||
|
||||
return normalizeStorageUrl(first?.storage_path);
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function AiMagicEditSheet({
|
||||
|
||||
@@ -27,6 +27,7 @@ export type GuestAiEditOutput = {
|
||||
storage_disk?: string | null;
|
||||
storage_path?: string | null;
|
||||
provider_url?: string | null;
|
||||
url?: string | null;
|
||||
mime_type?: string | null;
|
||||
width?: number | null;
|
||||
height?: number | null;
|
||||
|
||||
Reference in New Issue
Block a user