feat: add material upload registration
这个提交存在于:
父节点
bbc2663568
当前提交
79d1742c64
共有 9 个文件被更改,包括 100 次插入 和 25 次删除
|
|
@ -49,6 +49,7 @@ export const endpoints = {
|
||||||
materialCategories: "material-categories",
|
materialCategories: "material-categories",
|
||||||
materialCategory: (categoryId: string) => `material-categories/${categoryId}`,
|
materialCategory: (categoryId: string) => `material-categories/${categoryId}`,
|
||||||
materials: "materials",
|
materials: "materials",
|
||||||
|
materialUpload: "materials/upload",
|
||||||
material: (materialId: string) => `materials/${materialId}`,
|
material: (materialId: string) => `materials/${materialId}`,
|
||||||
materialRecognize: (materialId: string) => `materials/${materialId}/recognize`,
|
materialRecognize: (materialId: string) => `materials/${materialId}/recognize`,
|
||||||
materialConfirm: (materialId: string) => `materials/${materialId}/confirm`,
|
materialConfirm: (materialId: string) => `materials/${materialId}/confirm`,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,11 @@ const text = {
|
||||||
allCategories: "\u5168\u90e8\u5206\u7c7b",
|
allCategories: "\u5168\u90e8\u5206\u7c7b",
|
||||||
materialCreated: "\u7d20\u6750\u5df2\u521b\u5efa",
|
materialCreated: "\u7d20\u6750\u5df2\u521b\u5efa",
|
||||||
materialUpdated: "\u7d20\u6750\u5df2\u66f4\u65b0",
|
materialUpdated: "\u7d20\u6750\u5df2\u66f4\u65b0",
|
||||||
|
materialUploaded: "\u7d20\u6750\u5df2\u767b\u8bb0\u4e0a\u4f20",
|
||||||
materialArchived: "\u7d20\u6750\u5df2\u5f52\u6863",
|
materialArchived: "\u7d20\u6750\u5df2\u5f52\u6863",
|
||||||
|
upload: "\u4e0a\u4f20\u767b\u8bb0",
|
||||||
|
filename: "\u6587\u4ef6\u540d",
|
||||||
|
contentType: "Content-Type",
|
||||||
importToWardrobe: "\u52a0\u5165\u8863\u6a71",
|
importToWardrobe: "\u52a0\u5165\u8863\u6a71",
|
||||||
delete: "\u5220\u9664",
|
delete: "\u5220\u9664",
|
||||||
wardrobeCategory: "\u8863\u6a71\u5206\u7c7b",
|
wardrobeCategory: "\u8863\u6a71\u5206\u7c7b",
|
||||||
|
|
@ -319,6 +323,13 @@ const materialDraft = ref({
|
||||||
prompt: "",
|
prompt: "",
|
||||||
negative_prompt: "",
|
negative_prompt: "",
|
||||||
})
|
})
|
||||||
|
const materialUploadDraft = ref({
|
||||||
|
display_name: "",
|
||||||
|
filename: "",
|
||||||
|
content_type: "image/png",
|
||||||
|
image_uri: "",
|
||||||
|
category_id: "",
|
||||||
|
})
|
||||||
const categoryDraft = ref({
|
const categoryDraft = ref({
|
||||||
category_id: "",
|
category_id: "",
|
||||||
name: "",
|
name: "",
|
||||||
|
|
@ -1387,6 +1398,34 @@ function editMaterialDraft(material: Material) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetMaterialUploadDraft() {
|
||||||
|
materialUploadDraft.value = {
|
||||||
|
display_name: "",
|
||||||
|
filename: "",
|
||||||
|
content_type: "image/png",
|
||||||
|
image_uri: "",
|
||||||
|
category_id: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadMaterialDraft() {
|
||||||
|
return runOperation(
|
||||||
|
text.upload,
|
||||||
|
async () => {
|
||||||
|
const material = await postJson<Material>(endpoints.materialUpload, {
|
||||||
|
display_name: materialUploadDraft.value.display_name || undefined,
|
||||||
|
filename: materialUploadDraft.value.filename || undefined,
|
||||||
|
content_type: materialUploadDraft.value.content_type || undefined,
|
||||||
|
image_uri: materialUploadDraft.value.image_uri,
|
||||||
|
category_id: materialUploadDraft.value.category_id || undefined,
|
||||||
|
})
|
||||||
|
resetMaterialUploadDraft()
|
||||||
|
lastOperation.value = text.materialUploaded
|
||||||
|
return material
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function recognizeMaterial(materialId: string) {
|
function recognizeMaterial(materialId: string) {
|
||||||
return runOperation(text.recognize, () => postJson<Material>(endpoints.materialRecognize(materialId)))
|
return runOperation(text.recognize, () => postJson<Material>(endpoints.materialRecognize(materialId)))
|
||||||
}
|
}
|
||||||
|
|
@ -1967,6 +2006,41 @@ function storageRootBytes(uriPrefix: string) {
|
||||||
</li>
|
</li>
|
||||||
<li v-if="!materials?.items.length" class="empty">{{ text.emptyMaterials }}</li>
|
<li v-if="!materials?.items.length" class="empty">{{ text.emptyMaterials }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="form-grid">
|
||||||
|
<label>
|
||||||
|
<span>{{ text.name }}</span>
|
||||||
|
<input v-model="materialUploadDraft.display_name" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.filename }}</span>
|
||||||
|
<input v-model="materialUploadDraft.filename" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.contentType }}</span>
|
||||||
|
<input v-model="materialUploadDraft.content_type" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.imageUri }}</span>
|
||||||
|
<input v-model="materialUploadDraft.image_uri" type="text" placeholder="storage://materials/upload.png" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.category }}</span>
|
||||||
|
<select v-model="materialUploadDraft.category_id">
|
||||||
|
<option value="">{{ text.allCategories }}</option>
|
||||||
|
<option
|
||||||
|
v-for="category in materialCategories"
|
||||||
|
:key="category.category_id"
|
||||||
|
:value="category.category_id"
|
||||||
|
>
|
||||||
|
{{ category.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<button type="button" :disabled="Boolean(busy) || !materialUploadDraft.image_uri" @click="uploadMaterialDraft">
|
||||||
|
{{ text.upload }}
|
||||||
|
</button>
|
||||||
|
<button type="button" :disabled="Boolean(busy)" @click="resetMaterialUploadDraft">{{ text.reset }}</button>
|
||||||
|
</div>
|
||||||
<pre v-if="signedMedia">{{ JSON.stringify(signedMedia, null, 2) }}</pre>
|
<pre v-if="signedMedia">{{ JSON.stringify(signedMedia, null, 2) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/assets/index-OyFsqfnI.js"></script>
|
<script type="module" crossorigin src="/assets/index-B0NZlmow.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
17
web/assets/index-BconNihN.js
普通文件
17
web/assets/index-BconNihN.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-CE_7apqM.js"></script>
|
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BconNihN.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-_0xdAcps.css">
|
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-Dp0aKiRk.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用