yinbangzhong
2024-08-19 9650fe79e821c69c04bbc27ee32767f7c718a288
menu
4个文件已修改
26 ■■■■ 已修改文件
src/api/interceptor.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/session.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/components/smartAi.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sessionManager/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/interceptor.ts
@@ -9,6 +9,9 @@
  setToken,
} from '@/utils/auth';
export interface HttpResponse<T = unknown> {
  status: number;
  msg: string;
@@ -55,6 +58,11 @@
  (response: AxiosResponse<HttpResponse>) => {
    const res = response.data;
    // if the custom code is not 20000, it is judged as an error.
    if ( (res.retcode && res.retcode == 401) ||  (res.code && res.code == 401) || (res.code && res.code == 4006))
    {
      const userStore = useUserStore();
      userStore.logout();
    }
    if (
      (res.retcode && res.retcode !== 0) ||
      (res.code && res.code !== 20000 && res.code !== 200)
src/api/session.ts
@@ -20,8 +20,8 @@
}
// 新增会话
export function addSessionApi(params: any) {
  return axios.get<ISessionListResult>(
    '/api/getConId/kdwithai?platform=localragflow',
  return axios.post<ISessionListResult>(
    '/api/v1/conversation/set?platform=localragflow',
    { params }
  );
}
src/views/sessionManager/components/smartAi.vue
@@ -79,7 +79,7 @@
const DialogList = async () => {
  const { code, data } = await getDialogListApi();
  if (code === 200) {
    if (data) {
    if (data?.length>0) {
      selectValue.value = data[0].id;
      dialogs.value = data.map((item) => {
        return {
@@ -88,8 +88,9 @@
        };
      });
      // console.log(data, "dialogs");
      queryCanvas();
    }
    queryCanvas();
  }
};
src/views/sessionManager/index.vue
@@ -152,6 +152,7 @@
                <a-upload
                  ref="uploadRef"
                  :file-list="uploadList"
                  :disabled="loading1"
                  multiple
                  :custom-request="customRequest"
                          style="font-size: 24px;">
@@ -244,6 +245,7 @@
const dialogId = ref("");
const chatDis = ref(false);
const loading = ref(false);
const loading1= ref(false);
const agentType = ref("1");
const agentTitle = ref("未命名会话");
let chatObj = reactive({});
@@ -281,6 +283,7 @@
};
// 上传文件
const customRequest = async(option) => {
  loading1.value=true;
  const {onProgress, onError, onSuccess, fileItem, name} = option
  const { code, data } = await getSessionDetailsApi(activeSessionId.value);
@@ -289,13 +292,13 @@
    if (fileItem.file) {
      const formData = new FormData();
      formData.append('file', fileItem.file);
      formData.append('conversation_id', data.dialog_id);
      formData.append('conversation_id', data.id);
      uploadWithoutKb(formData).then((res) => {
        console.log(res);
        uploadList.value = [];
        if (res.code == 0) {
        if (res.code == 200) {
          console.log(res);
          loading1.value=false;
        }
      });
    }