From feb167e2da642b0cc57a62dccab705bf6cec1782 Mon Sep 17 00:00:00 2001 From: ChenZhaoYu <790348264@qq.com> Date: Mon, 13 Feb 2023 15:57:31 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Chat/components/Message/Avatar.vue | 16 --- src/views/Chat/components/Message/Text.vue | 5 - src/views/Chat/components/Message/index.vue | 31 ----- src/views/Chat/components/index.ts | 3 - src/views/Chat/index.vue | 113 ------------------- src/views/Chat/layout/Layout.vue | 27 ----- src/views/Chat/layout/index.ts | 3 - src/views/Chat/request.ts | 41 ------- 8 files changed, 239 deletions(-) delete mode 100644 src/views/Chat/components/Message/Avatar.vue delete mode 100644 src/views/Chat/components/Message/Text.vue delete mode 100644 src/views/Chat/components/Message/index.vue delete mode 100644 src/views/Chat/components/index.ts delete mode 100644 src/views/Chat/index.vue delete mode 100644 src/views/Chat/layout/Layout.vue delete mode 100644 src/views/Chat/layout/index.ts delete mode 100644 src/views/Chat/request.ts diff --git a/src/views/Chat/components/Message/Avatar.vue b/src/views/Chat/components/Message/Avatar.vue deleted file mode 100644 index 1857c84..0000000 --- a/src/views/Chat/components/Message/Avatar.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/src/views/Chat/components/Message/Text.vue b/src/views/Chat/components/Message/Text.vue deleted file mode 100644 index d96c5f6..0000000 --- a/src/views/Chat/components/Message/Text.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/views/Chat/components/Message/index.vue b/src/views/Chat/components/Message/index.vue deleted file mode 100644 index a897d1c..0000000 --- a/src/views/Chat/components/Message/index.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/src/views/Chat/components/index.ts b/src/views/Chat/components/index.ts deleted file mode 100644 index e5b21df..0000000 --- a/src/views/Chat/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Message from './Message/index.vue' - -export { Message } diff --git a/src/views/Chat/index.vue b/src/views/Chat/index.vue deleted file mode 100644 index 14f5e5a..0000000 --- a/src/views/Chat/index.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - diff --git a/src/views/Chat/layout/Layout.vue b/src/views/Chat/layout/Layout.vue deleted file mode 100644 index 16e9923..0000000 --- a/src/views/Chat/layout/Layout.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/src/views/Chat/layout/index.ts b/src/views/Chat/layout/index.ts deleted file mode 100644 index 4763bbc..0000000 --- a/src/views/Chat/layout/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Layout from './Layout.vue' - -export { Layout } diff --git a/src/views/Chat/request.ts b/src/views/Chat/request.ts deleted file mode 100644 index cc32f56..0000000 --- a/src/views/Chat/request.ts +++ /dev/null @@ -1,41 +0,0 @@ -import axios from 'axios' - -const BASE_URL = import.meta.env.VITE_GLOB_API_URL - -async function fetchChatAPI(message: string) { - if (!message || message.trim() === '') - return - - try { - const { status, data } = await axios.post(`${BASE_URL}/chat`, { message }) - - if (status === 200) { - if (data.text) - return Promise.resolve(data) - - if (data.statusText) - return Promise.reject(new Error(data.statusText)) - } - - return Promise.reject(new Error('Request failed')) - } - catch (error) { - return Promise.reject(error) - } -} - -async function clearChatContext() { - try { - const { status, data } = await axios.post(`${BASE_URL}/clear`) - - if (status === 200) - return Promise.resolve(data) - - return Promise.reject(new Error('Request failed')) - } - catch (error) { - return Promise.reject(error) - } -} - -export { fetchChatAPI, clearChatContext }