服务器回应:{{ response }}
+ + + diff --git a/src/plugins/api.ts b/src/plugins/api.ts index 7a011eb..9a7502d 100644 --- a/src/plugins/api.ts +++ b/src/plugins/api.ts @@ -1,26 +1,36 @@ -import {Configuration, ChatApi, AssistantApi, PingApi, ToolApi, ChatMessageApi,} from "@/api"; +import { + Configuration, + ChatApi, + AssistantApi, + PingApi, + ToolApi, + ChatMessageApi, +} from "@/api"; import { useConfigStore } from "@/stores/config"; import { useUserStore } from "@/stores/user"; -const configStore = useConfigStore() -const userStore = useUserStore() +const configStore = useConfigStore(); +const userStore = useUserStore(); -const conf = new Configuration +const conf = new Configuration(); -conf.basePath = configStore.backend -conf.apiKey = "Bearer " + userStore.id_token +conf.basePath = configStore.backend; +conf.apiKey = () => { + return "Bearer " + userStore.id_token; +} +// userStore.$subscribe((mutation, state) => { +// console.log(mutation); +// conf.apiKey = "Bearer " + state.id_token; +// }); + const api = { - Chat: new ChatApi(conf), - Assistant: new AssistantApi(conf), - Ping: new PingApi(conf), - Tool: new ToolApi(conf), - ChatMessage: new ChatMessageApi(conf), -} + Chat: new ChatApi(conf), + Assistant: new AssistantApi(conf), + Ping: new PingApi(conf), + Tool: new ToolApi(conf), + ChatMessage: new ChatMessageApi(conf), +}; - - -export { - api, conf -} +export { api, conf }; diff --git a/src/typed-router.d.ts b/src/typed-router.d.ts index e1ccd3a..65da6dc 100644 --- a/src/typed-router.d.ts +++ b/src/typed-router.d.ts @@ -19,7 +19,9 @@ declare module 'vue-router/auto-routes' { */ export interface RouteNamedMap { '/': RouteRecordInfo<'/', '/', Record