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