feat: add wardrobe import controls
这个提交存在于:
父节点
29ac4e6fff
当前提交
1605a75890
共有 9 个文件被更改,包括 125 次插入 和 23 次删除
|
|
@ -25,6 +25,8 @@ export const endpoints = {
|
|||
materialRecognize: (materialId: string) => `materials/${materialId}/recognize`,
|
||||
materialConfirm: (materialId: string) => `materials/${materialId}/confirm`,
|
||||
wardrobe: (profileId: string) => `profiles/${profileId}/wardrobe`,
|
||||
wardrobeImportMaterial: (profileId: string) => `profiles/${profileId}/wardrobe/import-material`,
|
||||
wardrobeItem: (profileId: string, wardrobeItemId: string) => `profiles/${profileId}/wardrobe/${wardrobeItemId}`,
|
||||
wardrobeMatch: (profileId: string) => `profiles/${profileId}/wardrobe/match`,
|
||||
apiDiscoveryDialects: "api-discovery/dialects",
|
||||
apiDiscoveryProbeModel: "api-discovery/probe-model",
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ const text = {
|
|||
allCategories: "\u5168\u90e8\u5206\u7c7b",
|
||||
materialCreated: "\u7d20\u6750\u5df2\u521b\u5efa",
|
||||
materialArchived: "\u7d20\u6750\u5df2\u5f52\u6863",
|
||||
importToWardrobe: "\u52a0\u5165\u8863\u6a71",
|
||||
delete: "\u5220\u9664",
|
||||
wardrobeCategory: "\u8863\u6a71\u5206\u7c7b",
|
||||
season: "\u5b63\u8282",
|
||||
style: "\u98ce\u683c",
|
||||
selectMaterial: "\u9009\u62e9\u7d20\u6750",
|
||||
wardrobeImported: "\u8863\u6a71\u6761\u76ee\u5df2\u52a0\u5165",
|
||||
wardrobeDeleted: "\u8863\u6a71\u6761\u76ee\u5df2\u5220\u9664",
|
||||
dashboard: "\u8fd0\u884c\u6982\u89c8",
|
||||
profiles: "\u89d2\u8272",
|
||||
materials: "\u7d20\u6750\u5e93",
|
||||
|
|
@ -141,6 +149,13 @@ const materialDraft = ref({
|
|||
tags: "",
|
||||
category_id: "",
|
||||
})
|
||||
const wardrobeDraft = ref({
|
||||
material_id: "",
|
||||
wardrobe_category: "top",
|
||||
tags: "",
|
||||
season: "",
|
||||
style: "",
|
||||
})
|
||||
const lastOperation = ref("")
|
||||
const loading = ref(true)
|
||||
const busy = ref("")
|
||||
|
|
@ -155,6 +170,9 @@ const queueTotal = computed(() => {
|
|||
const pendingRecognition = computed(
|
||||
() => materials.value?.items.filter((item) => item.recognition_status !== "confirmed").length ?? 0,
|
||||
)
|
||||
const confirmedMaterials = computed(() =>
|
||||
(materials.value?.items ?? []).filter((item) => item.recognition_status === "confirmed"),
|
||||
)
|
||||
const activeTitle = computed(() => {
|
||||
const titles: Record<ViewKey, string> = {
|
||||
dashboard: text.dashboard,
|
||||
|
|
@ -324,6 +342,49 @@ function matchWardrobe() {
|
|||
)
|
||||
}
|
||||
|
||||
function resetWardrobeDraft() {
|
||||
wardrobeDraft.value = {
|
||||
material_id: "",
|
||||
wardrobe_category: "top",
|
||||
tags: "",
|
||||
season: "",
|
||||
style: "",
|
||||
}
|
||||
}
|
||||
|
||||
function importWardrobeMaterial() {
|
||||
const profileId = selectedProfileId.value
|
||||
if (!profileId) return Promise.resolve()
|
||||
return runOperation(
|
||||
text.importToWardrobe,
|
||||
async () => {
|
||||
const item = await postJson<WardrobeItem>(endpoints.wardrobeImportMaterial(profileId), {
|
||||
material_id: wardrobeDraft.value.material_id,
|
||||
wardrobe_category: wardrobeDraft.value.wardrobe_category,
|
||||
tags: splitCsv(wardrobeDraft.value.tags),
|
||||
season: wardrobeDraft.value.season || undefined,
|
||||
style: wardrobeDraft.value.style || undefined,
|
||||
})
|
||||
resetWardrobeDraft()
|
||||
lastOperation.value = text.wardrobeImported
|
||||
return item
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
function deleteWardrobeItem(wardrobeItemId: string) {
|
||||
const profileId = selectedProfileId.value
|
||||
if (!profileId) return Promise.resolve()
|
||||
return runOperation(
|
||||
text.delete,
|
||||
async () => {
|
||||
const item = await request<WardrobeItem>(endpoints.wardrobeItem(profileId, wardrobeItemId), { method: "DELETE" })
|
||||
lastOperation.value = text.wardrobeDeleted
|
||||
return item
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
function reloadSettings() {
|
||||
return runOperation(
|
||||
text.reload,
|
||||
|
|
@ -656,13 +717,52 @@ function storageRootBytes(uriPrefix: string) {
|
|||
{{ text.match }}
|
||||
</button>
|
||||
</header>
|
||||
<div class="form-grid">
|
||||
<label>
|
||||
<span>{{ text.selectMaterial }}</span>
|
||||
<select v-model="wardrobeDraft.material_id">
|
||||
<option value="">{{ text.selectMaterial }}</option>
|
||||
<option v-for="material in confirmedMaterials" :key="material.material_id" :value="material.material_id">
|
||||
{{ material.display_name }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ text.wardrobeCategory }}</span>
|
||||
<input v-model="wardrobeDraft.wardrobe_category" type="text" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ text.tags }}</span>
|
||||
<input v-model="wardrobeDraft.tags" type="text" placeholder="daily, top" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ text.season }}</span>
|
||||
<input v-model="wardrobeDraft.season" type="text" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ text.style }}</span>
|
||||
<input v-model="wardrobeDraft.style" type="text" />
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="Boolean(busy) || !selectedProfileId || !wardrobeDraft.material_id || !wardrobeDraft.wardrobe_category"
|
||||
@click="importWardrobeMaterial"
|
||||
>
|
||||
{{ text.importToWardrobe }}
|
||||
</button>
|
||||
</div>
|
||||
<ul>
|
||||
<li v-for="item in wardrobe" :key="item.wardrobe_item_id">
|
||||
<div>
|
||||
<strong>{{ item.wardrobe_category }}</strong>
|
||||
<small>{{ item.material_id }} / {{ item.tags.join(", ") || text.noTags }}</small>
|
||||
</div>
|
||||
<span>{{ item.usage_count }}</span>
|
||||
<div class="inline-actions">
|
||||
<span>{{ item.usage_count }}</span>
|
||||
<button type="button" :disabled="Boolean(busy)" @click="deleteWardrobeItem(item.wardrobe_item_id)">
|
||||
{{ text.delete }}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="!wardrobe.length" class="empty">{{ text.emptyWardrobe }}</li>
|
||||
</ul>
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
|||
<script type="module" crossorigin src="/assets/index-C4aj6dk0.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-BFBsCBKK.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
17
web/assets/index-DJcoydnZ.js
普通文件
17
web/assets/index-DJcoydnZ.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
|||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BYQHrko-.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-CRHbO3Gr.css">
|
||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DJcoydnZ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DQnY71w4.css">
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用