feat: 同步视觉风格与主体身份母版工作区
对齐后端 dev 059e597,新增项目风格编辑锁定、身份文本生成、身份参考图与母版切换。 整理六个工作区入口,接通人物及场景母版继承说明、形态图片来源追溯。 补充草稿保护、正式 ID 校验、费用确认及部分失败回执,67 项测试和静态检查、构建通过。 未修改后端,未调用真实模型;本环境未完成浏览器视觉验收。
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { request } from '../../lib/http'
|
||||
import type {
|
||||
GenerateIdentityImageInput,
|
||||
IdentityBatchResult,
|
||||
IdentityImage,
|
||||
SaveIdentityInput,
|
||||
SubjectIdentity
|
||||
} from './types'
|
||||
|
||||
/** 身份接口使用正式 Subject ID,与形态 ID、角色表 ID 分开。 */
|
||||
function identityPath(subjectId: string) {
|
||||
return `/subjects/${encodeURIComponent(subjectId)}/identity`
|
||||
}
|
||||
|
||||
/** 身份文本和参考图分开操作;有费用的请求均不自动重试。 */
|
||||
export const subjectIdentityApi = {
|
||||
get: (subjectId: string, signal?: AbortSignal) =>
|
||||
request<SubjectIdentity | null>(identityPath(subjectId), { signal }),
|
||||
save: (subjectId: string, input: SaveIdentityInput) =>
|
||||
request<SubjectIdentity>(identityPath(subjectId), { method: 'PUT', body: input }),
|
||||
generate: (subjectId: string, force: boolean) =>
|
||||
request<SubjectIdentity>(`${identityPath(subjectId)}/generate`, {
|
||||
method: 'POST',
|
||||
body: { force },
|
||||
timeoutMs: 0
|
||||
}),
|
||||
generateProject: (projectId: string, input: { force: boolean; concurrency: number }) =>
|
||||
request<IdentityBatchResult>(`/projects/${encodeURIComponent(projectId)}/subject-identities/generate`, {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
timeoutMs: 0
|
||||
}),
|
||||
listImages: (subjectId: string, signal?: AbortSignal) =>
|
||||
request<IdentityImage[]>(`${identityPath(subjectId)}/images`, { signal }),
|
||||
generateImage: (subjectId: string, input: GenerateIdentityImageInput) =>
|
||||
request<IdentityImage>(`${identityPath(subjectId)}/images`, { method: 'POST', body: input, timeoutMs: 0 }),
|
||||
setAnchor: (subjectId: string, imageId: string) =>
|
||||
request<IdentityImage>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/anchor`, {
|
||||
method: 'PUT'
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user