diff --git a/src/components.d.ts b/src/components.d.ts index 2b42f87..f47bdb4 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -9,7 +9,7 @@ declare module 'vue' { export interface GlobalComponents { AssistantMenu: typeof import('./components/AssistantMenu.vue')['default'] Assistants: typeof import('./components/assistants/index.vue')['default'] - Chat: typeof import('./components/chat/chat.vue')['default'] + Chat: typeof import('./components/chat/Chat.vue')['default'] ChatMenu: typeof import('./components/ChatMenu.vue')['default'] ChatSettings: typeof import('./components/ChatSettings.vue')['default'] LeftSettings: typeof import('./components/LeftSettings.vue')['default'] diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue index 5241944..8c5095b 100644 --- a/src/components/chat/Chat.vue +++ b/src/components/chat/Chat.vue @@ -292,6 +292,13 @@ function sendText() { input.innerText = ""; updateInputHeight(); + + // 滚动 + // @ts-ignore ignore + element.mainContainer?.scrollTo({ + top: "999999", + behavior: "smooth", + }); } async function sendMessage( @@ -395,6 +402,14 @@ async function getChatMessages() { chatMessages.value = cm.data.data; + // 滚动 + setTimeout(() => { + // @ts-ignore ignore + element.mainContainer?.scrollTo({ + top: "999999", + behavior: "smooth", + }); + }, 400); // 完成 return true; } @@ -478,6 +493,7 @@ function streamChat(streamId: String, redirect = false) { } if (autoScroll.value) { + // @ts-ignore ignore element.mainContainer?.scrollTo({ top: "999999", behavior: "smooth", @@ -515,14 +531,14 @@ onUnmounted(() => { }); const uploadFile = () => { - if (!fileUpload.value) { + if (!fileUpload.value || !chatId.value) { return; } uploading.value = true; getApi() .ChatMessage.apiV1ChatsIdFilesPost( - chatId, + Number(chatId.value), { file: fileUpload.value, url: "", diff --git a/src/components/chat/chat.vue b/src/components/chat/chat.vue deleted file mode 100644 index 6ce750c..0000000 --- a/src/components/chat/chat.vue +++ /dev/null @@ -1,606 +0,0 @@ - - - -