feat: add profile editing controls

这个提交存在于:
YokiiroBW 2026-07-05 14:22:44 +08:00
父节点 92d056360e
当前提交 0091e2ace7
共有 6 个文件被更改,包括 118 次插入 和 20 次删除

查看文件

@ -102,6 +102,7 @@ const text = {
settings: "\u8bbe\u7f6e",
profileList: "\u89d2\u8272\u5217\u8868",
profileCreated: "\u89d2\u8272\u5df2\u521b\u5efa",
profileUpdated: "\u89d2\u8272\u5df2\u66f4\u65b0",
profileDeleted: "\u89d2\u8272\u5df2\u5220\u9664",
emptyProfiles: "\u6682\u65e0\u89d2\u8272",
workflowList: "\u5de5\u4f5c\u6d41\u5217\u8868",
@ -249,6 +250,16 @@ const profileDraft = ref({
description: "",
})
const quickProfileDraft = ref<QuickProfileDraftResult | null>(null)
const profileEditDraft = ref({
profile_id: "",
name: "",
description: "",
base_prompt: "",
appearance_prompt: "",
style_prompt: "",
negative_prompt: "",
default_model_route: "",
})
const workflowDraft = ref({
display_name: "",
workflow_type: "single_image",
@ -592,6 +603,56 @@ function deleteProfile(profileId: string) {
)
}
function resetProfileEditDraft() {
profileEditDraft.value = {
profile_id: "",
name: "",
description: "",
base_prompt: "",
appearance_prompt: "",
style_prompt: "",
negative_prompt: "",
default_model_route: "",
}
}
function editProfileDraft(profile: CharacterProfile) {
profileEditDraft.value = {
profile_id: profile.profile_id,
name: profile.name,
description: profile.description ?? "",
base_prompt: profile.base_prompt ?? "",
appearance_prompt: profile.appearance_prompt ?? "",
style_prompt: profile.style_prompt ?? "",
negative_prompt: profile.negative_prompt ?? "",
default_model_route: profile.default_model_route ?? "",
}
}
function updateProfileDraft() {
if (!profileEditDraft.value.profile_id) return Promise.resolve()
return runOperation(
text.update,
async () => {
const profile = await request<CharacterProfile>(endpoints.profile(profileEditDraft.value.profile_id), {
method: "PUT",
body: {
name: profileEditDraft.value.name,
description: profileEditDraft.value.description || undefined,
base_prompt: profileEditDraft.value.base_prompt || undefined,
appearance_prompt: profileEditDraft.value.appearance_prompt || undefined,
style_prompt: profileEditDraft.value.style_prompt || undefined,
negative_prompt: profileEditDraft.value.negative_prompt || undefined,
default_model_route: profileEditDraft.value.default_model_route || undefined,
},
})
resetProfileEditDraft()
lastOperation.value = text.profileUpdated
return profile
},
)
}
function createWorkflow() {
const profileId = selectedProfileId.value
if (!profileId) return Promise.resolve()
@ -1295,6 +1356,40 @@ function storageRootBytes(uriPrefix: string) {
</button>
</div>
<pre v-if="quickProfileDraft">{{ JSON.stringify(quickProfileDraft, null, 2) }}</pre>
<div v-if="profileEditDraft.profile_id" class="form-grid">
<label>
<span>{{ text.name }}</span>
<input v-model="profileEditDraft.name" type="text" />
</label>
<label>
<span>{{ text.provider }}</span>
<input v-model="profileEditDraft.default_model_route" type="text" />
</label>
<label class="wide-field">
<span>{{ text.description }}</span>
<input v-model="profileEditDraft.description" type="text" />
</label>
<label class="wide-field">
<span>{{ text.basePrompt }}</span>
<input v-model="profileEditDraft.base_prompt" type="text" />
</label>
<label class="wide-field">
<span>{{ text.appearancePrompt }}</span>
<input v-model="profileEditDraft.appearance_prompt" type="text" />
</label>
<label class="wide-field">
<span>{{ text.stylePrompt }}</span>
<input v-model="profileEditDraft.style_prompt" type="text" />
</label>
<label class="wide-field">
<span>{{ text.negativePrompt }}</span>
<input v-model="profileEditDraft.negative_prompt" type="text" />
</label>
<button type="button" :disabled="Boolean(busy) || !profileEditDraft.name" @click="updateProfileDraft">
{{ text.update }}
</button>
<button type="button" :disabled="Boolean(busy)" @click="resetProfileEditDraft">{{ text.reset }}</button>
</div>
<ul>
<li v-for="profile in profiles?.items ?? []" :key="profile.profile_id">
<div>
@ -1303,6 +1398,9 @@ function storageRootBytes(uriPrefix: string) {
</div>
<div class="inline-actions">
<span class="badge">{{ profile.status }}</span>
<button type="button" :disabled="Boolean(busy)" @click="editProfileDraft(profile)">
{{ text.edit }}
</button>
<button type="button" :disabled="Boolean(busy)" @click="deleteProfile(profile.profile_id)">
{{ text.delete }}
</button>

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

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

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

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

查看文件

@ -1,3 +1,3 @@
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-CWrP2aiz.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BL1Cf2kg.css">
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-I4d2eAkn.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-qdHYgK-6.css">
<div id="app"></div>