zhangxiao
2024-08-09 7d0b7f478d812933b3dc3721095f7d5d8df44238
fix: 上传图片修改
10个文件已修改
212 ■■■■■ 已修改文件
.env.development 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.production 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/upload/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user/index.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user/types.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dmx/knowledgeLib/tool.vue 146 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dmx/model/components/addPageModel.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dmx/model/components/addTableName.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dmx/model/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/components/login-form.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -1,2 +1,2 @@
VUE_APP_BASE_API=/api/v1
VITE_API_BASE_URL= 'http://192.168.20.116:1080'
VITE_API_BASE_URL= 'http://192.168.20.158:1080'
.env.production
@@ -0,0 +1 @@
VUE_APP_BASE_API=/api/v1
src/components/upload/index.vue
@@ -11,6 +11,9 @@
<script setup>
  import { computed, ref, onMounted, watch, watchEffect } from 'vue';
  import { useUserStore } from '@/store';
  const userStore = useUserStore();
  const props = defineProps({
    limit: {
      type: Number,
@@ -50,6 +53,12 @@
        url: item,
      }));
    }
    // console.log(
    //   window.location.origin,
    //   import.meta.env.VITE_API_BASE_URL,
    //   8988
    // );
  });
  // console.log(urls.value, 8988);
src/store/modules/user/index.ts
@@ -30,6 +30,7 @@
    certification: undefined,
    role: '',
    resources:undefined,
    hrefUrl:undefined
  }),
  getters: {
@@ -67,6 +68,7 @@
    async login(loginForm: LoginData):string {
      try {
        const res = await userLogin(loginForm);
        setToken(res.data.access_token);
        const userInfo = {
          avatar: res.data.avatar,
@@ -101,6 +103,11 @@
        this.logoutCallBack();
      }
    },
    getHreFurl(url: string) {
      this.hrefUrl=url
    },
  },
});
src/store/modules/user/types.ts
@@ -17,4 +17,5 @@
  certification?: number;
  role: RoleType;
  resources:any;
  hrefUrl?: string;
}
src/views/dmx/knowledgeLib/tool.vue
@@ -41,14 +41,15 @@
              auto-label-width
              @submit="handleSubmit"
            >
              <a-divider style="margin-top: 10px"
                         v-if="
                form.parser_id === 'naive'" />
              <a-divider
                style="margin-top: 10px"
                v-if="form.parser_id === 'naive'"
              />
              <a-form-item
                field="slider"
                label="块Token数"
                v-if="
                form.parser_id === 'naive'">
                v-if="form.parser_id === 'naive'"
              >
                <a-slider
                  v-model="form.chunk_token_num"
                  :min="0"
@@ -56,18 +57,27 @@
                  show-input
                />
              </a-form-item>
              <a-divider style="margin-top: 10px"
                         v-if="form.parser_id === 'naive' ||
              <a-divider
                style="margin-top: 10px"
                v-if="
                  form.parser_id === 'naive' ||
                           form.parser_id === 'qa'||
                           form.parser_id === 'manual' ||
                           form.parser_id === 'laws' ||
                           form.parser_id === 'book'" />
              <a-form-item field="raptor" label="使用召回增强RAPTOR策略"
                           v-if="form.parser_id === 'naive' ||
                  form.parser_id === 'book'
                "
              />
              <a-form-item
                field="raptor"
                label="使用召回增强RAPTOR策略"
                v-if="
                  form.parser_id === 'naive' ||
                           form.parser_id === 'qa'||
                           form.parser_id === 'manual' ||
                           form.parser_id === 'laws' ||
                           form.parser_id === 'book'">
                  form.parser_id === 'book'
                "
              >
                <a-space direction="vertical" size="large">
                  <a-switch
                    v-model="form.use_raptor"
@@ -145,8 +155,7 @@
                    type="primary"
                    html-type="submit"
                  >确定
                  </a-button
                  >
                  </a-button>
                </div>
              </a-form-item>
            </a-form>
@@ -182,8 +191,7 @@
                  class="button"
                  style="margin-right: 10px"
                >批量
                  <icon-down style="margin-left: 4px"
                  />
                  <icon-down style="margin-left: 4px" />
                </a-button>
                <template #content>
                  <a-space direction="vertical">
@@ -272,8 +280,7 @@
                  class="button"
                  style="margin-right: 10px"
                >
                  <icon-sort
                  />
                  <icon-sort />
                </a-button>
                <template #content>
                  <a-radio-group
@@ -346,28 +353,29 @@
  reactive,
  ref,
  computed,
  watch
} from "vue";
import { Message } from "@arco-design/web-vue";
    watch,
  } from 'vue';
  import { Message } from '@arco-design/web-vue';
import {
  kbdocumentchangeparser,
  achunkCreate,
  queryChunkList,
  chunkSwitch,
  chunkRm, achunkGet
} from "@/api/kbList";
import addDetails from "@/views/dmx/knowledgeLib/addDetails.vue";
import eidtDetails from "@/views/dmx/knowledgeLib/eidtDetails.vue";
    chunkRm,
    achunkGet,
  } from '@/api/kbList';
  import addDetails from '@/views/dmx/knowledgeLib/addDetails.vue';
  import eidtDetails from '@/views/dmx/knowledgeLib/eidtDetails.vue';
const visible = ref(false);
const loading = ref(false);
const radio = ref("1");
const keyBg = ref("");
  const radio = ref('1');
  const keyBg = ref('');
const eidtDil = ref();
const eidtDilVisible = ref(false);
const eidtDilinfo = reactive({});
const props = defineProps(["kbtenantInfo", "item", "kbdetail"]);
  const props = defineProps(['kbtenantInfo', 'item', 'kbdetail']);
// const emit =  defineEmits(['upTabdateItem'])
let threshold = computed(() => {
@@ -376,11 +384,11 @@
const kbtenantInfo = props.kbtenantInfo;
let parser_ids = kbtenantInfo.parser_ids.split(",").map((item) => {
  const [value1, value2] = item.split(":");
  let parser_ids = kbtenantInfo.parser_ids.split(',').map((item) => {
    const [value1, value2] = item.split(':');
  return {
    name: value2,
    value: value1
      value: value1,
  };
});
@@ -394,17 +402,13 @@
  'book',
  'laws',
  'one',
]
  ];
const isBtn = ref(true);
const closeSlelct = () => {
  window.addEventListener("click", (event) => {
    if (!event.target.closest(".space_search") && !isBtn.value) {
    window.addEventListener('click', (event) => {
      if (!event.target.closest('.space_search') && !isBtn.value) {
      isBtn.value = true;
      // form.keywords = '';
    }
@@ -426,21 +430,21 @@
  random_seed: 1500,
  chunk_token_num: 128,
  use_raptor: false,
  keywords: "",
    keywords: '',
  pages: {},
  prompt:
    "请总结以下段落。 小心数字,不要编造。 段落如下:\n" +
    "      {cluster_content}\n" +
    "以上就是你需要总结的内容。"
      '请总结以下段落。 小心数字,不要编造。 段落如下:\n' +
      '      {cluster_content}\n' +
      '以上就是你需要总结的内容。',
});
const formRef = ref(null);
const rules = {
  prompt: [
    {
      required: true,
      message: "提示词不允许为空"
    }
  ]
        message: '提示词不允许为空',
      },
    ],
};
const listData = ref([]);
@@ -468,16 +472,16 @@
          max_token: form.max_token,
          threshold: form.threshold,
          max_cluster: form.max_cluster,
          random_seed: form.random_seed
            random_seed: form.random_seed,
        },
        chunk_token_num: form.chunk_token_num,
        pages: []
      }
          pages: [],
        },
    });
    if (data.code == 0) {
      Message.success("配置成功");
        Message.success('配置成功');
    } else {
      Message.error("配置失败");
        Message.error('配置失败');
    }
    visible.value = false;
  }
