mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
feat: model
This commit is contained in:
parent
83e9a8ce98
commit
6ce02abc33
|
|
@ -22,62 +22,24 @@ Object.defineProperty(prefix, 'value', {
|
|||
* 获得模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getModel: (
|
||||
const getModelList: (
|
||||
data?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
return get(`${prefix.value}`, data, loading)
|
||||
}
|
||||
/**
|
||||
* 获取工作空间下重排模型列表
|
||||
* @param loading 加载器
|
||||
* @returns 重排模型列表
|
||||
*/
|
||||
const getRerankerModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'RERANKER' }, loading)
|
||||
return get(`${prefix.value}/model`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取语音转文本模型列表
|
||||
* @param loading
|
||||
* @returns 语音转文本模型列表
|
||||
* 获得下拉选择框模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getSTTModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'STT' }, loading)
|
||||
const getSelectModelList: (
|
||||
data?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
return get(`${prefix.value}/model_list`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文本转语音模型列表
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const getTTSModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'TTS' }, loading)
|
||||
}
|
||||
/**
|
||||
* 获取图片理解模型列表
|
||||
* @param loading
|
||||
* @returns 图片理解模型列表
|
||||
*/
|
||||
const getImageModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'IMAGE' }, loading)
|
||||
}
|
||||
/**
|
||||
* 获取图片生成模型列表
|
||||
* @param loading
|
||||
* @returns 图片生成模型列表
|
||||
*/
|
||||
const getTTIModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'TTI' }, loading)
|
||||
}
|
||||
/**
|
||||
* 获取大语言模型列表
|
||||
* @param loading
|
||||
* @returns 大语言模型列表
|
||||
*/
|
||||
const getLLMModel: (loading?: Ref<boolean>) => Promise<Result<Array<any>>> = (loading) => {
|
||||
return get(`${prefix.value}`, { model_type: 'LLM' }, loading)
|
||||
}
|
||||
/**
|
||||
* 获取模型参数表单
|
||||
* @param model_id 模型id
|
||||
|
|
@ -88,7 +50,7 @@ const getModelParamsForm: (
|
|||
model_id: string,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<FormField>>> = (model_id, loading) => {
|
||||
return get(`${prefix.value}/${model_id}/model_params_form`, {}, loading)
|
||||
return get(`${prefix.value}/model/${model_id}/model_params_form`, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,7 +63,7 @@ const createModel: (
|
|||
request: CreateModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (request, loading) => {
|
||||
return post(`${prefix.value}`, request, {}, loading)
|
||||
return post(`${prefix.value}/model`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -115,7 +77,7 @@ const updateModel: (
|
|||
request: EditModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (model_id, request, loading) => {
|
||||
return put(`${prefix.value}/${model_id}`, request, {}, loading)
|
||||
return put(`${prefix.value}/model/${model_id}`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -129,7 +91,7 @@ const updateModelParamsForm: (
|
|||
request: any[],
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Model>> = (model_id, request, loading) => {
|
||||
return put(`${prefix.value}/${model_id}/model_params_form`, request, {}, loading)
|
||||
return put(`${prefix.value}/model/${model_id}/model_params_form`, request, {}, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +104,7 @@ const getModelById: (model_id: string, loading?: Ref<boolean>) => Promise<Result
|
|||
model_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix.value}/${model_id}`, {}, loading)
|
||||
return get(`${prefix.value}/model/${model_id}`, {}, loading)
|
||||
}
|
||||
/**
|
||||
* 获取模型信息不包括认证信息根据模型id
|
||||
|
|
@ -154,7 +116,7 @@ const getModelMetaById: (model_id: string, loading?: Ref<boolean>) => Promise<Re
|
|||
model_id,
|
||||
loading,
|
||||
) => {
|
||||
return get(`${prefix.value}/${model_id}/meta`, {}, loading)
|
||||
return get(`${prefix.value}/model/${model_id}/meta`, {}, loading)
|
||||
}
|
||||
/**
|
||||
* 暂停下载
|
||||
|
|
@ -166,16 +128,16 @@ const pauseDownload: (model_id: string, loading?: Ref<boolean>) => Promise<Resul
|
|||
model_id,
|
||||
loading,
|
||||
) => {
|
||||
return put(`${prefix.value}/${model_id}/pause_download`, undefined, {}, loading)
|
||||
return put(`${prefix.value}/model/${model_id}/pause_download`, undefined, {}, loading)
|
||||
}
|
||||
const deleteModel: (model_id: string, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
|
||||
model_id,
|
||||
loading,
|
||||
) => {
|
||||
return del(`${prefix.value}/${model_id}`, undefined, {}, loading)
|
||||
return del(`${prefix.value}/model/${model_id}`, undefined, {}, loading)
|
||||
}
|
||||
export default {
|
||||
getModel,
|
||||
getModelList,
|
||||
createModel,
|
||||
updateModel,
|
||||
deleteModel,
|
||||
|
|
@ -184,10 +146,5 @@ export default {
|
|||
pauseDownload,
|
||||
getModelParamsForm,
|
||||
updateModelParamsForm,
|
||||
getRerankerModel,
|
||||
getSTTModel,
|
||||
getTTSModel,
|
||||
getImageModel,
|
||||
getTTIModel,
|
||||
getLLMModel,
|
||||
getSelectModelList,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const workspace_id = localStorage.getItem('workspace_id') || 'default'
|
|||
* 获得模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getModel: (
|
||||
const getModelList: (
|
||||
request?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
|
|
@ -121,7 +121,7 @@ const deleteModel: (model_id: string, loading?: Ref<boolean>) => Promise<Result<
|
|||
}
|
||||
|
||||
export default {
|
||||
getModel,
|
||||
getModelList,
|
||||
createModel,
|
||||
updateModel,
|
||||
deleteModel,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const getKnowledgeListPage: (
|
|||
)
|
||||
}
|
||||
|
||||
const getModel: (
|
||||
const getModelList: (
|
||||
param: any,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<any>>> = (param: any, loading) => {
|
||||
|
|
@ -57,7 +57,7 @@ const getToolListPage: (
|
|||
export default {
|
||||
getKnowledgeList,
|
||||
getKnowledgeListPage,
|
||||
getModel,
|
||||
getModelList,
|
||||
getToolList,
|
||||
getToolListPage
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,24 @@ const prefix = '/system/shared/model'
|
|||
* 获得模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getModel: (
|
||||
const getModelList: (
|
||||
request?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
return get(`${prefix}`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得下拉选择框模型列表
|
||||
* @params 参数 name, model_type, model_name
|
||||
*/
|
||||
const getSelectModelList: (
|
||||
data?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) => Promise<Result<Array<Model>>> = (data, loading) => {
|
||||
return get(`${prefix}`, data, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型参数表单
|
||||
* @param model_id 模型id
|
||||
|
|
@ -120,7 +131,7 @@ const deleteModel: (model_id: string, loading?: Ref<boolean>) => Promise<Result<
|
|||
}
|
||||
|
||||
export default {
|
||||
getModel,
|
||||
getModelList,
|
||||
createModel,
|
||||
updateModel,
|
||||
deleteModel,
|
||||
|
|
@ -129,4 +140,5 @@ export default {
|
|||
pauseDownload,
|
||||
getModelParamsForm,
|
||||
updateModelParamsForm,
|
||||
getSelectModelList,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ watch(dialogVisible, (bool) => {
|
|||
|
||||
const open = (ids: string[], type: string, _knowledgeId?: string) => {
|
||||
knowledgeId.value = _knowledgeId
|
||||
getModel()
|
||||
getModelFn()
|
||||
idList.value = ids
|
||||
apiSubmitType.value = type
|
||||
dialogVisible.value = true
|
||||
|
|
@ -188,7 +188,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getModelFn() {
|
||||
loading.value = true
|
||||
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.getKnowledgeModel()
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ watch(dialogVisible, (bool) => {
|
|||
|
||||
const open = (ids: string[], type: string, _knowledgeId?: string) => {
|
||||
knowledgeId.value = _knowledgeId
|
||||
getModel()
|
||||
getModelFn()
|
||||
idList.value = ids
|
||||
apiType.value = type
|
||||
dialogVisible.value = true
|
||||
|
|
@ -186,7 +186,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getModelFn() {
|
||||
loading.value = true
|
||||
knowledgeApi
|
||||
.getKnowledgeModel()
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import type {ListModelRequest} from '@/api/type/model'
|
|||
const useModelStore = defineStore('mod', {
|
||||
state: () => ({}),
|
||||
actions: {
|
||||
async asyncGetModel(data?: ListModelRequest, loading?: Ref<boolean>) {
|
||||
async asyncGetSelectModel(data?: ListModelRequest, loading?: Ref<boolean>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ModelApi.getModel(data, loading)
|
||||
ModelApi.getModelList(data, loading)
|
||||
.then((res) => {
|
||||
resolve(res)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
const useModelStore = defineStore('model', {
|
||||
state: () => ({}),
|
||||
actions: {
|
||||
async asyncGetModel(
|
||||
data?: ListModelRequest,
|
||||
async asyncGetSelectModel(
|
||||
systemType: 'systemShare' | 'workspace' | 'systemManage' = 'workspace',
|
||||
data?: ListModelRequest,
|
||||
loading?: Ref<boolean>,
|
||||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
loadSharedApi({ type: 'model', systemType })
|
||||
.getModel(data, loading)
|
||||
.getSelectModelList(data, loading)
|
||||
.then((res: any) => {
|
||||
resolve(res)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@
|
|||
width: 280px;
|
||||
.el-dropdown-menu__item {
|
||||
padding: 8px 12px;
|
||||
width: 100%;
|
||||
&:hover {
|
||||
background: var(--app-text-color-light-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
:placeholder="$t('views.application.form.aiModel.placeholder')"
|
||||
:options="modelOptions"
|
||||
@change="model_change"
|
||||
@submitModel="getModel"
|
||||
@submitModel="getSelectModel"
|
||||
showFooter
|
||||
:model-type="'LLM'"
|
||||
></ModelSelect>
|
||||
|
|
@ -645,10 +645,10 @@ function getKnowledge() {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
loading.value = true
|
||||
modelAPI
|
||||
.getLLMModel()
|
||||
.getSelectModelList({ model_type: 'LLM' })
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -661,7 +661,7 @@ function getModel() {
|
|||
function getSTTModel() {
|
||||
loading.value = true
|
||||
modelAPI
|
||||
.getSTTModel()
|
||||
.getSelectModelList({ model_type: 'STT' })
|
||||
.then((res: any) => {
|
||||
sttModelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -674,7 +674,7 @@ function getSTTModel() {
|
|||
function getTTSModel() {
|
||||
loading.value = true
|
||||
modelAPI
|
||||
.getTTSModel()
|
||||
.getSelectModelList({ model_type: 'TTS' })
|
||||
.then((res: any) => {
|
||||
ttsModelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -717,7 +717,7 @@ function refresh() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
getKnowledge()
|
||||
getDetail()
|
||||
getSTTModel()
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import type { knowledgeData } from '@/api/type/knowledge'
|
|||
import { t } from '@/locales'
|
||||
|
||||
const props = defineProps<{
|
||||
data: {
|
||||
data?: {
|
||||
type: Object
|
||||
default: () => {}
|
||||
}
|
||||
|
|
@ -114,11 +114,13 @@ function validate() {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
loading.value = true
|
||||
|
||||
model
|
||||
.asyncGetModel({ model_type: 'EMBEDDING' }, props.apiType)
|
||||
.asyncGetSelectModel(props.apiType, { model_type: 'EMBEDDING' })
|
||||
.then((res: any) => {
|
||||
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
})
|
||||
|
|
@ -128,7 +130,7 @@ function getModel() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
})
|
||||
onUnmounted(() => {
|
||||
form.value = {
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ const openCreateModel = (provider?: Provider, model_type?: string) => {
|
|||
const list_model = () => {
|
||||
const params = active_provider.value?.provider ? { provider: active_provider.value.provider } : {}
|
||||
loadSharedApi({ type: 'model', isShared: isShared.value, systemType: apiType.value })
|
||||
.getModel({ ...model_search_form.value, ...params }, list_model_loading)
|
||||
.getModelList({ ...model_search_form.value, ...params }, list_model_loading)
|
||||
.then((ok: any) => {
|
||||
model_list.value = ok.data
|
||||
const v = model_list.value.map((m) => ({ id: m.user_id, username: m.username }))
|
||||
|
|
|
|||
|
|
@ -114,10 +114,10 @@ function validate() {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
loading.value = true
|
||||
model
|
||||
.asyncGetModel({model_type: 'EMBEDDING'})
|
||||
.asyncGetSelectModel({model_type: 'EMBEDDING'})
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
loading.value = false
|
||||
|
|
@ -128,7 +128,7 @@ function getModel() {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
})
|
||||
onUnmounted(() => {
|
||||
form.value = {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
v-model="chat_data.model_id"
|
||||
:placeholder="$t('views.application.form.aiModel.placeholder')"
|
||||
:options="modelOptions"
|
||||
@submitModel="getModel"
|
||||
@submitModel="getSelectModel"
|
||||
showFooter
|
||||
:model-type="'LLM'"
|
||||
></ModelSelect>
|
||||
|
|
@ -270,13 +270,13 @@ const validate = () => {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
modelAPI.getLLMModel().then((res: any) => {
|
||||
modelAPI.getSelectModelList({ model_type: 'LLM' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ function submitMcpServersDialog(config: any) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
if (typeof props.nodeModel.properties.node_data?.is_result === 'undefined') {
|
||||
if (isLastNode(props.nodeModel)) {
|
||||
set(props.nodeModel.properties.node_data, 'is_result', true)
|
||||
|
|
|
|||
|
|
@ -253,13 +253,13 @@ const validate = () => {
|
|||
}
|
||||
|
||||
function getSTTModel() {
|
||||
modelAPI.getSTTModel().then((res: any) => {
|
||||
modelAPI.getSelectModelList({ model_type: 'STT' }).then((res: any) => {
|
||||
sttModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
||||
function getTTSModel() {
|
||||
modelAPI.getTTSModel().then((res: any) => {
|
||||
modelAPI.getSelectModelList({ model_type: 'TTS' }).then((res: any) => {
|
||||
ttsModelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,14 +219,14 @@ const form_data = computed({
|
|||
},
|
||||
})
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
// todo
|
||||
// applicationApi.getApplicationTTIModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
applicationApi.getApplicationTTIModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ function submitNegativeDialog(val: string) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -239,14 +239,14 @@ const form_data = computed({
|
|||
},
|
||||
})
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
//todo
|
||||
// applicationApi.getApplicationImageModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
applicationApi.getApplicationImageModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ function refreshParam(data: any) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
v-model="form_data.model_id"
|
||||
:placeholder="$t('views.application.form.aiModel.placeholder')"
|
||||
:options="modelOptions"
|
||||
@submitModel="getModel"
|
||||
@submitModel="getSelectModel"
|
||||
showFooter
|
||||
:model-type="'LLM'"
|
||||
></ModelSelect>
|
||||
|
|
@ -220,21 +220,21 @@ const validate = () => {
|
|||
})
|
||||
}
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
//todo
|
||||
// applicationApi.getApplicationModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
applicationApi.getApplicationModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
if (typeof props.nodeModel.properties.node_data?.is_result === 'undefined') {
|
||||
if (isLastNode(props.nodeModel)) {
|
||||
set(props.nodeModel.properties.node_data, 'is_result', true)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
$t('views.applicationWorkflow.nodes.rerankerNode.reranker_model.placeholder')
|
||||
"
|
||||
:options="modelOptions"
|
||||
@submitModel="getModel"
|
||||
@submitModel="getSelectModel"
|
||||
showFooter
|
||||
:model-type="'RERANKER'"
|
||||
></ModelSelect>
|
||||
|
|
@ -235,14 +235,14 @@ const form_data = computed({
|
|||
function refreshParam(data: any) {
|
||||
set(props.nodeModel.properties.node_data, 'reranker_setting', data)
|
||||
}
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
//todo
|
||||
// applicationApi.getApplicationRerankerModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
applicationApi.getApplicationRerankerModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel({ model_type: 'RERANKER' }).then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace', { model_type: 'RERANKER' }).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ const validate = () => {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -154,21 +154,21 @@ const form_data = computed({
|
|||
},
|
||||
})
|
||||
|
||||
function getModel() {
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
//todo
|
||||
// applicationApi.getApplicationSTTModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
applicationApi.getApplicationSTTModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetModel().then((res: any) => {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getModel()
|
||||
getSelectModel()
|
||||
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -170,17 +170,17 @@ const form_data = computed({
|
|||
})
|
||||
|
||||
// todo
|
||||
// function getModel() {
|
||||
// if (id) {
|
||||
// applicationApi.getApplicationTTSModel(id).then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
// } else {
|
||||
// model.asyncGetModel().then((res: any) => {
|
||||
// modelOptions.value = groupBy(res?.data, 'provider')
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
function getSelectModel() {
|
||||
if (id) {
|
||||
applicationApi.getApplicationTTSModel(id).then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
} else {
|
||||
model.asyncGetSelectModel('workspace').then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const openTTSParamSettingDialog = () => {
|
||||
const model_id = form_data.value.tts_model_id
|
||||
|
|
@ -195,7 +195,7 @@ const refreshTTSForm = (data: any) => {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
// getModel()
|
||||
getSelectModel()
|
||||
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue