zhangxiao
2024-08-14 dc3fb06f6d3253ddebf35fec2d805b1750086b01
src/views/dmx/model/components/addPageModel.vue
@@ -49,19 +49,27 @@
        <a-form-item field="name" label="API-Key">
          <a-input v-model="form.name" placeholder="API-Key" />
        </a-form-item>
        <!-- <a-form-item
        <!-- <a-form-item field="describe" label="Base-Url">
          <a-input v-model="form.name" placeholder="Base-Url" />
        </a-form-item> -->
        <a-form-item
          field="raptor"
          label="是否支持 Vision"
          v-if="form.model_type === 'chat'"
        >
          <a-switch v-model="form.raptor" />
        </a-form-item> -->
        </a-form-item>
        <a-form-item field="logo" label="模型图片">
          <a-space direction="vertical" :style="{ width: '100%' }">
          <a-space
            direction="vertical"
            v-model="form.logo"
            :style="{ width: '100%' }"
          >
            <Upload
              :action="uploadAction"
              :limit="1"
              :url="form.urlS"
              @handleRemove="deleteRemove"
              @update:fileList="updateFileList"
              @success="handleSuccess"
            ></Upload>
@@ -115,6 +123,7 @@
              :action="uploadAction"
              :limit="1"
              :url="form.urlS"
              @handleRemove="deleteRemove"
              @update:fileList="updateFileList"
              @success="handleSuccess"
            ></Upload>
@@ -223,6 +232,12 @@
        message: '请输入api_base',
      },
    ],
    logo: [
      {
        required: true,
        message: '模型图片不能为空',
      },
    ],
  };
  const uploadAction = '/api/v1/llm/upload'; // 替换为你的上传API
@@ -237,12 +252,19 @@
  const handleSuccess = (urls) => {
    uploadUrl.value = urls;
    form.logo = urls[0];
    const urlsArr = urls.map((url) => {
      return httpUrl + url;
    });
    imageUrls.value = urlsArr; // 拿到上传的图片地址
  };
  const deleteRemove = () => {
    form.logo = '';
    uploadUrl.value = [];
    imageUrls.value = [];
  };
  const emit = defineEmits(['refresh-parent']);
  const handleSubmit = ({ values, errors }) => {
    const all_params = form.addFomList.map((item) => {