@@ -493,29 +497,26 @@
const contentClick = async (item) => {
  try {
    const data = await achunkGet({
      chunk_id: item.chunk_id
        chunk_id: item.chunk_id,
    });
    // console.log(data.data);
    Object.assign(eidtDilinfo, data.data);
    eidtDilVisible.value = true;
  } catch (error) {
    Message.error("获取失败");
      Message.error('获取失败');
  }
};
const handleOpened = (el) => {
  // console.log('props',props.kbtenantInfo);
  console.log('props',props.item);
  // console.log('props',props.kbdetail);
  console.log(parser_ids, "parser_ids");
    console.log(parser_ids, 'parser_ids');
  let parser_id = props.item.parser_id;
  parser_ids.forEach((item) => {
    if (item.name == parser_id) {
      form.parser_id = item.value;
    }
  });
  // Object.assign(form,{
  //   name: '',// 用户名
@@ -527,14 +528,13 @@
  console.log(props.item.id);
};
const onChangeRAPTOR = () => {
};
  const onChangeRAPTOR = () => {};
const indeterminate = ref(false);
const checkedAll = ref(false);
const data = ref([]);
const switchType = ref(false);
const available_int = ref("");
  const available_int = ref('');
const onRadioChange = () => {
  console.log(radio.value);
};
@@ -559,7 +559,7 @@
//批量启用删除禁用
const addBlock = (type) => {
  if (data.value.length == 0) {
    Message.error("请选择要操作的数据");
      Message.error('请选择要操作的数据');
    return;
  }
  if (type == 3) {
@@ -568,16 +568,16 @@
    let params = {
      chunk_ids: data.value,
      available_int: type,
      doc_id: props.item.id
        doc_id: props.item.id,
    };
    chunkSwitch(params).then((res) => {
      if (res.code == 0) {
        Message.success("操作成功");
          Message.success('操作成功');
        getList();
        checkedAll.value = false;
        data.value = [];
      } else {
        Message.error("操作失败");
          Message.error('操作失败');
      }
    });
  }
@@ -596,16 +596,16 @@
};
const isLoading = ref(true);
// 自定义加载提示文本
const tip = "加载中,请稍候...";
  const tip = '加载中,请稍候...';
