diff --git a/public/chat_background-removebg-preview.png b/public/chat_background-removebg-preview.png new file mode 100644 index 0000000..c5f1f7f Binary files /dev/null and b/public/chat_background-removebg-preview.png differ diff --git a/public/chat_background.png b/public/chat_background.png new file mode 100644 index 0000000..0af173d Binary files /dev/null and b/public/chat_background.png differ diff --git a/src/api/qa.ts b/src/api/qa.ts index ea4f17e..88c8454 100644 --- a/src/api/qa.ts +++ b/src/api/qa.ts @@ -1 +1,38 @@ -// import { http } from "@/utils/http"; +import { http } from "@/utils/http"; + +export type ChatResult = { + status: string; + chat_history: Array<{ + role: string; + content: string; + }>; + content: string; +}; + +export type ModelActionResult = { + status: string; + message: string; +}; + +/** 发起聊天请求 */ +export const chat = (data?: object) => { + return http.request("post", "http://127.0.0.1:5005/qa/chat", { + data + }); +}; + +/** 创建模型 */ +export const createModel = () => { + return http.request( + "post", + "http://127.0.0.1:5005/qa/create_model" + ); +}; + +/** 终止模型 */ +export const terminateModel = () => { + return http.request( + "post", + "http://127.0.0.1:5005/qa/terminate_model" + ); +}; diff --git a/src/router/modules/qa.ts b/src/router/modules/qa.ts index d9d4432..e0b15f4 100644 --- a/src/router/modules/qa.ts +++ b/src/router/modules/qa.ts @@ -1,7 +1,7 @@ export default { path: "/qa", redirect: "/qa/chat", - component: () => import("@/views/qa/index.vue"), + component: () => import("@/views/qa/chat/index.vue"), meta: { icon: "lollipop", title: "问答系统", diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index 3a39993..379ca6d 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -17,7 +17,7 @@ import { useUserStoreHook } from "@/store/modules/user"; // 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1 const defaultConfig: AxiosRequestConfig = { // 请求超时时间 - timeout: 10000, + timeout: 60000, headers: { Accept: "application/json, text/plain, */*", "Content-Type": "application/json", diff --git a/src/views/qa/chat/index.vue b/src/views/qa/chat/index.vue index eefacab..394119b 100644 --- a/src/views/qa/chat/index.vue +++ b/src/views/qa/chat/index.vue @@ -1,9 +1,235 @@ +