yangg 4 týždňov pred
rodič
commit
5f5bba6d65

+ 2 - 2
.env.development

@@ -1,3 +1,3 @@
 NODE_ENV=development
-VITE_BASE_AI_API=http://192.168.100.187:8082
-VITE_BASE_AI_F_API=http://192.168.100.101:8084
+VITE_BASE_AI_API=http://58.246.234.210:8082
+VITE_BASE_AI_F_API=http://58.246.234.210:8082

+ 2 - 2
.env.production

@@ -1,3 +1,3 @@
 NODE_ENV=production
-VITE_BASE_AI_API=https://ylaiapi.raycos.com.cn
-VITE_BASE_AI_F_API=http://183.195.216.54:8084
+VITE_BASE_AI_API=http://58.246.234.210:8082 #https://ylaiapi.raycos.com.cn
+VITE_BASE_AI_F_API=http://58.246.234.210:8082 #http://183.195.216.54:8084

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 1
dist/assets/index-B5bpwC9e.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/assets/login-CntJmW9o.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/assets/login-Cocy4XFJ.css


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/assets/report-BUQqrWsI.css


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/assets/report-CzxCtPQF.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 4
dist/assets/vendor-DxWLqeX3.js


+ 3 - 3
dist/index.html

@@ -4,9 +4,9 @@
     <meta charset="UTF-8" />
     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>Vite + Vue</title>
-    <script type="module" crossorigin src="/assets/index-B5bpwC9e.js"></script>
-    <link rel="modulepreload" crossorigin href="/assets/vendor-DxWLqeX3.js">
+    <title></title>
+    <script type="module" crossorigin src="/assets/index-B6pcXFaV.js"></script>
+    <link rel="modulepreload" crossorigin href="/assets/vendor-CtJFwJv-.js">
     <link rel="stylesheet" crossorigin href="/assets/index-CphMMiEx.css">
   </head>
   <body>

+ 8 - 0
src/api/report.js

@@ -33,4 +33,12 @@ export function getList (d) {
     }); */
 }
 
+export function multimodal (d) {
+    return axios({
+        url: `/api/chat/online/multimodal`,
+        method: 'post',
+        data: d
+    })
+}
+
 

+ 129 - 34
src/utils/request.js

@@ -3,7 +3,14 @@ import router from '@router/index.js'
 import store from '@store/index.js'
 import notification from 'ant-design-vue/es/notification'
 
-// 创建 axios 实例
+/**
+ * 创建 axios 实例
+ * baseURL: API 接口的基础 URL
+ * withCredentials: 跨域请求时是否需要携带 cookie
+ * timeout: 请求超时时间
+ * maxBodyLength: 请求体最大长度
+ * maxContentLength: 响应体最大长度
+ */
 const service = axios.create({
     baseURL: 'https://qlaiapi.raycos.com.cn', // api base_url
     withCredentials: true,
@@ -12,51 +19,139 @@ const service = axios.create({
     maxContentLength: 5242880,  // 响应的最大长度,单位 B ,5MB,针对文件或者表格数据大量返回 注意和nginx配置保持一致
 })
 
+/**
+ * 统一错误处理函数
+ * @param {Error} error - 错误对象
+ */
 const err = (error) => {
     if (error.response) {
         const data = error.response.data
-        if (error.response.status === 401) { // 登录失效
-            router.push({path: '/login'})
-        } else if (error.response.status === 402) {  // 缺少权限
-            notification.error({
-                message: '您没有权限查看当前信息',
-                description: '请联系管理员获取数据权限',
-                duration: null
-            })
-        } else if (error.response.status === 403) {
-            notification.error({
-                message: 'Forbidden',
-                description: data.message
-            })
-        } else if (error.response.status === 504) {  // 请求超时
-            notification.error({
-                message: '提示',
-                description: '请求时间较长,请稍后查看',
-                duration: null
-            });
-        } 
+        const status = error.response.status
+
+        // 错误状态码处理
+        const errorMap = {
+            400: {
+                message: '请求错误',
+                description: data.message || '请求参数异常'
+            },
+            401: {
+                message: '未授权',
+                description: '登录状态已过期,请重新登录',
+                callback: () => {
+                    router.push({path: '/login'})
+                }
+            },
+            402: {
+                message: '权限不足',
+                description: '请联系管理员获取数据权限'
+            },
+            403: {
+                message: '拒绝访问',
+                description: data.message || '无权限访问该资源'
+            },
+            404: {
+                message: '请求错误',
+                description: '请求的资源不存在'
+            },
+            408: {
+                message: '请求超时',
+                description: '请求超时,请稍后重试'
+            },
+            500: {
+                message: '服务器错误',
+                description: '服务器出现问题,请稍后重试'
+            },
+            504: {
+                message: '网关超时',
+                description: '请求时间较长,请稍后查看'
+            }
+        }
+
+        const errorInfo = errorMap[status] || {
+            message: `请求错误 ${status}`,
+            description: '未知错误,请联系技术支持'
+        }
+
+        notification.error({
+            message: errorInfo.message,
+            description: errorInfo.description,
+            duration: null
+        })
+
+        if (errorInfo.callback) {
+            errorInfo.callback()
+        }
+    } else if (error.request) {
+        // 请求已经发出,但没有收到响应
+        notification.error({
+            message: '网络异常',
+            description: '服务器无响应,请检查网络连接',
+            duration: null
+        })
     } else {
-        // 请求超时
+        // 请求配置发生的错误
         notification.error({
-            message: '提示',
-            description: '请求时间较长,请稍后查看',
+            message: '请求错误',
+            description: error.message || '请求发生错误,请稍后重试',
             duration: null
-        });
+        })
     }
     return Promise.reject(error)
 }
 
-// 请求拦截,设置token
-service.interceptors.request.use((config) => {
-    config.headers['Access-Token'] = store.state.app.token || ''
-    return config
-}, err)
+/**
+ * 请求拦截器
+ * 在请求发送之前做一些处理
+ */
+service.interceptors.request.use(
+    (config) => {
+        // 设置请求头中的token
+        const token = store.state.app.token
+        if (token) {
+            config.headers['Access-Token'] = token
+        }
+
+        // 处理 GET 请求参数
+        if (config.method === 'get') {
+            config.params = {
+                _t: Date.now(), // 添加时间戳防止缓存
+                ...config.params
+            }
+        }
 
-// 处理响应
-service.interceptors.response.use((response) => {
-    return response.data
-}, err)
+        return config
+    },
+    err
+)
+
+/**
+ * 响应拦截器
+ * 在接收到响应数据之后做一些处理
+ */
+service.interceptors.response.use(
+    (response) => {
+        const res = response.data
+
+        // 这里可以根据后端约定的状态码,做相应的处理
+        if (res.code === 200) {
+            return res
+        } else {
+            notification.error({
+                message: '请求失败',
+                description: res.message || '未知错误',
+                duration: 4
+            })
+            return Promise.reject(new Error(res.message || '未知错误'))
+        }
+    },
+    err
+)
 
+/**
+ * 封装请求方法
+ * @param {Object} options - axios 配置项
+ * @returns {Promise} axios 请求Promise
+ */
 function requests(options = {}) {
     return service.request({ ...options })
 }

+ 1 - 0
vite.config.js

@@ -21,6 +21,7 @@ export default defineConfig({
       '@assets': resolve('src/assets'),
     }
   },
+  assetsInclude: ['**/*.JPG'], // 添加对 .JPG 文件的支持
   build: {
     chunkSizeWarningLimit: 1500,
     rollupOptions: {

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov