parent
25383d56c6
commit
6327866533
|
@ -95,7 +95,7 @@ async function handleDel(record: any) {
|
|||
<span>{{ item.name }}</span>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<div class="h-full flex-1 px-20px" v-loading="loading">
|
||||
<div class="h-full flex-1 px-20px" >
|
||||
<el-alert
|
||||
class="w-full mb-10px min-alert"
|
||||
title="对于完全适配OpenAI接口格式的模型都可在OpenAI中配置(只需要定义BaseUrl)"
|
||||
|
@ -103,7 +103,7 @@ async function handleDel(record: any) {
|
|||
show-icon
|
||||
/>
|
||||
<el-button :icon="Plus" class="my-10px" type="primary" @click="addModel">新增模型</el-button>
|
||||
<Table class="table-wrapper" height="100%" border :columns="columns" :data="tableData" :pagination="false" >
|
||||
<Table :loading="loading" class="table-wrapper" height="100%" border :columns="columns" :data="tableData" >
|
||||
<template #action="{row}">
|
||||
<el-button text :icon="Edit" @click="handleEdit(row)"/>
|
||||
<el-button text :icon="Delete" type="danger" @click="handleDel(row)"/>
|
||||
|
|
|
@ -130,8 +130,6 @@ export default function () {
|
|||
delListApi: EmbedStoreApi.deleteEmbedStore
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 打开编辑对话框
|
||||
const open = (data?: any) => {
|
||||
editRef.value.show(data);
|
||||
|
@ -141,6 +139,7 @@ export default function () {
|
|||
const handleSearch = (values: any) => {
|
||||
methods.setSearchParams(values)
|
||||
}
|
||||
|
||||
const pagination = computed(() => {
|
||||
return {
|
||||
total: tableObject.total,
|
||||
|
@ -148,9 +147,15 @@ export default function () {
|
|||
currentPage: tableObject.currentPage
|
||||
}
|
||||
})
|
||||
const handleDel = () => {
|
||||
|
||||
const handleDel = async (id: string | number) => {
|
||||
try {
|
||||
await methods.delList(id, false);
|
||||
} catch (error) {
|
||||
console.error('Failed to delete embed store:', error);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
shema,
|
||||
columns,
|
||||
|
|
|
@ -29,7 +29,7 @@ onMounted(() => {
|
|||
<Table height="calc(100% - 400px)" border :data="tableObject.tableList" :columns="columns" :pagination="pagination" @register="register">
|
||||
<template #action="{ row }">
|
||||
<el-button type="primary" text :icon="Edit" @click="open(row)" />
|
||||
<el-button type="danger" text :icon="Delete" @click="methods.delList(row.id, false)" />
|
||||
<el-button type="danger" text :icon="Delete" @click="handleDel(row.id)" />
|
||||
</template>
|
||||
</Table>
|
||||
<EditCom ref="editRef" @reload="methods?.getList" />
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function () {
|
|||
type: ModelTypeEnum.EMBEDDING
|
||||
});
|
||||
const tableData = ref([])
|
||||
|
||||
const loading = ref(false)
|
||||
const baseColumns = [
|
||||
{
|
||||
label: '模型别名',
|
||||
|
@ -53,7 +53,7 @@ export default function () {
|
|||
// 加载数据
|
||||
const loadData = async () => {
|
||||
try {
|
||||
const res = await ModelApi.getModelList({ provider: formData.value.provider, type: ModelTypeEnum.EMBEDDING });
|
||||
const res = await ModelApi.getModelList({ provider: formData.value.provider, type: ModelTypeEnum.EMBEDDING }).finally(() => loading.value = false);
|
||||
tableData.value = res;
|
||||
} catch (error) {
|
||||
console.error('Failed to load embedding models:', error);
|
||||
|
@ -101,6 +101,7 @@ export default function () {
|
|||
open,
|
||||
loadData,
|
||||
handleDel,
|
||||
handleEdit
|
||||
handleEdit,
|
||||
loading
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import EditCom from "@/views/ai/model/embedding/edit.vue";
|
|||
import {LLMProviders} from "@/views/ai/model/embedding/composables/consts";
|
||||
import {Table} from "@/components/Table";
|
||||
|
||||
const { baseColumns: columns, tableData, formData, editRef, open, loadData, handleEdit, handleDel} = usePage()
|
||||
const { baseColumns: columns, tableData, formData, editRef, open, loadData, loading,handleEdit, handleDel} = usePage()
|
||||
|
||||
const handleReload = () => {
|
||||
loadData()
|
||||
|
@ -31,7 +31,7 @@ const handleReload = () => {
|
|||
show-icon
|
||||
/>
|
||||
<el-button class="my-10px" type="primary" :icon="Plus" @click="open">新增向量模型</el-button>
|
||||
<Table class="table-wrapper" height="100%" border :columns="columns" :data="tableData" :pagination="false">
|
||||
<Table class="table-wrapper" height="100%" border :columns="columns" :data="tableData" :pagination="false" :loading="loading">
|
||||
<template #action="{row}">
|
||||
<el-button :icon="Edit" text @click="handleEdit(row)"/>
|
||||
<el-button :icon="Delete" text type="danger" @click="handleDel(row)"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {computed, nextTick, ref, watch} from "vue";
|
||||
import {computed, nextTick, onMounted, ref, watch} from "vue";
|
||||
import {ProviderEnum} from "@/views/ai/model/image/composables/consts";
|
||||
import {ModelApi} from "@/api/new-ai/model";
|
||||
import { ModelTypeEnum } from "../../chatModel/composables/consts";
|
||||
|
@ -11,7 +11,7 @@ export default function () {
|
|||
type: ModelTypeEnum.TEXT_IMAGE
|
||||
});
|
||||
const tableData = ref([])
|
||||
|
||||
const loading = ref(false)
|
||||
const baseColumns = [
|
||||
{
|
||||
label: '模型别名',
|
||||
|
@ -74,7 +74,7 @@ export default function () {
|
|||
// 加载数据
|
||||
const loadData = async () => {
|
||||
try {
|
||||
const res = await ModelApi.getModelList({ provider: formData.value.provider, type: ModelTypeEnum.TEXT_IMAGE });
|
||||
const res = await ModelApi.getModelList({ provider: formData.value.provider, type: ModelTypeEnum.TEXT_IMAGE }).finally(() => loading.value = false);
|
||||
tableData.value = res;
|
||||
} catch (error) {
|
||||
console.error('Failed to load image models:', error);
|
||||
|
@ -122,6 +122,7 @@ export default function () {
|
|||
open,
|
||||
loadData,
|
||||
handleDel,
|
||||
handleEdit
|
||||
handleEdit,
|
||||
loading,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import {LLMProviders} from "@/views/ai/model/image/composables/consts";
|
|||
import EditCom from './edit.vue'
|
||||
import {Table} from "@/components/Table";
|
||||
|
||||
const {columns, tableData, formData, editRef, open, loadData, handleEdit, handleDel} = usePage()
|
||||
const {columns, tableData, formData, editRef, open, loadData, handleEdit, handleDel, loading} = usePage()
|
||||
|
||||
const handleReload = () => {
|
||||
loadData()
|
||||
|
@ -34,7 +34,7 @@ const handleReload = () => {
|
|||
<el-button :icon="Plus" class="my-10px" type="primary" @click="open">新增图像模型
|
||||
</el-button>
|
||||
<Table
|
||||
:columns="columns" :data="tableData" :pagination="false" border
|
||||
:columns="columns" :data="tableData" :loading="loading" border
|
||||
class="table-wrapper" height="100%">
|
||||
<template #action="{row}">
|
||||
<el-button :icon="Edit" text @click="handleEdit(row)"/>
|
||||
|
|
Loading…
Reference in New Issue