From 294863a578999bbc237090710f17364c27555b56 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 23 四月 2025 19:47:31 +0800 Subject: [PATCH] 1 --- src/plugin/axios/index.ts | 1 + src/views/Start.vue | 32 +++++++++++++++++++++++--------- src/main.ts | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/main.ts b/src/main.ts index 1913600..cca990a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,6 +10,7 @@ const app = createApp(App) +app.provide('request', request) app.use(ElementPlus, { locale: zhCn diff --git a/src/plugin/axios/index.ts b/src/plugin/axios/index.ts index e0c1d14..be48fc5 100644 --- a/src/plugin/axios/index.ts +++ b/src/plugin/axios/index.ts @@ -11,6 +11,7 @@ service.interceptors.request.use( (config) => { + debugger const token = "app-6MPX5Fr97eK6BWHpy8g7vddd" if (token) config.headers['Authorization'] = `Bearer ${token}` return config diff --git a/src/views/Start.vue b/src/views/Start.vue index c4f1818..abd9c6c 100644 --- a/src/views/Start.vue +++ b/src/views/Start.vue @@ -80,21 +80,35 @@ </div> </template> <script lang="ts" setup> - import { ref } from 'vue' + import { ref, inject } from 'vue' + const request = inject('request') const inputValue = ref('') const sendMsg = () => { - + console.log(inputValue.value); + request({ + url: '/chat-messages', + method: 'post', + data: { + query: inputValue.value, + inputs: {}, + response_mode: "blocking", + user: "test", + files: [] + } + }).then(res => { + console.log(res, "res"); + }) } -// import { ref } from 'vue' -// import { useRouter } from 'vue-router' + // import { ref } from 'vue' + // import { useRouter } from 'vue-router' -// const router = useRouter() -// const inputValue = ref('') + // const router = useRouter() + // const inputValue = ref('') -// const handleChat = () => { -// router.push('/chat') -// } + // const handleChat = () => { + // router.push('/chat') + // } </script> <style lang="less" scoped> @media screen and (max-width: 750px) { -- Gitblit v1.9.1