//获取列表
const getList = async () => {
  let params = {
    doc_id: props.item.id,
    keywords: form.keywords,
    page: 1,
    size: 10000
      size: 10000,
  };
  if (available_int.value !== "") {
    if (available_int.value !== '') {
    params.available_int = available_int.value;
  }
  await queryChunkList(params).then((res) => {
@@ -629,15 +629,15 @@
  let params = {
    chunk_ids: [val.chunk_id],
    available_int: val.available_int,
    doc_id: props.item.id
      doc_id: props.item.id,
  };
  chunkSwitch(params).then((res) => {
    console.log(res);
    if (res.code == 0) {
      Message.success("更新成功");
        Message.success('更新成功');
      getList();
    } else {
      Message.error("更新失败");
        Message.error('更新失败');
    }
  });
};
@@ -646,15 +646,15 @@
const deleteChunk = () => {
  let params = {
    chunk_ids: data.value,
    doc_id: props.item.id
      doc_id: props.item.id,
  };
  chunkRm(params).then((res) => {
    console.log(res);
    if (res.code == 0) {
      Message.success("删除成功");
        Message.success('删除成功');
      getList();
    } else {
      Message.error("删除失败");
        Message.error('删除失败');
    }
  });
};
@@ -662,9 +662,7 @@
onBeforeMount(() => {
  getList();
});
onMounted(() => {
});
  onMounted(() => {});
</script>
<style scoped lang="less">
src/views/dmx/model/components/addPageModel.vue
@@ -137,6 +137,9 @@
  import { Modal, Message } from '@arco-design/web-vue';
  import message from '@arco-design/web-vue/es/message';
  import { resolveUnref } from '@vueuse/core';
  import { useUserStore } from '@/store';
  const userStore = useUserStore();
  const addPageModelVisible = defineModel('show');
  const loading = ref(false);
@@ -222,14 +225,20 @@
  const uploadAction = '/api/v1/llm/upload'; // 替换为你的上传API
  const fileList = ref([]);
  const imageUrls = ref([]);
  const uploadUrl = ref([]);
  const httpUrl = localStorage.getItem('httpUrl');
  const updateFileList = (newFileList) => {
    fileList.value = newFileList;
    console.log(newFileList, 88);
  };
  const handleSuccess = (urls) => {
    imageUrls.value = urls; // 拿到上传的图片地址
    uploadUrl.value = urls;
    const urlsArr = urls.map((url) => {
      return httpUrl + url;
    });
    imageUrls.value = urlsArr; // 拿到上传的图片地址
  };
  const emit = defineEmits(['refresh-parent']);
  const handleSubmit = ({ values, errors }) => {
@@ -250,7 +259,7 @@
              volc_sk: form.volc_sk,
              api_base: form.api_base,
              all_params: all_params,
              logo: imageUrls.value[0],
              logo: uploadUrl.value[0],
            });
            if ((data as any).code == 200) {
@@ -269,7 +278,7 @@
              volc_sk: form.volc_sk,
              api_base: form.api_base,
              all_params: all_params,
              logo: imageUrls.value[0],
              logo: uploadUrl.value[0],
            });
            if ((data as any).code == 200) {
@@ -361,7 +370,7 @@
      });
    }
    imageUrls.value.push(data.data.logo);
    imageUrls.value.push(httpUrl + data.data.logo);
  };
  watchEffect(() => {
src/views/dmx/model/components/addTableName.vue
@@ -70,6 +70,8 @@
  import { Message } from '@arco-design/web-vue';
  const addTabVisible = defineModel('tabShow');
  const httpUrl = localStorage.getItem('httpUrl');
  const loading = ref(false);
  const props = defineProps({
    task_id: {
@@ -123,7 +125,7 @@
            tags: form.tags,
            api_base: form.api_base,
            // all_params: all_params,
            logo: imageUrls.value[0],
            logo: uploadUrl.value[0],
          })
            .then((resData) => {
              if ((resData as any).code === 200) {
@@ -138,7 +140,7 @@
            tags: form.tags,
            api_base: form.api_base,
            // all_params: all_params,
            logo: imageUrls.value[0],
            logo: uploadUrl.value[0],
          })
            .then((resData) => {
              if ((resData as any).code === 200) {
@@ -166,13 +168,18 @@
  const uploadAction = '/api/v1/llm/upload'; // 替换为你的上传API
  const fileList = ref([]);
  const imageUrls = ref([]);
  const uploadUrl = ref([]);
  const updateFileList = (newFileList) => {
    fileList.value = newFileList;
  };
  const handleSuccess = (urls) => {
    imageUrls.value = urls; // 拿到上传的图片地址
    console.log(urls, 77777);
    uploadUrl.value = urls;
    const urlsArr = urls.map((url) => {
      return httpUrl + url;
    });
    imageUrls.value = urlsArr; // 拿到上传的图片地址
  };
  const handleOpened = (el) => {
src/views/dmx/model/index.vue
@@ -42,7 +42,7 @@
                                width: '100%',
                              }"
                              alt="暂无图片"
                              :src="item.logo"
                              :src="httpUrl + item.logo"
                            />
                          </div>
                          <a-card :bordered="false" hoverable>
@@ -83,7 +83,7 @@
                                width: '100%',
                              }"
                              alt="暂无图片"
                              :src="list.logo"
                              :src="httpUrl + list.logo"
                            />
                            <!--   src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a20012a2d4d5b9db43dfc6a01fe508c0.png~tplv-uwbnlip3yd-webp.webp" -->
                          </div>
@@ -174,7 +174,9 @@
    deleteLlmFactory,
  } from '@/api/model';
  import { Modal, Message } from '@arco-design/web-vue';
  import { useUserStore } from '@/store';
  const userStore = useUserStore();
  let count = 5;
  const activeKey = ref(1);
  const data = ref([
@@ -208,6 +210,8 @@
  const changeTabs = (val) => {
    tabKey.value = val;
  };
  const httpUrl = localStorage.getItem('httpUrl');
  const show = ref(false);
  const tabShow = ref(false);
  const title = ref('添加模式');
src/views/login/components/login-form.vue
@@ -112,6 +112,10 @@
            ...othersQuery,
          },
        });
        const url = window.location.origin;
        localStorage.setItem('httpUrl', url);
        userStore.getHreFurl(url);
        Message.success(t('登录成功'));
        const { rememberPassword } = loginConfig.value;
        const { email, password } = values;