SanHQin 2 ヶ月 前
コミット
9aa130b11e

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
       width: 100%;
       background: #e6eaf0;
       font-family: '黑体';
-    }</style><link href=./static/css/app.f6a23d13bf8d583d15c69b9f271e7180.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.161e82026ac2ae03ab6f.js></script><script type=text/javascript src=./static/js/vendor.bb486323f0fa002ba2e7.js></script><script type=text/javascript src=./static/js/app.d3aa6c9e05f8d8364e4c.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.aa3f8e8da0cde4153982ba0d471e57d8.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.161e82026ac2ae03ab6f.js></script><script type=text/javascript src=./static/js/vendor.bb486323f0fa002ba2e7.js></script><script type=text/javascript src=./static/js/app.6e80b74cda92813e1c4c.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.aa3f8e8da0cde4153982ba0d471e57d8.css


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.aa3f8e8da0cde4153982ba0d471e57d8.css.map


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.6e80b74cda92813e1c4c.js


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.6e80b74cda92813e1c4c.js.map


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/manifest.161e82026ac2ae03ab6f.js.map


+ 111 - 99
src/common/axios.config.js

@@ -11,128 +11,140 @@ let cancel; // 用于存储取消请求的方法
 
 //POST传参序列化(添加请求拦截器)
 axios.interceptors.request.use((config) => {
-    //在发送请求之前做某件事
-    let token = sessionStorage.getItem('access_token') || ""  //获取token
-    if (token != "") {
-        config.headers = {
-            'access-token': token,
-            'Content-Type': 'application/x-www-form-urlencoded'
-        }
+  //在发送请求之前做某件事
+  let token = sessionStorage.getItem('access_token') || ""  //获取token
+  if (token != "") {
+    config.headers = {
+      'access-token': token,
+      'Content-Type': 'application/x-www-form-urlencoded'
     }
-    // if (config.data && config.data[0].post == '1' && config.method === 'post') {
-    //     // config.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
-    //     // config.data = config.data//序列化post 参数
-    //     config.data = 'mode=' + (Object.values(config.data[0]).join(','))//序列化post 参数
-    // } else if (config.method === 'post') {
-    //     config.data = qs.stringify(config.data)//序列化post 参数
-    // }
-    if (config.url === 'https://gpt.cocorobo.cn/search_image' || config.url === 'https://gpt.cocorobo.cn/chat' || config.url === 'https://gpt4.cocorobo.cn/create_free_assistants' || config.url === 'https://gpt4.cocorobo.cn/assistants_completion_response') {
-        config.data = config.data//序列化post 参数
-    } else if (config.url.indexOf('https://r2rserver.cocorobo.cn') != -1) {
-        config.headers = {
-            'Content-Type': 'application/json',
-        }
-    } else if (config.url.indexOf('https://gpt4.cocorobo.cn/') != -1 || config.url.indexOf('https://claude3.cocorobo.cn/') != -1 || config.url.indexOf('llm.cocorobo.cn/') != -1 || config.url.indexOf('https://appapi.cocorobo.cn/')!=-1 || config.url.indexOf('https://dify.cocorobo.cn')!=-1) {
-        config.headers = {
-            'Content-Type': 'application/json',
-        }
-    } else if (config.data && config.data[0].post == '1' && config.method === 'post') {
-        config.data = 'mode=' + (Object.values(config.data[0]).join(','))//序列化post 参数
-    } else if (config.method === 'post') {
+  }
+  // if (config.data && config.data[0].post == '1' && config.method === 'post') {
+  //     // config.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
+  //     // config.data = config.data//序列化post 参数
+  //     config.data = 'mode=' + (Object.values(config.data[0]).join(','))//序列化post 参数
+  // } else if (config.method === 'post') {
+  //     config.data = qs.stringify(config.data)//序列化post 参数
+  // }
+  if (config.url === 'https://gpt.cocorobo.cn/search_image' || config.url === 'https://gpt.cocorobo.cn/chat' || config.url === 'https://gpt4.cocorobo.cn/create_free_assistants' || config.url === 'https://gpt4.cocorobo.cn/assistants_completion_response') {
+    config.data = config.data//序列化post 参数
+  } else if (config.url.indexOf('https://r2rserver.cocorobo.cn') != -1) {
+    config.headers = {
+      'Content-Type': 'application/json',
+    }
+  } else if (config.url.indexOf('https://gpt4.cocorobo.cn/') != -1 || config.url.indexOf('https://claude3.cocorobo.cn/') != -1 || config.url.indexOf('llm.cocorobo.cn/') != -1 || config.url.indexOf('https://appapi.cocorobo.cn/') != -1) {
+    config.headers = {
+      'Content-Type': 'application/json',
+    }
+  } else if (config.url.indexOf('https://dify.cocorobo.cn') != -1) {
+    if (config.url.indexOf('?key=role') != -1) {
+      config.headers = {
+        Authorization: `Bearer app-TonzLPv7rPG0EtnFKszOWjwt`,
+        "Content-Type": "application/json"
+      }
+    } else if (config.url.indexOf('?key=code') != -1) {
+      config.headers = {
+        Authorization: `Bearer app-zOMxBqyEKoJSvW10e5SS0kgj`,
+        "Content-Type": "application/json"
+      }
+    }
+  } else if (config.data && config.data[0].post == '1' && config.method === 'post') {
+    config.data = 'mode=' + (Object.values(config.data[0]).join(','))//序列化post 参数
+  } else if (config.method === 'post') {
 
-        const encoded = {};
-        for (const key in config.data[0]) {
-            if (Object.hasOwnProperty.call(config.data[0], key)) {
-                encoded[key] = encodeURIComponent(config.data[0][key]);
-            }
-        }
-        config.data = qs.stringify([encoded]) //序列化post 参数
-    } else {
-        const encoded = {};
-        for (const key in config.data) {
-            if (Object.hasOwnProperty.call(config.data, key)) {
-                encoded[key] = encodeURIComponent(config.data[key]);
-            }
-        }
-        config.data = encoded
+    const encoded = {};
+    for (const key in config.data[0]) {
+      if (Object.hasOwnProperty.call(config.data[0], key)) {
+        encoded[key] = encodeURIComponent(config.data[0][key]);
+      }
+    }
+    config.data = qs.stringify([encoded]) //序列化post 参数
+  } else {
+    const encoded = {};
+    for (const key in config.data) {
+      if (Object.hasOwnProperty.call(config.data, key)) {
+        encoded[key] = encodeURIComponent(config.data[key]);
+      }
     }
+    config.data = encoded
+  }
 
-    return config;
+  return config;
 }, (error) => {
-    console.log('错误的传参')
+  console.log('错误的传参')
 
-    return Promise.reject(error);
+  return Promise.reject(error);
 });
 //返回状态判断(添加响应拦截器)
 axios.interceptors.response.use((res) => {
-    //对响应数据做些事
-    if (!res.data.success) {
-        let newToken = res.data.token    //成功后更新token
-        localStorage.setItem('access_token', newToken)
+  //对响应数据做些事
+  if (!res.data.success) {
+    let newToken = res.data.token    //成功后更新token
+    localStorage.setItem('access_token', newToken)
 
-    }
-    return res;
+  }
+  return res;
 }, (error) => {
-    if (axios.isCancel(error)) {
-        console.log('请求已取消', error.message);
-    } else if (error.response.data.status == '401') {    //如果token 过期 则跳转到登录页面
-        this.$router.push('/login');
-    }
-    return Promise.reject(error);
+  if (axios.isCancel(error)) {
+    console.log('请求已取消', error.message);
+  } else if (error.response.data.status == '401') {    //如果token 过期 则跳转到登录页面
+    this.$router.push('/login');
+  }
+  return Promise.reject(error);
 });
 //返回一个Promise(发送post请求)
 function post(url, params, source) {
-    return new Promise((resolve, reject) => {
-        axios.post(url, params, source ? { cancelToken: source.token } : '')
-            .then(response => {
-                resolve(response);
-            }, err => {
-                reject(err);
-            })
-            .catch((error) => {
-                reject(error)
-            })
-    })
+  return new Promise((resolve, reject) => {
+    axios.post(url, params, source ? { cancelToken: source.token } : '')
+      .then(response => {
+        resolve(response);
+      }, err => {
+        reject(err);
+      })
+      .catch((error) => {
+        reject(error)
+      })
+  })
 }
 
 //返回一个Promise(发送put请求)
 function put(url, params, source) {
-    return new Promise((resolve, reject) => {
-        axios.put(url, params, source ? { cancelToken: source.token } : '')
-            .then(response => {
-                resolve(response);
-            }, err => {
-                reject(err);
-            })
-            .catch((error) => {
-                reject(error)
-            })
-    })
+  return new Promise((resolve, reject) => {
+    axios.put(url, params, source ? { cancelToken: source.token } : '')
+      .then(response => {
+        resolve(response);
+      }, err => {
+        reject(err);
+      })
+      .catch((error) => {
+        reject(error)
+      })
+  })
 }
 
 
 ////返回一个Promise(发送get请求)
 function get(url, param, source) {
-    return new Promise((resolve, reject) => {
-        let cancelToken = source ? source.token : ''
-        axios.get(url, { params: param, cancelToken  })
-            .then(response => {
-                resolve(response)
-            }, err => {
-                reject(err)
-            })
-            .catch((error) => {
-                reject(error)
-            })
-    })
+  return new Promise((resolve, reject) => {
+    let cancelToken = source ? source.token : ''
+    axios.get(url, { params: param, cancelToken })
+      .then(response => {
+        resolve(response)
+      }, err => {
+        reject(err)
+      })
+      .catch((error) => {
+        reject(error)
+      })
+  })
 }
 export default {
-    get,
-    post,
-    put,
-    setCancelSource: () => {
-        // 每次创建新的请求时,可以调用此方法以创建新的取消令牌
-        cancel = CancelToken.source();
-        return cancel;
-    }
+  get,
+  post,
+  put,
+  setCancelSource: () => {
+    // 每次创建新的请求时,可以调用此方法以创建新的取消令牌
+    cancel = CancelToken.source();
+    return cancel;
+  }
 }

+ 28 - 60
src/components/pages/classroomObservation/components/chatArea.vue

@@ -1718,67 +1718,35 @@ ${JSON.stringify(_list)}
                 user: _this.userId
               };
               _getRoleLoading = true;
-              const config = {
-                headers: {
-                  Authorization: `Bearer app-TonzLPv7rPG0EtnFKszOWjwt`,
-                  "Content-Type": "application/json"
-                }
-              };
-              // _this.ajax
-              //   .post("https://dify.cocorobo.cn/v1/workflows/run", params)
-              //   .then(res => {
-              //     let _runData = res.data;
-              //     let _runResult = _runData.outputs.result;
-              //     _runResult.forEach((txt, index) => {
-              //       let _oldRole = _getRoleList[index].role;
-              //       if (!_roleList[_oldRole]) {
-              //         _roleList[_oldRole] = txt;
-              //       }
-              //     });
-              //     // 去除内容
-              //     _getRoleList.splice(0, _runResult.length);
-              //     let _indexList = [];
-              //     _getRoleList.forEach((i, index) => {
-              //       if (_roleList[i.role]) {
-              //         textList[i.index].role = _roleList[i.role];
-              //         _indexList.push(index);
-              //       }
-              //     });
-              //     _getRoleList = _getRoleList.filter(
-              //       (item, index) => !_indexList.includes(index)
-              //     );
-              //     _getRoleLoading = false;
-              //   })
-              //   .catch(err => {
-              //     console.log("获取说话人编码失败", err);
-              //     _getRoleLoading = false;
-              //   });
-              fetch("https://dify.cocorobo.cn/v1/workflows/run", {
-                method: "POST",
-                body: JSON.stringify(params),
-                ...config
-              }).then(res => {
-                let _runResult = res.outputs.result;
-                _runResult.forEach((txt, index) => {
-                  let _oldRole = _getRoleList[index].role;
-                  if (!_roleList[_oldRole]) {
-                    _roleList[_oldRole] = txt;
-                  }
-                });
-                // 去除内容
-                _getRoleList.splice(0, _runResult.length);
-                let _indexList = [];
-                _getRoleList.forEach((i, index) => {
-                  if (_roleList[i.role]) {
-                    textList[i.index].role = _roleList[i.role];
-                    _indexList.push(index);
-                  }
+              _this.ajax
+                .post("https://dify.cocorobo.cn/v1/workflows/run?key=role", params)
+                .then(res => {
+                  let _runData = res.data;
+                  let _runResult = _runData.outputs.result;
+                  _runResult.forEach((txt, index) => {
+                    let _oldRole = _getRoleList[index].role;
+                    if (!_roleList[_oldRole]) {
+                      _roleList[_oldRole] = txt;
+                    }
+                  });
+                  // 去除内容
+                  _getRoleList.splice(0, _runResult.length);
+                  let _indexList = [];
+                  _getRoleList.forEach((i, index) => {
+                    if (_roleList[i.role]) {
+                      textList[i.index].role = _roleList[i.role];
+                      _indexList.push(index);
+                    }
+                  });
+                  _getRoleList = _getRoleList.filter(
+                    (item, index) => !_indexList.includes(index)
+                  );
+                  _getRoleLoading = false;
+                })
+                .catch(err => {
+                  console.log("获取说话人编码失败", err);
+                  _getRoleLoading = false;
                 });
-                _getRoleList = _getRoleList.filter(
-                  (item, index) => !_indexList.includes(index)
-                );
-                _getRoleLoading = false;
-              });
             } catch (error) {
               console.log("说话人编码失败", error);
             }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません