diff --git a/.env.production b/.env.production index 128bf2f..22963f5 100644 --- a/.env.production +++ b/.env.production @@ -14,7 +14,7 @@ VITE_API_PAY_PREFIX = '/pay' VITE_API_PAY_TARGET = 'https://sxwz.xueai.art' # http://43.248.133.202 # 任务处理模块 -VITE_API_WORKFLOW_UPLOAD = 'https://talkingdraw.xueai.art/aigc/workflow/file/upload' # https://sxwz.xueai.art/workflow https://designtools.xueai.art/workflow +VITE_API_WORKFLOW_UPLOAD = 'https://designtools.xueai.art/workflow/file/upload' # https://sxwz.xueai.art/workflow https://designtools.xueai.art/workflow VITE_API_WORKFLOW_WS = 'wss://talkingdraw.xueai.art/testworkflow' # 是否开启KKFileView diff --git a/components.d.ts b/components.d.ts index 6a438bf..8fdf315 100644 --- a/components.d.ts +++ b/components.d.ts @@ -31,7 +31,6 @@ declare module 'vue' { RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] Select: typeof import('./src/components/Select/index.vue')['default'] - UploadPicture: typeof import('./src/components/UploadPicture.vue')['default'] VirtualScroller: typeof import('./src/components/virtual-scroller/VirtualScroller.vue')['default'] VirtualScrollerItem: typeof import('./src/components/virtual-scroller/VirtualScrollerItem.vue')['default'] } diff --git a/src/components/UploadPicture.vue b/src/components/UploadPicture.vue deleted file mode 100644 index 423b562..0000000 --- a/src/components/UploadPicture.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - - diff --git a/src/components/dialogBox/imageUploader/index.vue b/src/components/dialogBox/imageUploader/index.vue index 392d876..e4d674a 100644 --- a/src/components/dialogBox/imageUploader/index.vue +++ b/src/components/dialogBox/imageUploader/index.vue @@ -2,7 +2,7 @@
-
+
参考内容
@@ -51,9 +51,13 @@ const emit = defineEmits(['update:modelValue']) const uploadurl = import.meta.env.VITE_API_WORKFLOW_UPLOAD const uploadRef = ref(null) const imageList = ref([...props.modelValue]) +const localPreviewList = ref([...props.modelValue]) watch(() => props.modelValue, (newVal) => { imageList.value = [...newVal] + if (newVal.length === 0) { + localPreviewList.value = [] + } }, { deep: true }) const triggerUpload = () => { @@ -76,12 +80,21 @@ const beforeUpload = (rawFile) => { const handleSuccess = (response, uploadFile) => { ElMessage.success('上传成功') + + const localUrl = URL.createObjectURL(uploadFile.raw) + const newImage = { uid: uploadFile.uid, url: response.url } imageList.value.push(newImage) emit('update:modelValue', [...imageList.value]) + + const newPreview = { + uid: uploadFile.uid, + url: localUrl + } + localPreviewList.value.push(newPreview) } const handleError = () => { @@ -93,6 +106,12 @@ const handleExceed = () => { } const handleDelete = (index) => { + const previewItem = localPreviewList.value[index] + if (previewItem && previewItem.url.startsWith('blob:')) { + URL.revokeObjectURL(previewItem.url) + } + + localPreviewList.value.splice(index, 1) imageList.value.splice(index, 1) emit('update:modelValue', [...imageList.value]) } @@ -133,8 +152,6 @@ defineExpose({ position: relative; width: 56px; height: 56px; - border-radius: 8px; - overflow: hidden; cursor: pointer; transition: all 0.3s ease; @@ -152,6 +169,7 @@ defineExpose({ height: 100%; object-fit: cover; transition: all 0.3s ease; + border-radius: 8px; } .image-index { diff --git a/src/components/dialogBox/index.vue b/src/components/dialogBox/index.vue index 09c32fd..0550c3c 100644 --- a/src/components/dialogBox/index.vue +++ b/src/components/dialogBox/index.vue @@ -6,7 +6,7 @@
回到底部
-
+
diff --git a/src/config/runninghub/index.js b/src/config/runninghub/index.js index d5313cd..7a8bc8e 100644 --- a/src/config/runninghub/index.js +++ b/src/config/runninghub/index.js @@ -6,7 +6,7 @@ export async function Playload(data,type) { const nodeInfoList = [] - if (Array.isArray(data.imgs) && data.imgs.length > 0) { + if (Array.isArray(data.imgs) && data.imgs.length > 0 && type === 'image') { for (const key of data.imgs) { if (json.nodeInfoList[key.name]) { console.log(key) @@ -64,27 +64,4 @@ function getWidthHeight(data) { console.log(data.width, data.height) return data -} - -function flux(data) { - - const nodeInfoList = [ - { nodeId: '23', fieldName: 'text', fieldValue: data.prompt }, - { nodeId: '129', fieldName: 'aspect_ratio', fieldValue: data.aspect_ratio }, - { nodeId: '101', fieldName: 'control_after_generate', fieldValue: 'randomize' }, - { nodeId: '15', fieldName: 'index', fieldValue: 0 }, - - {nodeId: '2', fieldName: 'vae_name', fieldValue: 'ae.sft'}, - {nodeId: '5', fieldName: 'sampler_name', fieldValue: 'euler'}, - {nodeId: '50', fieldName: 'value', fieldValue: 1}, - {nodeId: '102', fieldName: 'value', fieldValue: 20}, - {nodeId: '103', fieldName: 'value', fieldValue: 1}, - {nodeId: '104', fieldName: 'value', fieldValue: 1}, - {nodeId: '105', fieldName: 'value', fieldValue: 0.8} - ] - - return { - workflowId: '2011689651156819970', - nodeInfoList - } -} +} \ No newline at end of file diff --git a/src/utils/createTask.js b/src/utils/createTask.js index df24ce2..003ca90 100644 --- a/src/utils/createTask.js +++ b/src/utils/createTask.js @@ -19,8 +19,8 @@ export async function createTask(data, type, taskId, token) { // 获取结果 export async function getTask(result) { - if (result.code === 0 && result.msg === 'success') { + if (result.code === 0 && result.msg === 'success' && Array.isArray(result.data) && result.data.length > 0) { return { type: true, url: result.data[0].fileUrl } } - return { type: false, message: result.data.exception_message } + return { type: false, message: result.data?.exception_message || '生成失败' } }