From a7f3f422d295c5efd2142b93d2c8b9ef08789c28 Mon Sep 17 00:00:00 2001 From: orenzhang Date: Fri, 7 Jun 2024 16:18:39 +0800 Subject: [PATCH 1/3] feat: support for websocket #21 --- src/api/chat.js | 15 ----- src/components/ChatInput.vue | 104 ++++++++++++++++++------------ src/components/MessageContent.vue | 2 + src/context/index.js | 1 + src/locale/en-us.js | 3 + src/locale/zh-cn.js | 3 + vite.config.js | 1 + 7 files changed, 74 insertions(+), 55 deletions(-) diff --git a/src/api/chat.js b/src/api/chat.js index b6a3cfe..71fffc1 100644 --- a/src/api/chat.js +++ b/src/api/chat.js @@ -1,20 +1,5 @@ -import globalContext from '../context'; import http from './index'; -export const createChatAPI = (data) => new Promise((resolve, reject) => { - fetch(`${globalContext.backendUrl}/chat/`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - credentials: 'include', - }).then( - (res) => resolve(res), - (err) => reject(err), - ); -}); - export const preCheckAPI = (data) => new Promise((resolve, reject) => { http.post('/chat/pre_check/', data).then( (res) => resolve(res), diff --git a/src/components/ChatInput.vue b/src/components/ChatInput.vue index e0d8b54..c62fdd7 100644 --- a/src/components/ChatInput.vue +++ b/src/components/ChatInput.vue @@ -1,10 +1,11 @@