Amber后台配置迁移和优化
将应用的配置从状态管理仓库迁移到独立的配置文件,以简化配置的管理。同时,统一使用新的配置方式,优化了配置的加载逻辑,提高了代码的可读性和维护性。此外,对部分Vue组件和API插件进行了相应的配置路径调整,确保应用的各个部分都能正确地使用新的配置方式。 BREAKING CHANGE: 由于配置项的位置和加载方式已更改,因此任何依赖于旧配置路径或方法的代码都必须进行相应的调整,以确保应用能够正常运行。
This commit is contained in:
parent
2001fb5e51
commit
5a085d3c60
424
src/auto-imports.d.ts
vendored
424
src/auto-imports.d.ts
vendored
@ -5,271 +5,187 @@
|
|||||||
// Generated by unplugin-auto-import
|
// Generated by unplugin-auto-import
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const EffectScope: (typeof import("vue"))["EffectScope"];
|
const EffectScope: typeof import('vue')['EffectScope']
|
||||||
const computed: (typeof import("vue"))["computed"];
|
const computed: typeof import('vue')['computed']
|
||||||
const createApp: (typeof import("vue"))["createApp"];
|
const createApp: typeof import('vue')['createApp']
|
||||||
const customRef: (typeof import("vue"))["customRef"];
|
const customRef: typeof import('vue')['customRef']
|
||||||
const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"];
|
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||||
const defineComponent: (typeof import("vue"))["defineComponent"];
|
const defineComponent: typeof import('vue')['defineComponent']
|
||||||
const effectScope: (typeof import("vue"))["effectScope"];
|
const effectScope: typeof import('vue')['effectScope']
|
||||||
const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"];
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||||
const getCurrentScope: (typeof import("vue"))["getCurrentScope"];
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||||
const h: (typeof import("vue"))["h"];
|
const h: typeof import('vue')['h']
|
||||||
const inject: (typeof import("vue"))["inject"];
|
const inject: typeof import('vue')['inject']
|
||||||
const isProxy: (typeof import("vue"))["isProxy"];
|
const isProxy: typeof import('vue')['isProxy']
|
||||||
const isReactive: (typeof import("vue"))["isReactive"];
|
const isReactive: typeof import('vue')['isReactive']
|
||||||
const isReadonly: (typeof import("vue"))["isReadonly"];
|
const isReadonly: typeof import('vue')['isReadonly']
|
||||||
const isRef: (typeof import("vue"))["isRef"];
|
const isRef: typeof import('vue')['isRef']
|
||||||
const markRaw: (typeof import("vue"))["markRaw"];
|
const markRaw: typeof import('vue')['markRaw']
|
||||||
const nextTick: (typeof import("vue"))["nextTick"];
|
const nextTick: typeof import('vue')['nextTick']
|
||||||
const onActivated: (typeof import("vue"))["onActivated"];
|
const onActivated: typeof import('vue')['onActivated']
|
||||||
const onBeforeMount: (typeof import("vue"))["onBeforeMount"];
|
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||||
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"];
|
const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]
|
||||||
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"];
|
const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]
|
||||||
const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"];
|
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||||
const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"];
|
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||||
const onDeactivated: (typeof import("vue"))["onDeactivated"];
|
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||||
const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"];
|
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||||
const onMounted: (typeof import("vue"))["onMounted"];
|
const onMounted: typeof import('vue')['onMounted']
|
||||||
const onRenderTracked: (typeof import("vue"))["onRenderTracked"];
|
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||||
const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"];
|
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||||
const onScopeDispose: (typeof import("vue"))["onScopeDispose"];
|
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||||
const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"];
|
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||||
const onUnmounted: (typeof import("vue"))["onUnmounted"];
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
const onUpdated: (typeof import("vue"))["onUpdated"];
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
const provide: (typeof import("vue"))["provide"];
|
const provide: typeof import('vue')['provide']
|
||||||
const reactive: (typeof import("vue"))["reactive"];
|
const reactive: typeof import('vue')['reactive']
|
||||||
const readonly: (typeof import("vue"))["readonly"];
|
const readonly: typeof import('vue')['readonly']
|
||||||
const ref: (typeof import("vue"))["ref"];
|
const ref: typeof import('vue')['ref']
|
||||||
const resolveComponent: (typeof import("vue"))["resolveComponent"];
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||||
const shallowReactive: (typeof import("vue"))["shallowReactive"];
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||||
const shallowReadonly: (typeof import("vue"))["shallowReadonly"];
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||||
const shallowRef: (typeof import("vue"))["shallowRef"];
|
const shallowRef: typeof import('vue')['shallowRef']
|
||||||
const toRaw: (typeof import("vue"))["toRaw"];
|
const toRaw: typeof import('vue')['toRaw']
|
||||||
const toRef: (typeof import("vue"))["toRef"];
|
const toRef: typeof import('vue')['toRef']
|
||||||
const toRefs: (typeof import("vue"))["toRefs"];
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
const toValue: (typeof import("vue"))["toValue"];
|
const toValue: typeof import('vue')['toValue']
|
||||||
const triggerRef: (typeof import("vue"))["triggerRef"];
|
const triggerRef: typeof import('vue')['triggerRef']
|
||||||
const unref: (typeof import("vue"))["unref"];
|
const unref: typeof import('vue')['unref']
|
||||||
const useAttrs: (typeof import("vue"))["useAttrs"];
|
const useAttrs: typeof import('vue')['useAttrs']
|
||||||
const useCssModule: (typeof import("vue"))["useCssModule"];
|
const useCssModule: typeof import('vue')['useCssModule']
|
||||||
const useCssVars: (typeof import("vue"))["useCssVars"];
|
const useCssVars: typeof import('vue')['useCssVars']
|
||||||
const useLink: (typeof import("vue-router"))["useLink"];
|
const useLink: (typeof import("vue-router"))["useLink"]
|
||||||
const useRoute: (typeof import("vue-router/auto"))["useRoute"];
|
const useRoute: typeof import('vue-router/auto')['useRoute']
|
||||||
const useRouter: (typeof import("vue-router/auto"))["useRouter"];
|
const useRouter: typeof import('vue-router/auto')['useRouter']
|
||||||
const useSlots: (typeof import("vue"))["useSlots"];
|
const useSlots: typeof import('vue')['useSlots']
|
||||||
const watch: (typeof import("vue"))["watch"];
|
const watch: typeof import('vue')['watch']
|
||||||
const watchEffect: (typeof import("vue"))["watchEffect"];
|
const watchEffect: typeof import('vue')['watchEffect']
|
||||||
const watchPostEffect: (typeof import("vue"))["watchPostEffect"];
|
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||||
const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"];
|
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||||
}
|
}
|
||||||
// for type re-export
|
// for type re-export
|
||||||
declare global {
|
declare global {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export type {
|
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
|
||||||
Component,
|
import('vue')
|
||||||
ComponentPublicInstance,
|
|
||||||
ComputedRef,
|
|
||||||
ExtractDefaultPropTypes,
|
|
||||||
ExtractPropTypes,
|
|
||||||
ExtractPublicPropTypes,
|
|
||||||
InjectionKey,
|
|
||||||
PropType,
|
|
||||||
Ref,
|
|
||||||
VNode,
|
|
||||||
WritableComputedRef,
|
|
||||||
} from "vue";
|
|
||||||
import("vue");
|
|
||||||
}
|
}
|
||||||
// for vue template auto import
|
// for vue template auto import
|
||||||
import { UnwrapRef } from "vue";
|
import { UnwrapRef } from 'vue'
|
||||||
declare module "vue" {
|
declare module 'vue' {
|
||||||
interface GlobalComponents {}
|
interface GlobalComponents {}
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||||
readonly defineAsyncComponent: UnwrapRef<
|
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||||
(typeof import("vue"))["defineAsyncComponent"]
|
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||||
>;
|
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||||
readonly defineComponent: UnwrapRef<
|
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||||
(typeof import("vue"))["defineComponent"]
|
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||||
>;
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly getCurrentInstance: UnwrapRef<
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
(typeof import("vue"))["getCurrentInstance"]
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
>;
|
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||||
readonly getCurrentScope: UnwrapRef<
|
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||||
(typeof import("vue"))["getCurrentScope"]
|
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||||
>;
|
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||||
readonly onBeforeUnmount: UnwrapRef<
|
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||||
(typeof import("vue"))["onBeforeUnmount"]
|
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||||
>;
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly onBeforeUpdate: UnwrapRef<
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
(typeof import("vue"))["onBeforeUpdate"]
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
>;
|
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||||
readonly onErrorCaptured: UnwrapRef<
|
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||||
(typeof import("vue"))["onErrorCaptured"]
|
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||||
>;
|
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||||
readonly onRenderTracked: UnwrapRef<
|
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||||
(typeof import("vue"))["onRenderTracked"]
|
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||||
>;
|
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||||
readonly onRenderTriggered: UnwrapRef<
|
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||||
(typeof import("vue"))["onRenderTriggered"]
|
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||||
>;
|
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||||
readonly onScopeDispose: UnwrapRef<
|
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||||
(typeof import("vue"))["onScopeDispose"]
|
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||||
>;
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly onServerPrefetch: UnwrapRef<
|
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||||
(typeof import("vue"))["onServerPrefetch"]
|
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||||
>;
|
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||||
readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>;
|
|
||||||
readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>;
|
|
||||||
readonly resolveComponent: UnwrapRef<
|
|
||||||
(typeof import("vue"))["resolveComponent"]
|
|
||||||
>;
|
|
||||||
readonly shallowReactive: UnwrapRef<
|
|
||||||
(typeof import("vue"))["shallowReactive"]
|
|
||||||
>;
|
|
||||||
readonly shallowReadonly: UnwrapRef<
|
|
||||||
(typeof import("vue"))["shallowReadonly"]
|
|
||||||
>;
|
|
||||||
readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>;
|
|
||||||
readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>;
|
|
||||||
readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>;
|
|
||||||
readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>;
|
|
||||||
readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>;
|
|
||||||
readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>;
|
|
||||||
readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>;
|
|
||||||
readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>;
|
|
||||||
readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>;
|
|
||||||
readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>;
|
|
||||||
readonly useRoute: UnwrapRef<
|
|
||||||
(typeof import("vue-router/auto"))["useRoute"]
|
|
||||||
>;
|
|
||||||
readonly useRouter: UnwrapRef<
|
|
||||||
(typeof import("vue-router/auto"))["useRouter"]
|
|
||||||
>;
|
|
||||||
readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>;
|
|
||||||
readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>;
|
|
||||||
readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>;
|
|
||||||
readonly watchPostEffect: UnwrapRef<
|
|
||||||
(typeof import("vue"))["watchPostEffect"]
|
|
||||||
>;
|
|
||||||
readonly watchSyncEffect: UnwrapRef<
|
|
||||||
(typeof import("vue"))["watchSyncEffect"]
|
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module "@vue/runtime-core" {
|
declare module '@vue/runtime-core' {
|
||||||
interface GlobalComponents {}
|
interface GlobalComponents {}
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>;
|
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||||
readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>;
|
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||||
readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>;
|
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||||
readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>;
|
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||||
readonly defineAsyncComponent: UnwrapRef<
|
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
|
||||||
(typeof import("vue"))["defineAsyncComponent"]
|
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
|
||||||
>;
|
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||||
readonly defineComponent: UnwrapRef<
|
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||||
(typeof import("vue"))["defineComponent"]
|
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||||
>;
|
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||||
readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>;
|
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||||
readonly getCurrentInstance: UnwrapRef<
|
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||||
(typeof import("vue"))["getCurrentInstance"]
|
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||||
>;
|
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
|
||||||
readonly getCurrentScope: UnwrapRef<
|
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
|
||||||
(typeof import("vue"))["getCurrentScope"]
|
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
|
||||||
>;
|
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
|
||||||
readonly h: UnwrapRef<(typeof import("vue"))["h"]>;
|
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
|
||||||
readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>;
|
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
|
||||||
readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>;
|
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
|
||||||
readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>;
|
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
|
||||||
readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>;
|
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
|
||||||
readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>;
|
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
|
||||||
readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>;
|
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
|
||||||
readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>;
|
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
|
||||||
readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>;
|
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
|
||||||
readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>;
|
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
|
||||||
readonly onBeforeUnmount: UnwrapRef<
|
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
|
||||||
(typeof import("vue"))["onBeforeUnmount"]
|
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||||
>;
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
readonly onBeforeUpdate: UnwrapRef<
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
(typeof import("vue"))["onBeforeUpdate"]
|
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||||
>;
|
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
|
||||||
readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>;
|
readonly ref: UnwrapRef<typeof import('vue')['ref']>
|
||||||
readonly onErrorCaptured: UnwrapRef<
|
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
|
||||||
(typeof import("vue"))["onErrorCaptured"]
|
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
|
||||||
>;
|
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
|
||||||
readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>;
|
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
|
||||||
readonly onRenderTracked: UnwrapRef<
|
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
|
||||||
(typeof import("vue"))["onRenderTracked"]
|
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
|
||||||
>;
|
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
|
||||||
readonly onRenderTriggered: UnwrapRef<
|
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
|
||||||
(typeof import("vue"))["onRenderTriggered"]
|
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
|
||||||
>;
|
readonly unref: UnwrapRef<typeof import('vue')['unref']>
|
||||||
readonly onScopeDispose: UnwrapRef<
|
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
|
||||||
(typeof import("vue"))["onScopeDispose"]
|
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||||
>;
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly onServerPrefetch: UnwrapRef<
|
readonly useRoute: UnwrapRef<typeof import('vue-router/auto')['useRoute']>
|
||||||
(typeof import("vue"))["onServerPrefetch"]
|
readonly useRouter: UnwrapRef<typeof import('vue-router/auto')['useRouter']>
|
||||||
>;
|
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||||
readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>;
|
readonly watch: UnwrapRef<typeof import('vue')['watch']>
|
||||||
readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>;
|
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
|
||||||
readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>;
|
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
|
||||||
readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>;
|
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
|
||||||
readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>;
|
|
||||||
readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>;
|
|
||||||
readonly resolveComponent: UnwrapRef<
|
|
||||||
(typeof import("vue"))["resolveComponent"]
|
|
||||||
>;
|
|
||||||
readonly shallowReactive: UnwrapRef<
|
|
||||||
(typeof import("vue"))["shallowReactive"]
|
|
||||||
>;
|
|
||||||
readonly shallowReadonly: UnwrapRef<
|
|
||||||
(typeof import("vue"))["shallowReadonly"]
|
|
||||||
>;
|
|
||||||
readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>;
|
|
||||||
readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>;
|
|
||||||
readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>;
|
|
||||||
readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>;
|
|
||||||
readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>;
|
|
||||||
readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>;
|
|
||||||
readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>;
|
|
||||||
readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>;
|
|
||||||
readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>;
|
|
||||||
readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>;
|
|
||||||
readonly useRoute: UnwrapRef<
|
|
||||||
(typeof import("vue-router/auto"))["useRoute"]
|
|
||||||
>;
|
|
||||||
readonly useRouter: UnwrapRef<
|
|
||||||
(typeof import("vue-router/auto"))["useRouter"]
|
|
||||||
>;
|
|
||||||
readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>;
|
|
||||||
readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>;
|
|
||||||
readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>;
|
|
||||||
readonly watchPostEffect: UnwrapRef<
|
|
||||||
(typeof import("vue"))["watchPostEffect"]
|
|
||||||
>;
|
|
||||||
readonly watchSyncEffect: UnwrapRef<
|
|
||||||
(typeof import("vue"))["watchSyncEffect"]
|
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
src/components.d.ts
vendored
5
src/components.d.ts
vendored
@ -2,15 +2,12 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// Generated by unplugin-vue-components
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
export {};
|
export {}
|
||||||
|
|
||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AppBar: typeof import('./components/AppBar.vue')['default']
|
AppBar: typeof import('./components/AppBar.vue')['default']
|
||||||
AppFooter: typeof import('./components/AppFooter.vue')['default']
|
|
||||||
copy: typeof import('./components/default copy.vue')['default']
|
|
||||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
View: typeof import('./components/View.vue')['default']
|
View: typeof import('./components/View.vue')['default']
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<!-- <v-divider></v-divider> -->
|
<!-- <v-divider></v-divider> -->
|
||||||
|
|
||||||
<v-list density="compact" nav>
|
<v-list density="compact" nav>
|
||||||
<template v-for="item in appStore.navigation_items">
|
<template v-for="item in appStore.navigation_items" :key="item.to">
|
||||||
<v-list-item
|
<v-list-item
|
||||||
:prepend-icon="item.icon"
|
:prepend-icon="item.icon"
|
||||||
rounded="lg"
|
rounded="lg"
|
||||||
@ -33,17 +33,15 @@
|
|||||||
to="/auth/login"
|
to="/auth/login"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template
|
<template v-if="chats.data != null">
|
||||||
v-if="chats.data != null"
|
<template v-for="chat in chats.data" :key="chat.id">
|
||||||
v-for="chat in chats.data"
|
<v-list-item
|
||||||
:key="chat.id"
|
prepend-icon="mdi-chat"
|
||||||
>
|
rounded="lg"
|
||||||
<v-list-item
|
:title="chat?.name"
|
||||||
prepend-icon="mdi-chat"
|
:to="'/chats/' + chat.id"
|
||||||
rounded="lg"
|
/>
|
||||||
:title="chat?.name"
|
</template>
|
||||||
:to="'/chats/' + chat.id"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-navigation-drawer>
|
</v-navigation-drawer>
|
||||||
@ -53,20 +51,19 @@
|
|||||||
@click="appStore.navigation_drawer = !appStore.navigation_drawer"
|
@click="appStore.navigation_drawer = !appStore.navigation_drawer"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<v-app-bar-title>{{ configStore.app_name }}</v-app-bar-title>
|
<v-app-bar-title>{{ config.app_name }}</v-app-bar-title>
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
<!-- </v-app> -->
|
<!-- </v-app> -->
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useConfigStore } from "@/stores/config";
|
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import { useAppStore } from "@/stores/app";
|
import { useAppStore } from "@/stores/app";
|
||||||
import { useChatStore } from "@/stores/chat";
|
import { useChatStore } from "@/stores/chat";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { ApiV1ChatsGet200Response } from "@/api";
|
import { ApiV1ChatsGet200Response } from "@/api";
|
||||||
|
import config from "@/config/config";
|
||||||
|
|
||||||
const chatStore = useChatStore();
|
const chatStore = useChatStore();
|
||||||
const configStore = useConfigStore();
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
20
src/config/config.ts
Normal file
20
src/config/config.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const config = {
|
||||||
|
app_name: "Amber",
|
||||||
|
oauth_discovery_url:
|
||||||
|
"https://auth.leaflow.cn/.well-known/openid-configuration",
|
||||||
|
oauth_client_id: "14",
|
||||||
|
oauth_callback_url: "http://localhost:3000/auth/callback",
|
||||||
|
oauth_storage_key: "code_verifier",
|
||||||
|
oauth_scope: "openid profile",
|
||||||
|
backend: "http://localhost:8080",
|
||||||
|
};
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
config.backend = "https://amber-api.leaflow.cn";
|
||||||
|
config.oauth_callback_url = "https://amber.leaflow.cn/auth/callback";
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("api endpoint: " + config.backend);
|
||||||
|
|
||||||
|
export default config;
|
@ -4,7 +4,6 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// import { ref } from "vue";
|
// import { ref } from "vue";
|
||||||
// import { useConfigStore } from "@/stores/config";
|
|
||||||
import AppBar from "@/components/AppBar.vue";
|
import AppBar from "@/components/AppBar.vue";
|
||||||
import View from "@/components/View.vue";
|
import View from "@/components/View.vue";
|
||||||
import { useTheme } from "vuetify";
|
import { useTheme } from "vuetify";
|
||||||
|
@ -4,25 +4,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useConfigStore } from "@/stores/config";
|
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
const configStore = useConfigStore();
|
import config from "@/config/config";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const discovery = await axios.get(configStore.oauth_discovery_url);
|
const discovery = await axios.get(config.oauth_discovery_url);
|
||||||
|
|
||||||
const localCodeVerifier = localStorage.getItem(configStore.oauth_storage_key);
|
const localCodeVerifier = localStorage.getItem(config.oauth_storage_key);
|
||||||
|
|
||||||
// 从当前页面请求中获取 code
|
// 从当前页面请求中获取 code
|
||||||
const code = new URLSearchParams(window.location.search).get("code");
|
const code = new URLSearchParams(window.location.search).get("code");
|
||||||
|
|
||||||
const q = new URLSearchParams({
|
const q = new URLSearchParams({
|
||||||
client_id: configStore.oauth_client_id,
|
client_id: config.oauth_client_id,
|
||||||
grant_type: "authorization_code",
|
grant_type: "authorization_code",
|
||||||
redirect_uri: configStore.oauth_callback_url,
|
redirect_uri: config.oauth_callback_url,
|
||||||
code_verifier: localCodeVerifier || "",
|
code_verifier: localCodeVerifier || "",
|
||||||
code: code || "",
|
code: code || "",
|
||||||
});
|
});
|
||||||
|
@ -4,12 +4,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script setup lang="ts">
|
||||||
|
import config from "@/config/config";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useConfigStore } from "@/stores/config";
|
|
||||||
const configStore = useConfigStore();
|
|
||||||
|
|
||||||
const discovery = await axios.get(configStore.oauth_discovery_url);
|
const discovery = await axios.get(config.oauth_discovery_url);
|
||||||
|
|
||||||
function generateRandomString(length: number) {
|
function generateRandomString(length: number) {
|
||||||
let text = "";
|
let text = "";
|
||||||
@ -39,13 +38,13 @@ const codeVerifier = generateRandomString(128);
|
|||||||
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
||||||
|
|
||||||
// save code_verifier to localStorage
|
// save code_verifier to localStorage
|
||||||
localStorage.setItem(configStore.oauth_storage_key, codeVerifier);
|
localStorage.setItem(config.oauth_storage_key, codeVerifier);
|
||||||
|
|
||||||
const query = new URLSearchParams({
|
const query = new URLSearchParams({
|
||||||
client_id: configStore.oauth_client_id,
|
client_id: config.oauth_client_id,
|
||||||
redirect_uri: configStore.oauth_callback_url,
|
redirect_uri: config.oauth_callback_url,
|
||||||
response_type: "code",
|
response_type: "code",
|
||||||
scope: configStore.oauth_scope,
|
scope: config.oauth_scope,
|
||||||
code_challenge: codeChallenge,
|
code_challenge: codeChallenge,
|
||||||
code_challenge_method: "S256",
|
code_challenge_method: "S256",
|
||||||
}).toString();
|
}).toString();
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
<h3 class="mb-3">聊天记录</h3>
|
<h3 class="mb-3">聊天记录</h3>
|
||||||
|
|
||||||
<v-card
|
<v-card
|
||||||
class="mx-auto mt-3"
|
|
||||||
width="100%"
|
|
||||||
v-for="message in messages.data"
|
v-for="message in messages.data"
|
||||||
:key="message.id"
|
:key="message.id"
|
||||||
|
class="mx-auto mt-3"
|
||||||
|
width="100%"
|
||||||
>
|
>
|
||||||
<template v-slot:title>
|
<template #title>
|
||||||
<span class="font-weight-black">
|
<span class="font-weight-black">
|
||||||
<span v-if="message.role == 'assistant'"> AI </span>
|
<span v-if="message.role == 'assistant'"> AI </span>
|
||||||
<span v-else-if="message.role == 'system'"> 系统 </span>
|
<span v-else-if="message.role == 'system'"> 系统 </span>
|
||||||
@ -30,9 +30,9 @@
|
|||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<div v-show="toolName != ''">
|
<div v-show="toolName != ''">
|
||||||
<v-progress-circular
|
<v-progress-circular
|
||||||
:size="16"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
indeterminate
|
indeterminate
|
||||||
|
:size="16"
|
||||||
></v-progress-circular>
|
></v-progress-circular>
|
||||||
{{ toolName }}
|
{{ toolName }}
|
||||||
</div>
|
</div>
|
||||||
@ -62,7 +62,7 @@ const input = ref("");
|
|||||||
const toolName = ref("");
|
const toolName = ref("");
|
||||||
|
|
||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
if (input.value != "") {
|
if (input.value !== "") {
|
||||||
api.ChatMessage.apiV1ChatsIdMessagesPost(chatId, {
|
api.ChatMessage.apiV1ChatsIdMessagesPost(chatId, {
|
||||||
message: input.value,
|
message: input.value,
|
||||||
})
|
})
|
||||||
@ -86,7 +86,7 @@ function sendMessage() {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// if 409
|
// if 409
|
||||||
if (err.response.status == 409) {
|
if (err.response.status === 409) {
|
||||||
const streamId = err.response.data.data?.stream_id;
|
const streamId = err.response.data.data?.stream_id;
|
||||||
|
|
||||||
if (streamId) {
|
if (streamId) {
|
||||||
@ -118,15 +118,15 @@ function streamChat(streamId: String) {
|
|||||||
window.scrollTo(0, document.body.scrollHeight);
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
|
|
||||||
// set index
|
// set index
|
||||||
let i = (messages.value.data?.length ?? 1) - 1;
|
const i = (messages.value.data?.length ?? 1) - 1;
|
||||||
console.log(i);
|
console.log(i);
|
||||||
|
|
||||||
evtSource.addEventListener("data", (e) => {
|
evtSource.addEventListener("data", (e) => {
|
||||||
const data = JSON.parse(e.data);
|
const data = JSON.parse(e.data);
|
||||||
|
|
||||||
if (data.state == "tool_calling") {
|
if (data.state === "tool_calling") {
|
||||||
toolName.value = data.tool_call_message.name;
|
toolName.value = data.tool_call_message.name;
|
||||||
} else if (data.state == "tool_response") {
|
} else if (data.state === "tool_response") {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
toolName.value = "";
|
toolName.value = "";
|
||||||
}, 300);
|
}, 300);
|
||||||
@ -137,12 +137,12 @@ function streamChat(streamId: String) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// close
|
// close
|
||||||
evtSource.addEventListener("close", (e) => {
|
evtSource.addEventListener("close", () => {
|
||||||
evtSource.close();
|
evtSource.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let getMessages = () => {
|
const getMessages = () => {
|
||||||
api.ChatMessage.apiV1ChatsIdMessagesGet(chatId).then((res) => {
|
api.ChatMessage.apiV1ChatsIdMessagesGet(chatId).then((res) => {
|
||||||
messages.value = res.data;
|
messages.value = res.data;
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ const response = ref("");
|
|||||||
|
|
||||||
function greet() {
|
function greet() {
|
||||||
api.Ping.apiV1PingGet().then((res) => {
|
api.Ping.apiV1PingGet().then((res) => {
|
||||||
response.value = "用户 ID" + String(res.data.data?.userId) ?? "未登录";
|
response.value = "用户 ID" + String(res.data.data?.userId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -42,7 +42,7 @@ function createTool() {
|
|||||||
url: toolUrl.value,
|
url: toolUrl.value,
|
||||||
api_key: toolApiKey.value,
|
api_key: toolApiKey.value,
|
||||||
})
|
})
|
||||||
.then((r) => {
|
.then(() => {
|
||||||
router.push("/tools");
|
router.push("/tools");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<h3>工具</h3>
|
<h3>工具</h3>
|
||||||
|
|
||||||
<v-btn color="primary" @click="to('/tools/create')" class="mt-3 mb-3"
|
<v-btn class="mt-3 mb-3" color="primary" @click="to('/tools/create')"
|
||||||
>创建工具</v-btn
|
>创建工具</v-btn
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -6,15 +6,14 @@ import {
|
|||||||
PingApi,
|
PingApi,
|
||||||
ToolApi,
|
ToolApi,
|
||||||
} from "@/api";
|
} from "@/api";
|
||||||
import { useConfigStore } from "@/stores/config";
|
import config from "@/config/config";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
|
|
||||||
const configStore = useConfigStore();
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const conf = new Configuration();
|
const conf = new Configuration();
|
||||||
|
|
||||||
conf.basePath = configStore.backend;
|
conf.basePath = config.backend;
|
||||||
conf.apiKey = () => {
|
conf.apiKey = () => {
|
||||||
return "Bearer " + userStore.id_token;
|
return "Bearer " + userStore.id_token;
|
||||||
};
|
};
|
||||||
|
@ -2,14 +2,5 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
export const useConfigStore = defineStore("config", {
|
export const useConfigStore = defineStore("config", {
|
||||||
state: () => ({
|
state: () => ({}),
|
||||||
app_name: "Amber",
|
|
||||||
oauth_discovery_url:
|
|
||||||
"https://auth.leaflow.cn/.well-known/openid-configuration",
|
|
||||||
oauth_client_id: "14",
|
|
||||||
oauth_callback_url: "http://localhost:3000/auth/callback",
|
|
||||||
oauth_storage_key: "code_verifier",
|
|
||||||
oauth_scope: "openid profile",
|
|
||||||
backend: "http://localhost:8080",
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { useConfigStore } from "@/stores/config";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import config from "@/config/config";
|
||||||
|
|
||||||
let timer: any = null;
|
let timer: any = null;
|
||||||
|
|
||||||
@ -58,17 +58,15 @@ export const useUserStore = defineStore("user", {
|
|||||||
}, 10 * 1000);
|
}, 10 * 1000);
|
||||||
},
|
},
|
||||||
async refresh() {
|
async refresh() {
|
||||||
const configStore = useConfigStore();
|
const discovery = await axios.get(config.oauth_discovery_url);
|
||||||
|
|
||||||
const discovery = await axios.get(configStore.oauth_discovery_url);
|
|
||||||
|
|
||||||
// post /oauth/token to refresh
|
// post /oauth/token to refresh
|
||||||
// 构建 form 参数
|
// 构建 form 参数
|
||||||
const data = new URLSearchParams();
|
const data = new URLSearchParams();
|
||||||
data.set("grant_type", "refresh_token");
|
data.set("grant_type", "refresh_token");
|
||||||
data.set("refresh_token", this.refresh_token);
|
data.set("refresh_token", this.refresh_token);
|
||||||
data.set("client_id", configStore.oauth_client_id);
|
data.set("client_id", config.oauth_client_id);
|
||||||
data.set("scope", configStore.oauth_scope);
|
data.set("scope", config.oauth_scope);
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post(discovery.data.token_endpoint, data)
|
.post(discovery.data.token_endpoint, data)
|
||||||
|
2
src/typed-router.d.ts
vendored
2
src/typed-router.d.ts
vendored
@ -22,11 +22,9 @@ declare module 'vue-router/auto-routes' {
|
|||||||
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
'/assistants/': RouteRecordInfo<'/assistants/', '/assistants', Record<never, never>, Record<never, never>>,
|
||||||
'/assistants/[id]/chats': RouteRecordInfo<'/assistants/[id]/chats', '/assistants/:id/chats', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/assistants/[id]/chats': RouteRecordInfo<'/assistants/[id]/chats', '/assistants/:id/chats', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/assistants/[id]/tools': RouteRecordInfo<'/assistants/[id]/tools', '/assistants/:id/tools', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/assistants/[id]/tools': RouteRecordInfo<'/assistants/[id]/tools', '/assistants/:id/tools', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/assistants/binds': RouteRecordInfo<'/assistants/binds', '/assistants/binds', Record<never, never>, Record<never, never>>,
|
|
||||||
'/assistants/create': RouteRecordInfo<'/assistants/create', '/assistants/create', Record<never, never>, Record<never, never>>,
|
'/assistants/create': RouteRecordInfo<'/assistants/create', '/assistants/create', Record<never, never>, Record<never, never>>,
|
||||||
'/auth/callback': RouteRecordInfo<'/auth/callback', '/auth/callback', Record<never, never>, Record<never, never>>,
|
'/auth/callback': RouteRecordInfo<'/auth/callback', '/auth/callback', Record<never, never>, Record<never, never>>,
|
||||||
'/auth/login': RouteRecordInfo<'/auth/login', '/auth/login', Record<never, never>, Record<never, never>>,
|
'/auth/login': RouteRecordInfo<'/auth/login', '/auth/login', Record<never, never>, Record<never, never>>,
|
||||||
'/chats/': RouteRecordInfo<'/chats/', '/chats', Record<never, never>, Record<never, never>>,
|
|
||||||
'/chats/[id]/': RouteRecordInfo<'/chats/[id]/', '/chats/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
'/chats/[id]/': RouteRecordInfo<'/chats/[id]/', '/chats/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
|
||||||
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
'/ping/': RouteRecordInfo<'/ping/', '/ping', Record<never, never>, Record<never, never>>,
|
||||||
'/tools/': RouteRecordInfo<'/tools/', '/tools', Record<never, never>, Record<never, never>>,
|
'/tools/': RouteRecordInfo<'/tools/', '/tools', Record<never, never>, Record<never, never>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user