diff --git a/env.d.ts b/env.d.ts index fe3b51289196b4bdb1f96367a6d7b7201a711f8d..ad8d6d5a42450984ab946b880909b2956d9d1a92 100644 --- a/env.d.ts +++ b/env.d.ts @@ -9,7 +9,7 @@ // See the Mulan PSL v2 for more details. /// declare interface Window { - onHtmlEventDispatch: (); + onHtmlEventDispatch: any; } declare interface ImportMetaEnv { diff --git a/eslint.config.js b/eslint.config.js index 2d403f63a75454cd8fa6a4ae3db3da10088cf149..26ecd885b0f9f1eb2fec2eb741b576c7dfa2858f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,15 +1,24 @@ -import globals from "globals"; -import pluginJs from "@eslint/js"; -import tseslint from "typescript-eslint"; -import pluginVue from "eslint-plugin-vue"; - +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import pluginVue from 'eslint-plugin-vue'; /** @type {import('eslint').Linter.Config[]} */ export default [ - {files: ["**/*.{js,mjs,cjs,ts,vue}"]}, - {languageOptions: { globals: globals.browser }}, + { files: ['**/*.{js,mjs,cjs,ts,vue}'] }, + { + ignores: [ + '**/node_modules/**', // 忽略 node_modules 目录 + '**/dist/**', // 忽略 dist 目录 + '**/.git/**', + ], + }, + { languageOptions: { globals: globals.browser } }, pluginJs.configs.recommended, ...tseslint.configs.recommended, - ...pluginVue.configs["flat/essential"], - {files: ["**/*.vue"], languageOptions: {parserOptions: {parser: tseslint.parser}}}, -]; \ No newline at end of file + ...pluginVue.configs['flat/essential'], + { + files: ['**/*.vue'], + languageOptions: { parserOptions: { parser: tseslint.parser } }, + }, +]; diff --git a/package.json b/package.json index cf068f3d735e55eee6d91ce206f3ebcf169bd085..6fdca229b841011f2fd950283fb912dcf398376c 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,9 @@ "build": "vite build", "build:micro": "vite build --mode micro", "preview": "vite preview", - "lint": "eslint . --fix --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore", - "format": "prettier --write src/" + "lint": "eslint . --fix", + "format": "prettier --write src/", + "type-check": "tsc --noEmit" }, "engines": { "node": ">= 18.18.2" diff --git a/shims-vue.d.ts b/shims-vue.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6769564efcc807143034f9476c05edcfecafdeef --- /dev/null +++ b/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + const component: DefineComponent<{}, {}, any>; + export default component; + } \ No newline at end of file diff --git a/src/apis/paths/apikey.ts b/src/apis/paths/apikey.ts index ac2cdb92720bcf79877d9414a6d918fa3060ea1f..3848437900e7ba0429072e64cb88e7495d548d82 100644 --- a/src/apis/paths/apikey.ts +++ b/src/apis/paths/apikey.ts @@ -14,7 +14,9 @@ import type { FcResponse } from 'src/apis/server'; * 验证用户信息 * @returns */ -export const getApiKey = (): Promise<[any, FcResponse<{}> | undefined]> => { +export const getApiKey = (): Promise<[any, FcResponse<{ + api_key: string; +}> | undefined]> => { return get('/api/auth/key'); }; @@ -25,7 +27,7 @@ export const getApiKey = (): Promise<[any, FcResponse<{}> | undefined]> => { export const changeApiKey = (params: { action: string; query?: string; -}): Promise<[any, FcResponse<{}> | undefined]> => { +}): Promise<[any, FcResponse | undefined]> => { return post('/api/auth/key', params, params); }; diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 5989189e578dc21b5da133c90aec4157e0e8678b..08a052f29ad1e973398990f887a95322e3828aac 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -21,9 +21,7 @@ export const stopGeneration = (): Promise< [ any, ( - | FcResponse<{ - // conversationId: string; - }> + | FcResponse | undefined ), ] diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index b4d1ce0991c9c3aac33d7375dc959e01a7efeb61..54e012e930d4216e6f6e7aad6a1dc37480badfda 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -56,6 +56,8 @@ export interface ConversationRecord { flow: Flow; content: Content; metadata: Metadata; + is_like?: boolean; + created_at: string; } // 定义对话内问答列表数据结构 diff --git a/src/apis/server.ts b/src/apis/server.ts index 16a5c1f9e9359a5d14cc48464c4c3a5c0b18e2b1..e185043e8c7cbb93390bb2b920c89cf6661ebd1d 100644 --- a/src/apis/server.ts +++ b/src/apis/server.ts @@ -73,7 +73,8 @@ server.interceptors.response.use( if (error.status !== 401 && error.status !== 403) { ElMessage({ showClose: true, - message: error?.response?.data?.message || error.message, + message: + ((error as any)?.response?.data?.message as string) || error.message, icon: IconError, customClass: 'o-message--error', duration: 3000, diff --git a/src/apis/tools.ts b/src/apis/tools.ts index 81f85f83bde3b22dc767cbecce5a0b9df4eae795..ad08b016a804ea3cbf9beacb3dd8ee7a403cca9e 100644 --- a/src/apis/tools.ts +++ b/src/apis/tools.ts @@ -25,7 +25,7 @@ import i18n from 'src/i18n'; import { errorMsg } from 'src/components/Message'; function getCookie(name: string) { - let matches = document.cookie.match( + const matches = document.cookie.match( new RegExp( '(?:^|; )' + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + @@ -182,12 +182,12 @@ export const handleStatusError = async ( return; } const originalRequest = error.config; - if (originalRequest.url === '/api/auth/refresh_token') { + if (originalRequest && originalRequest.url === '/api/auth/refresh_token') { // 长token过期,需要重新登录 handleAuthorize(status); return Promise.reject(error.response); } - if (originalRequest.url === '/api/auth/user') { + if (originalRequest && originalRequest.url === '/api/auth/user') { handleAuthorize(status); return; } diff --git a/src/assets/styles/theme.scss b/src/assets/styles/theme.scss index 5748a4d123f90cf35b5ee9b5c08a6d2ef24ef230..023c636b17439230b4fb4eb16d745bafcd663c0b 100644 --- a/src/assets/styles/theme.scss +++ b/src/assets/styles/theme.scss @@ -155,5 +155,6 @@ body { } .el-select-dropdown__item.is-selected { background-color: #6395fd !important; + font-weight: normal !important; } } diff --git a/src/components/Message.ts b/src/components/Message.ts index 13a8825a88002bd57be771a6996eda6deb82cd97..8224124d88e4865d71d3a63516d1b0941d85b702 100644 --- a/src/components/Message.ts +++ b/src/components/Message.ts @@ -14,7 +14,7 @@ export const successMsg = (msgInfo: string) => { // customClass:"el-message--success", type: 'success', // showClose:true, - class: 'el-message--success', + // class: 'el-message--success', message: msgInfo, }); }; @@ -22,7 +22,7 @@ export const warningMsg = (msgInfo: string) => { ElMessage({ type: 'warning', // showClose:true, - class: 'el-message--warning', + // class: 'el-message--warning', message: msgInfo, }); }; @@ -31,7 +31,7 @@ export const errorMsg = (msgInfo: string) => { ElMessage({ type: 'error', // showClose:true, - class: 'el-message--error', + // class: 'el-message--error', message: msgInfo, }); }; diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue index 9ac014d8a37cd903ed4febc08383d7ce39cf4fcd..a2927150432539b6a06699a13c50b9fcf5955f86 100644 --- a/src/components/Upload/index.vue +++ b/src/components/Upload/index.vue @@ -162,17 +162,8 @@ const beforeUpload = async (file: ElFile) => { } }; -const beforeUploadPromise = (fileWrapper: { file: File }): Promise => { - return new Promise((resolve, reject) => { - // ...(上面的异步逻辑,但在最后调用 resolve(true) 或 reject(false)) - }); -}; -// 上传进度 -const handleProgress = (event: ElUploadProgressEvent) => { - progressVal.value = event.percent; -}; // 上传完成 -const handleSuccess = (res: ElUploadProgressEvent, file: UploadFile) => { +const handleSuccess = () => { uploadDone.value = true; progressVal.value = 0; }; @@ -219,7 +210,7 @@ watch(getServiceYaml, () => { }); watch( () => themeStore.theme, - (newVal) => { + () => { if (themeStore.theme === 'dark') { extensions.value = [yaml(), oneDark]; } else { diff --git a/src/components/commonFooter/CommonFooter.vue b/src/components/commonFooter/CommonFooter.vue index 5697da9f7811b3dc47067df625039c6e41975e56..a02803d46760a9573594a2377db3aa29998b95ca 100644 --- a/src/components/commonFooter/CommonFooter.vue +++ b/src/components/commonFooter/CommonFooter.vue @@ -1,6 +1,5 @@