From cc6deb57d440c54d0b5cb084507c9a70318f3f7f Mon Sep 17 00:00:00 2001 From: lipenghui Date: Tue, 23 Jan 2024 16:42:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E5=88=86=E6=9E=90=EF=BC=9B=E5=85=B6=E4=BB=96=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=9C=80=E8=A6=81=E5=A2=9E=E5=8A=A0modelType?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/base/file.ts | 16 +- src/api/base/message.ts | 25 +++- src/components/AppMessage/index.vue | 21 ++- src/design/public.scss | 4 +- src/enums/messageEnum.ts | 9 ++ src/layout/AppMenu/index.vue | 12 +- src/store/moules/messageStore/index.ts | 2 +- src/utils/axios/Axios.ts | 2 +- src/utils/axios/index.ts | 1 + src/views/conversation/index.vue | 9 +- src/views/repository/index.vue | 151 +++++++++++++++---- src/views/role/index.vue | 11 +- src/views/textToImage/index.vue | 18 +-- src/views/visualAnalysis/index.vue | 195 ++++++++++++++++++------- types/axios.d.ts | 7 + 15 files changed, 355 insertions(+), 128 deletions(-) diff --git a/src/api/base/file.ts b/src/api/base/file.ts index 9575ade..87b58b4 100644 --- a/src/api/base/file.ts +++ b/src/api/base/file.ts @@ -1,13 +1,15 @@ import { defHttp } from '@/utils/axios/index' -import type { AxiosProgressEvent } from 'axios' -import type { UploadFileParams } from '/#/axios' +import { ContentTypeEnum } from '@/enums/httpEnum' +import type { UploadFileResult } from '/#/axios' -export function uploadApi(params: UploadFileParams, onUploadProgress: (progressEvent: AxiosProgressEvent) => void) { - return defHttp.uploadFile( +export function uploadApi(data: FormData): Promise { + return defHttp.post( { - url: '/qn/iot-system/oss/endpoint/put-file', - onUploadProgress, + url: '/hulk-system/hulk-resource/oss/endpoint/put-file', + headers: { + 'Content-Type': ContentTypeEnum.FORM_DATA, + }, + data, }, - params, ) } diff --git a/src/api/base/message.ts b/src/api/base/message.ts index df19b72..3304bda 100644 --- a/src/api/base/message.ts +++ b/src/api/base/message.ts @@ -80,7 +80,7 @@ export async function stopMessage(data: { conversationId: string }) { } /** - * @description 发送消息(文生文) + * @description 发送消息(文生文)要带modelType,区分gpt3.5和gpt4 */ export async function sendTextToText(data: { conversationId: string @@ -90,12 +90,12 @@ export async function sendTextToText(data: { return defHttp.post({ url: `/open-chat/chat/session`, data, - timeout: 60 * 1000, + timeout: 120 * 1000, }) } /** - * @description 发送消息(文生图) + * @description 发送消息(文生图)不需要带modelType */ export async function sendTextToImage(data: { conversationId: string @@ -104,7 +104,7 @@ export async function sendTextToImage(data: { return defHttp.post({ url: `/open-gpts/gpts/getDallEImages`, data, - timeout: 60 * 1000, + timeout: 120 * 1000, }) } @@ -118,7 +118,22 @@ export async function sendRepository(data: { return defHttp.post({ url: `/open-gpts/gpts/getQanythingStreamChat`, data, - timeout: 60 * 1000, + timeout: 120 * 1000, + }) +} + +/** + * @description 发送消息(图像分析)不需要带modelType + */ +export async function sendVisualAnalysis(data: { + conversationId: string + question: string + fileUrl: string +}) { + return defHttp.post({ + url: `/open-gpts/gpts/getImageVision`, + data, + timeout: 120 * 1000, }) } diff --git a/src/components/AppMessage/index.vue b/src/components/AppMessage/index.vue index 30cb67e..23419c8 100644 --- a/src/components/AppMessage/index.vue +++ b/src/components/AppMessage/index.vue @@ -11,6 +11,10 @@ import { copyText } from '@/utils/copyTextToClipboard' import { useMessageStore } from '@/store/moules/messageStore/index' const props = defineProps({ + height: { + type: String, + default: 'calc(100% - 120px)', + }, list: { type: Array as PropType, default: () => [], @@ -121,7 +125,10 @@ onMounted(async () => {
- {{ item.content }} +
@@ -136,11 +143,12 @@ onMounted(async () => { conversationData?.type === MenuTypeEnum.TEXT_TO_TEXT || conversationData?.type === MenuTypeEnum.ROLE || conversationData?.type === MenuTypeEnum.REPOSITORY + || conversationData?.type === MenuTypeEnum.VISUAL_ANALYSIS " editor-id="preview-only-ai" :model-value="item.content" /> -
+
{