feat: 接入形态图库与 Seedream 生图操作
展示已有主图、候选图和失败记录,支持单图及批量生成、主图选择。 补充正式 ID 校验、费用确认、图片加载占位和回归测试。 依赖后端 eac8dc3 的项目形态图库只读接口。
This commit is contained in:
1 parent
bae69c3c62
commit
47443c0efe
26 files changed
+1338
-25
No files matched your search
@@ -0,0 +1,16 @@
|
||||
/** 只允许 HTTP(S) 与后端 /storage 路径;生产环境绝对 API 地址使用其源站。 */
|
||||
export function referenceImageUrl(value: string): string | null {
|
||||
const raw = value.trim()
|
||||
try {
|
||||
if (raw.startsWith('/storage/') && !raw.includes('\\')) {
|
||||
const api = import.meta.env.VITE_API_BASE_URL || '/api'
|
||||
const origin = /^https?:\/\//i.test(api) ? new URL(api).origin : window.location.origin
|
||||
const url = new URL(raw, origin)
|
||||
return url.pathname.startsWith('/storage/') ? url.href : null
|
||||
}
|
||||
const url = new URL(raw)
|
||||
return ['http:', 'https:'].includes(url.protocol) ? url.href : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user