diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 065333b..0d0304d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -69,8 +69,9 @@ jobs: tags: | # set latest tag for default branch type=raw,value=latest,enable={{is_default_branch}} - type=schedule,pattern=nightly - type=pep440,pattern={{version}} + type=edge,branch=dev + type=pep440,pattern={{major}}.{{minor}},enable={{is_default_branch}} + type=pep440,pattern={{version}},enable={{is_default_branch}} flavor: latest=false # Build and push Docker image with Buildx (don't push on PR) diff --git a/web/admin/src/api/interceptor.ts b/web/admin/src/api/interceptor.ts index 1d8214f..84712f2 100644 --- a/web/admin/src/api/interceptor.ts +++ b/web/admin/src/api/interceptor.ts @@ -5,10 +5,10 @@ import { useUserStore } from '@/store'; import { getToken } from '@/utils/auth'; export interface HttpResponse { - status: number; + status?: number; msg: string; code: number; - data: T; + data?: T; } if (import.meta.env.VITE_API_BASE_URL) { @@ -40,7 +40,7 @@ axios.interceptors.response.use( (response: AxiosResponse) => { const res = response.data; // if the custom code is not 20000, it is judged as an error. - if (res.code !== 20000) { + if (res.code !== 0) { Message.error({ content: res.msg || 'Error', duration: 5 * 1000, diff --git a/web/admin/src/api/user.ts b/web/admin/src/api/user.ts index 35b8812..397857a 100644 --- a/web/admin/src/api/user.ts +++ b/web/admin/src/api/user.ts @@ -11,7 +11,7 @@ export interface LoginRes { token: string; } export function login(data: LoginData) { - return axios.post('/api/user/login', data); + return axios.post('/api/login', data); } export function logout() { diff --git a/web/admin/src/mock/user.ts b/web/admin/src/mock/user.ts index 02920d1..200eb4d 100644 --- a/web/admin/src/mock/user.ts +++ b/web/admin/src/mock/user.ts @@ -39,67 +39,67 @@ setupMock({ }); // 登录 - Mock.mock(new RegExp('/api/user/login'), (params: MockParams) => { - const { username, password } = JSON.parse(params.body); - if (!username) { - return failResponseWrap(null, '用户名不能为空', 50000); - } - if (!password) { - return failResponseWrap(null, '密码不能为空', 50000); - } - if (username === 'admin' && password === 'admin') { - window.localStorage.setItem('userRole', 'admin'); - return successResponseWrap({ - token: '12345', - }); - } - if (username === 'user' && password === 'user') { - window.localStorage.setItem('userRole', 'user'); - return successResponseWrap({ - token: '54321', - }); - } - return failResponseWrap(null, '账号或者密码错误', 50000); - }); - - // 登出 - Mock.mock(new RegExp('/api/user/logout'), () => { - return successResponseWrap(null); - }); - - // 用户的服务端菜单 - Mock.mock(new RegExp('/api/user/menu'), () => { - const menuList = [ - { - path: '/dashboard', - name: 'dashboard', - meta: { - locale: 'menu.server.dashboard', - requiresAuth: true, - icon: 'icon-dashboard', - order: 1, - }, - children: [ - { - path: 'workplace', - name: 'Workplace', - meta: { - locale: 'menu.server.workplace', - requiresAuth: true, - }, - }, - { - path: 'https://arco.design', - name: 'arcoWebsite', - meta: { - locale: 'menu.arcoWebsite', - requiresAuth: true, - }, - }, - ], - }, - ]; - return successResponseWrap(menuList); - }); + // Mock.mock(new RegExp('/api/user/login'), (params: MockParams) => { + // const { username, password } = JSON.parse(params.body); + // if (!username) { + // return failResponseWrap(null, '用户名不能为空', 50000); + // } + // if (!password) { + // return failResponseWrap(null, '密码不能为空', 50000); + // } + // if (username === 'admin' && password === 'admin') { + // window.localStorage.setItem('userRole', 'admin'); + // return successResponseWrap({ + // token: '12345', + // }); + // } + // if (username === 'user' && password === 'user') { + // window.localStorage.setItem('userRole', 'user'); + // return successResponseWrap({ + // token: '54321', + // }); + // } + // return failResponseWrap(null, '账号或者密码错误', 50000); + // }); + // + // // 登出 + // Mock.mock(new RegExp('/api/user/logout'), () => { + // return successResponseWrap(null); + // }); + // + // // 用户的服务端菜单 + // Mock.mock(new RegExp('/api/user/menu'), () => { + // const menuList = [ + // { + // path: '/dashboard', + // name: 'dashboard', + // meta: { + // locale: 'menu.server.dashboard', + // requiresAuth: true, + // icon: 'icon-dashboard', + // order: 1, + // }, + // children: [ + // { + // path: 'workplace', + // name: 'Workplace', + // meta: { + // locale: 'menu.server.workplace', + // requiresAuth: true, + // }, + // }, + // { + // path: 'https://arco.design', + // name: 'arcoWebsite', + // meta: { + // locale: 'menu.arcoWebsite', + // requiresAuth: true, + // }, + // }, + // ], + // }, + // ]; + // return successResponseWrap(menuList); + // }); }, }); diff --git a/web/admin/src/utils/setup-mock.ts b/web/admin/src/utils/setup-mock.ts index 257da5d..151836e 100644 --- a/web/admin/src/utils/setup-mock.ts +++ b/web/admin/src/utils/setup-mock.ts @@ -9,7 +9,7 @@ export const successResponseWrap = (data: unknown) => { data, status: 'ok', msg: '请求成功', - code: 20000, + code: 0, }; }; diff --git a/web/admin/src/views/dashboard/llm-debug/llm-debug.vue b/web/admin/src/views/dashboard/llm-debug/llm-debug.vue index 7d0d848..e18acaf 100644 --- a/web/admin/src/views/dashboard/llm-debug/llm-debug.vue +++ b/web/admin/src/views/dashboard/llm-debug/llm-debug.vue @@ -1,21 +1,25 @@