Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ui/src/api/admin/workspace/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const getModelMeta = (modelId: string) => {
const deleteModel = (modelId: string) => {
return del<undefined, boolean>(`${getPrefix()}/${modelId}`)
}
const getModelParamsForm = (modelId: string) => {
return get<ModelItem>(`${getPrefix()}/${modelId}/model_params_form`)
}

/** 暂停本地模型下载。 */
const putPauseModelDownload = (modelId: string) => {
Expand All @@ -50,4 +53,5 @@ export default {
postModel,
putModel,
putPauseModelDownload,
getModelParamsForm,
}
6 changes: 4 additions & 2 deletions ui/src/components/mk-dynamics-form/Demo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ref, computed, provide } from 'vue'
import { ElMessage } from 'element-plus'
import type { Dict } from '@/api/types'
import {
Expand All @@ -10,9 +10,11 @@ import {
type FormField,
type VisibilityFieldOption,
} from '@/components/mk-dynamics-form'
import modelAPI from '@/api/admin/workspace/model/model'

defineOptions({ name: 'MkDynamicsFormDemo' })

provide('getSelectModelList', modelAPI.getModelList)
provide('getModelParamsForm', modelAPI.getModelParamsForm)
const constructorRef = ref<InstanceType<typeof MkDynamicsFormConstructor>>()
const dynamicsFormRef = ref<InstanceType<typeof MkDynamicsForm>>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,12 @@ function fetchDefaultParams(modelId: string) {
})
}
const rawModelOptions = ref<DynamicFormValue[]>([])
const groupedModelOptions = ref<Record<string, DynamicFormValue[]>>({})
const groupedModelOptions = ref<Record<string, any[]>>({})
const fetchModelByType = (type: string) => {
if (!type || !getSelectModelList) return
getSelectModelList({ model_type: type }).then((res: DynamicFormValue) => {
rawModelOptions.value = res?.data || []
groupedModelOptions.value = groupBy(res?.data, 'provider')
rawModelOptions.value = res
})
}
Expand Down Expand Up @@ -201,7 +198,8 @@ defineExpose({ getData, render })
multiple
v-model="selectedIds"
placeholder="请选择模型"
:options="groupedModelOptions"
:options="rawModelOptions"
:provider-options="providerOptions"
:model-type="formValue.model_type"
>
</ModelSelect>
Expand Down
6 changes: 0 additions & 6 deletions ui/src/router/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ const router = createRouter({
...workflowRoutes,
workspaceRoutes,
systemRoutes,
{
path: '/demo/dynamics-form',
name: 'demo-dynamics-form',
component: () => import('@/components/mk-dynamics-form/Demo.vue'),
meta: { title: '动态表单演示' },
},
{
path: '/:pathMatch(.*)*',
name: 'not-found',
Expand Down
6 changes: 6 additions & 0 deletions ui/src/router/admin/workspace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const moduleRoutes: RouteRecordRaw[] = [
...toolRoutes,
...modelRoutes,
...triggerRoutes,
{
path: 'demo-dynamics-form',
name: 'demo-dynamics-form',
component: () => import('@/components/mk-dynamics-form/Demo.vue'),
meta: { title: '动态表单演示' },
},
]

export const workspaceRoutes: RouteRecordRaw = {
Expand Down
Loading