From 9495ba466a28952817e3ee6011cbef092e3ffd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E5=BA=86=E6=89=8D=E4=B8=A8=E9=9D=99=E8=A7=85?= Date: Mon, 8 Jan 2024 22:08:39 +0800 Subject: [PATCH] Fix upload image issue (#42) --- ...zhishuyun-hub-ac761756-d7fd-47cf-ad76-f61c5836efd6.json | 7 +++++++ src/components/chat/InputBox.vue | 6 ++++-- src/components/common/AuthPanel.vue | 2 +- src/components/common/Navigator.vue | 6 +++--- src/components/midjourney/ReferenceImage.vue | 7 +++++-- 5 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 change/@zhishuyun-hub-ac761756-d7fd-47cf-ad76-f61c5836efd6.json diff --git a/change/@zhishuyun-hub-ac761756-d7fd-47cf-ad76-f61c5836efd6.json b/change/@zhishuyun-hub-ac761756-d7fd-47cf-ad76-f61c5836efd6.json new file mode 100644 index 0000000..75d0550 --- /dev/null +++ b/change/@zhishuyun-hub-ac761756-d7fd-47cf-ad76-f61c5836efd6.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix upload image issue", + "packageName": "@zhishuyun/hub", + "email": "cqc@germey.cn", + "dependentChangeType": "patch" +} diff --git a/src/components/chat/InputBox.vue b/src/components/chat/InputBox.vue index d8f7343..45a05ad 100644 --- a/src/components/chat/InputBox.vue +++ b/src/components/chat/InputBox.vue @@ -11,7 +11,7 @@ :show-file-list="true" :limit="1" :multiple="false" - action="/api/v1/files/" + :action="uploadUrl" :on-exceed="onExceed" :on-error="onError" :headers="headers" @@ -51,6 +51,7 @@ import { defineComponent } from 'vue'; import { ElInput, ElMessage, ElTooltip, ElUpload } from 'element-plus'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { CHAT_MODEL_CHATGPT4_VISION, IChatModel } from '@/operators'; +import { getBaseUrlData } from '@/utils'; export default defineComponent({ name: 'InputBox', @@ -80,7 +81,8 @@ export default defineComponent({ data() { return { questionValue: this.question, - fileList: [] + fileList: [], + uploadUrl: getBaseUrlData() + '/api/v1/files/' }; }, computed: { diff --git a/src/components/common/AuthPanel.vue b/src/components/common/AuthPanel.vue index 1cec0db..57f79bd 100644 --- a/src/components/common/AuthPanel.vue +++ b/src/components/common/AuthPanel.vue @@ -48,7 +48,7 @@ export default defineComponent({ inviterId() { // if forceInviterId is set, then use forceInviterId if (this.$config?.distribution?.forceInviterId) { - return this.$config?.distribution?.defaultInviterId; + return this.$config?.distribution?.forceInviterId; } // Otherwise, use the inviter_id in the url, then use the inviter_id in the cookie, and finally use the default inviter_id const result = diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index e580bfb..2c9f983 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -31,15 +31,15 @@
- + - + - + diff --git a/src/components/midjourney/ReferenceImage.vue b/src/components/midjourney/ReferenceImage.vue index 4ffe846..ecfee29 100644 --- a/src/components/midjourney/ReferenceImage.vue +++ b/src/components/midjourney/ReferenceImage.vue @@ -6,7 +6,7 @@ name="file" :limit="5" :multiple="true" - action="/api/v1/files/" + :action="uploadUrl" list-type="picture" :on-exceed="onExceed" :on-error="onError" @@ -29,9 +29,11 @@ import { defineComponent } from 'vue'; import { ElUpload, ElButton, UploadFiles, UploadFile, ElMessage } from 'element-plus'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; +import { getBaseUrlData } from '@/utils'; interface IData { fileList: UploadFiles; + uploadUrl: string; } export default defineComponent({ @@ -44,7 +46,8 @@ export default defineComponent({ emits: ['change'], data(): IData { return { - fileList: [] + fileList: [], + uploadUrl: getBaseUrlData() + '/api/v1/files/' }; }, computed: {