feat: add profile management controls

这个提交存在于:
YokiiroBW 2026-07-05 13:37:26 +08:00
父节点 e995e9e7b2
当前提交 afbc19e76c
共有 10 个文件被更改,包括 187 次插入 和 24 次删除

查看文件

@ -4,6 +4,7 @@ export const endpoints = {
uiBootstrap: "ui/bootstrap",
dashboardSummary: "dashboard/summary",
profiles: "profiles",
profile: (profileId: string) => `profiles/${profileId}`,
quickProfileDraft: "profiles/quick-draft",
jobs: "jobs",
jobCancel: (taskId: string) => `jobs/${taskId}/cancel`,

查看文件

@ -4,6 +4,10 @@ export interface CharacterProfile {
status: string
avatar_image_uri?: string | null
description?: string | null
base_prompt?: string | null
appearance_prompt?: string | null
style_prompt?: string | null
negative_prompt?: string | null
default_model_route?: string | null
created_at: string
updated_at: string
@ -15,3 +19,14 @@ export interface ProfileListResult {
page: number
page_size: number
}
export interface QuickProfileDraftResult {
draft_id: string
profile_preview: {
name: string
base_prompt: string
appearance_prompt: string
style_prompt: string
negative_prompt: string
}
}

查看文件

@ -8,7 +8,7 @@ import type { ApiDialect, CapabilityProfile, RenderPlanValidationResult } from "
import type { JobListResult } from "../../shared/types/job"
import type { LogBundle } from "../../shared/types/logs"
import type { Material, MaterialCategory, MaterialListResult } from "../../shared/types/material"
import type { ProfileListResult } from "../../shared/types/profile"
import type { CharacterProfile, ProfileListResult, QuickProfileDraftResult } from "../../shared/types/profile"
import type {
CurrentSettings,
DiffSettingsResult,
@ -34,10 +34,21 @@ const text = {
noTags: "\u65e0\u6807\u7b7e",
noImage: "\u672a\u7ed1\u5b9a\u56fe\u7247",
create: "\u65b0\u5efa",
quickDraft: "\u5feb\u901f\u8349\u7a3f",
archive: "\u5f52\u6863",
recognize: "\u8bc6\u522b",
confirm: "\u786e\u8ba4",
name: "\u540d\u79f0",
identity: "\u8eab\u4efd",
personality: "\u6027\u683c",
hairColor: "\u53d1\u8272",
hairstyle: "\u53d1\u578b",
eyeColor: "\u773c\u8272",
description: "\u63cf\u8ff0",
basePrompt: "\u57fa\u7840\u63d0\u793a\u8bcd",
appearancePrompt: "\u5916\u89c2\u63d0\u793a\u8bcd",
stylePrompt: "\u98ce\u683c\u63d0\u793a\u8bcd",
negativePrompt: "\u53cd\u5411\u63d0\u793a\u8bcd",
imageUri: "\u56fe\u7247 URI",
tags: "\u6807\u7b7e",
category: "\u5206\u7c7b",
@ -61,6 +72,8 @@ const text = {
logs: "\u65e5\u5fd7\u5ba1\u8ba1",
settings: "\u8bbe\u7f6e",
profileList: "\u89d2\u8272\u5217\u8868",
profileCreated: "\u89d2\u8272\u5df2\u521b\u5efa",
profileDeleted: "\u89d2\u8272\u5df2\u5220\u9664",
emptyProfiles: "\u6682\u65e0\u89d2\u8272",
categories: "\u7d20\u6750\u5206\u7c7b",
materialItems: "\u7d20\u6750\u6761\u76ee",
@ -149,6 +162,18 @@ const signedMedia = ref<MediaSignResult | null>(null)
const settingsDraft = ref("")
const settingsValidation = ref<ValidateSettingsResult | null>(null)
const settingsDiff = ref<DiffSettingsResult | null>(null)
const profileDraft = ref({
name: "",
identity: "",
personality: "",
hair_color: "",
hairstyle: "",
eye_color: "",
style: "",
clothing_keywords: "",
description: "",
})
const quickProfileDraft = ref<QuickProfileDraftResult | null>(null)
const materialDraft = ref({
display_name: "",
image_uri: "",
@ -307,6 +332,74 @@ function cancelJob(taskId: string) {
return runOperation(text.cancel, () => postJson(endpoints.jobCancel(taskId)))
}
function resetProfileDraft() {
profileDraft.value = {
name: "",
identity: "",
personality: "",
hair_color: "",
hairstyle: "",
eye_color: "",
style: "",
clothing_keywords: "",
description: "",
}
quickProfileDraft.value = null
}
function createQuickProfileDraft() {
return runOperation(
text.quickDraft,
async () => {
quickProfileDraft.value = await postJson<QuickProfileDraftResult>(endpoints.quickProfileDraft, {
questionnaire: {
name: profileDraft.value.name,
identity: profileDraft.value.identity,
personality: splitCsv(profileDraft.value.personality),
hair_color: profileDraft.value.hair_color,
hairstyle: profileDraft.value.hairstyle,
eye_color: profileDraft.value.eye_color,
style: profileDraft.value.style,
clothing_keywords: splitCsv(profileDraft.value.clothing_keywords),
},
})
return quickProfileDraft.value
},
false,
)
}
function createProfileFromDraft() {
const preview = quickProfileDraft.value?.profile_preview
return runOperation(
text.create,
async () => {
const profile = await postJson<CharacterProfile>(endpoints.profiles, {
name: preview?.name || profileDraft.value.name,
description: profileDraft.value.description,
base_prompt: preview?.base_prompt,
appearance_prompt: preview?.appearance_prompt,
style_prompt: preview?.style_prompt,
negative_prompt: preview?.negative_prompt,
})
resetProfileDraft()
lastOperation.value = text.profileCreated
return profile
},
)
}
function deleteProfile(profileId: string) {
return runOperation(
text.delete,
async () => {
const profile = await request<CharacterProfile>(endpoints.profile(profileId), { method: "DELETE" })
lastOperation.value = text.profileDeleted
return profile
},
)
}
function moveFailedJobs() {
return runOperation(text.moveFailed, () => postJson(endpoints.jobDeadLetterMoveFailed, { limit: 20 }))
}
@ -639,13 +732,63 @@ function storageRootBytes(uriPrefix: string) {
<h2>{{ text.profileList }}</h2>
<span>{{ profiles?.total ?? 0 }}</span>
</header>
<div class="form-grid">
<label>
<span>{{ text.name }}</span>
<input v-model="profileDraft.name" type="text" />
</label>
<label>
<span>{{ text.identity }}</span>
<input v-model="profileDraft.identity" type="text" />
</label>
<label>
<span>{{ text.personality }}</span>
<input v-model="profileDraft.personality" type="text" placeholder="calm, brave" />
</label>
<label>
<span>{{ text.hairColor }}</span>
<input v-model="profileDraft.hair_color" type="text" />
</label>
<label>
<span>{{ text.hairstyle }}</span>
<input v-model="profileDraft.hairstyle" type="text" />
</label>
<label>
<span>{{ text.eyeColor }}</span>
<input v-model="profileDraft.eye_color" type="text" />
</label>
<label>
<span>{{ text.stylePrompt }}</span>
<input v-model="profileDraft.style" type="text" />
</label>
<label>
<span>{{ text.tags }}</span>
<input v-model="profileDraft.clothing_keywords" type="text" placeholder="white blouse, ribbon" />
</label>
<label class="wide-field">
<span>{{ text.description }}</span>
<input v-model="profileDraft.description" type="text" />
</label>
<button type="button" :disabled="Boolean(busy) || !profileDraft.name" @click="createQuickProfileDraft">
{{ text.quickDraft }}
</button>
<button type="button" :disabled="Boolean(busy) || !profileDraft.name" @click="createProfileFromDraft">
{{ text.create }}
</button>
</div>
<pre v-if="quickProfileDraft">{{ JSON.stringify(quickProfileDraft, null, 2) }}</pre>
<ul>
<li v-for="profile in profiles?.items ?? []" :key="profile.profile_id">
<div>
<strong>{{ profile.name }}</strong>
<small>{{ profile.profile_id }}</small>
</div>
<span class="badge">{{ profile.status }}</span>
<div class="inline-actions">
<span class="badge">{{ profile.status }}</span>
<button type="button" :disabled="Boolean(busy)" @click="deleteProfile(profile.profile_id)">
{{ text.delete }}
</button>
</div>
</li>
<li v-if="!profiles?.items.length" class="empty">{{ text.emptyProfiles }}</li>
</ul>
@ -1300,6 +1443,10 @@ label span {
font-size: 12px;
}
.wide-field {
grid-column: 1 / -1;
}
input,
select {
box-sizing: border-box;

查看文件

@ -1,3 +1,3 @@
<script type="module" crossorigin src="/assets/index-CljldSfK.js"></script>
<script type="module" crossorigin src="/assets/index-B6yxsdBD.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
<div id="app"></div>

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

查看文件

@ -1,3 +1,3 @@
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-D3Mc9q12.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DiCgaTu1.css">
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-CiytwhbS.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-C-dyO4IO.css">
<div id="app"></div>