| | |
| | | :style="{ width: '90%', margin: '0 auto' }" |
| | | layout="vertical" |
| | | > |
| | | <a-form-item field="name" label="模型名称"> |
| | | <a-input v-model="form.name" placeholder="请输入模型名称" /> |
| | | <a-form-item field="name" label="模型框架"> |
| | | <!-- <a-input v-model="form.name" placeholder="请输入模型名称" /> --> |
| | | <a-select |
| | | v-model="form.name" |
| | | placeholder="请选择模型框架" |
| | | allow-create |
| | | allow-search |
| | | > |
| | | <a-option |
| | | v-for="(item, index) in modalList" |
| | | :value="item.name" |
| | | :label="item.name" |
| | | :disabled="item.added" |
| | | ></a-option> |
| | | </a-select> |
| | | </a-form-item> |
| | | <!-- <a-form-item field="apiKey" label="API-Key"> |
| | | <a-input v-model="form.apiKey" placeholder="API-Key" /> |
| | |
| | | <a-textarea |
| | | v-model="form.tags" |
| | | placeholder="请输入模型描述" |
| | | :max-length="50" |
| | | allow-clear |
| | | /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item field="section" label="模型图片"> |
| | | <a-space direction="vertical" :style="{ width: '100%' }"> |
| | | <a-form-item field="logo" label="模型图片"> |
| | | <a-space |
| | | v-model="form.logo" |
| | | direction="vertical" |
| | | :style="{ width: '100%' }" |
| | | > |
| | | <Upload |
| | | :action="uploadAction" |
| | | :limit="1" |
| | | :url="form.urlS" |
| | | @handleRemove="deleteRemove" |
| | | @update:fileList="updateFileList" |
| | | @success="handleSuccess" |
| | | ></Upload> |
| | |
| | | ref, |
| | | computed, |
| | | } from 'vue'; |
| | | import { addLlmFactory, getLlmDetail, editLlmFactory } from '@/api/model'; |
| | | import { |
| | | getFactories, |
| | | addLlmFactory, |
| | | getLlmDetail, |
| | | editLlmFactory, |
| | | } from '@/api/model'; |
| | | |
| | | import { Message } from '@arco-design/web-vue'; |
| | | import { userModelState } from '@/store'; |
| | | |
| | |
| | | name: [ |
| | | { |
| | | required: true, |
| | | message: '名称不允许为空', |
| | | message: '模型框架不允许为空', |
| | | }, |
| | | ], |
| | | describe: [ |
| | | tags: [ |
| | | { |
| | | required: true, |
| | | message: '描述不允许为空', |
| | | }, |
| | | ], |
| | | logo: [ |
| | | { |
| | | required: true, |
| | | message: '模型图片不能为空', |
| | | }, |
| | | ], |
| | | }; |
| | |
| | | }) |
| | | .then((resData) => { |
| | | if ((resData as any).code === 200) { |
| | | emit('refresh-parent'); |
| | | emit('refresh-parent',form.name); |
| | | addTabVisible.value = false; |
| | | } |
| | | }) |
| | |
| | | }) |
| | | .then((resData) => { |
| | | if ((resData as any).code === 200) { |
| | | emit('refresh-parent'); |
| | | emit('refresh-parent', form.name); |
| | | addTabVisible.value = false; |
| | | Message.success('添加成功'); |
| | | } |
| | |
| | | fileList.value = newFileList; |
| | | }; |
| | | |
| | | const deleteRemove = () => { |
| | | form.logo = ''; |
| | | uploadUrl.value = []; |
| | | imageUrls.value = []; |
| | | }; |
| | | |
| | | const handleSuccess = (urls) => { |
| | | uploadUrl.value = urls; |
| | | form.logo = urls[0]; |
| | | |
| | | const urlsArr = urls.map((url) => { |
| | | return httpUrl + url; |
| | |
| | | }); |
| | | formRef.value?.resetFields(); |
| | | }; |
| | | const modalList = ref([]); |
| | | const queryModel = async () => { |
| | | const res = await getFactories(); |
| | | modalList.value = res.data; |
| | | }; |
| | | queryModel(); |
| | | |
| | | watchEffect(() => { |
| | | if (props.nameList && props.title == '编辑模型') { |