diff --git a/ui/src/api/model/model.ts b/ui/src/api/model/model.ts index 55929aad9..d03c5b2b2 100644 --- a/ui/src/api/model/model.ts +++ b/ui/src/api/model/model.ts @@ -30,10 +30,11 @@ const getModel: ( * @returns */ const getModelParamsForm: ( + wordspace_id: string, model_id: string, loading?: Ref, -) => Promise>> = (model_id, loading) => { - return get(`model/${model_id}/model_params_form`, {}, loading) +) => Promise>> = (wordspace_id, model_id, loading) => { + return get(`${prefix}/${wordspace_id}/model/${model_id}/model_params_form`, {}, loading) } /** @@ -43,10 +44,11 @@ const getModelParamsForm: ( * @returns */ const createModel: ( + wordspace_id: string, request: CreateModelRequest, loading?: Ref, -) => Promise> = (request, loading) => { - return post(`${prefix}`, request, {}, loading) +) => Promise> = (wordspace_id, request, loading) => { + return post(`${prefix}/${wordspace_id}/model`, request, {}, loading) } /** @@ -56,11 +58,12 @@ const createModel: ( * @returns */ const updateModel: ( + wordspace_id: string, model_id: string, request: EditModelRequest, loading?: Ref, -) => Promise> = (model_id, request, loading) => { - return put(`${prefix}/${model_id}`, request, {}, loading) +) => Promise> = (wordspace_id, model_id, request, loading) => { + return put(`${prefix}/${wordspace_id}/model/${model_id}`, request, {}, loading) } /** @@ -70,11 +73,12 @@ const updateModel: ( * @returns */ const updateModelParamsForm: ( + wordspace_id: string, model_id: string, request: any[], loading?: Ref, -) => Promise> = (model_id, request, loading) => { - return put(`${prefix}/${model_id}/model_params_form`, request, {}, loading) +) => Promise> = (wordspace_id, model_id, request, loading) => { + return put(`${prefix}/${wordspace_id}/model/${model_id}/model_params_form`, request, {}, loading) } /** @@ -83,11 +87,12 @@ const updateModelParamsForm: ( * @param loading 加载器 * @returns */ -const getModelById: (model_id: string, loading?: Ref) => Promise> = ( - model_id, - loading, -) => { - return get(`${prefix}/${model_id}`, {}, loading) +const getModelById: ( + wordspace_id: string, + model_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, model_id, loading) => { + return get(`${prefix}/${wordspace_id}/model/${model_id}`, {}, loading) } /** * 获取模型信息不包括认证信息根据模型id @@ -95,11 +100,12 @@ const getModelById: (model_id: string, loading?: Ref) => Promise) => Promise> = ( - model_id, - loading, -) => { - return get(`${prefix}/${model_id}/meta`, {}, loading) +const getModelMetaById: ( + wordspace_id: string, + model_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, model_id, loading) => { + return get(`${prefix}/${wordspace_id}/model/${model_id}/meta`, {}, loading) } /** * 暂停下载 @@ -107,17 +113,19 @@ const getModelMetaById: (model_id: string, loading?: Ref) => Promise) => Promise> = ( - model_id, - loading, -) => { - return put(`${prefix}/${model_id}/pause_download`, undefined, {}, loading) +const pauseDownload: ( + wordspace_id: string, + model_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, model_id, loading) => { + return put(`${prefix}/${wordspace_id}/model/${model_id}/pause_download`, undefined, {}, loading) } -const deleteModel: (model_id: string, loading?: Ref) => Promise> = ( - model_id, - loading, -) => { - return del(`${prefix}/${model_id}`, undefined, {}, loading) +const deleteModel: ( + wordspace_id: string, + model_id: string, + loading?: Ref, +) => Promise> = (wordspace_id, model_id, loading) => { + return del(`${prefix}/${wordspace_id}/model/${model_id}`, undefined, {}, loading) } export default { getModel, diff --git a/ui/src/enums/model.ts b/ui/src/enums/model.ts index 6d073d932..0d2e8bfd7 100644 --- a/ui/src/enums/model.ts +++ b/ui/src/enums/model.ts @@ -3,8 +3,8 @@ export enum PermissionType { PUBLIC = 'common.public' } export enum PermissionDesc { - PRIVATE = 'views.model.templateForm.form.permissionType.privateDesc', - PUBLIC = 'views.model.templateForm.form.permissionType.publicDesc', + PRIVATE = 'views.model.modelForm.permissionType.privateDesc', + PUBLIC = 'views.model.modelForm.permissionType.publicDesc', } export enum modelType { diff --git a/ui/src/locales/lang/en-US/views/model.ts b/ui/src/locales/lang/en-US/views/model.ts index a042e3186..1440926af 100644 --- a/ui/src/locales/lang/en-US/views/model.ts +++ b/ui/src/locales/lang/en-US/views/model.ts @@ -4,11 +4,11 @@ export default { providerPlaceholder: 'Select Provider', addModel: 'Add Model', searchBar: { - placeholder: 'Search by name' + placeholder: 'Search by name', }, delete: { confirmTitle: 'Delete Model', - confirmMessage: 'Are you sure you want to delete the model:' + confirmMessage: 'Are you sure you want to delete the model:', }, tip: { createSuccessMessage: 'Model created successfully', @@ -19,7 +19,7 @@ export default { updateSuccessMessage: 'Model updated successfully', saveSuccessMessage: 'Model parameters saved successfully', downloadError: 'Download failed', - noModel: 'Model does not exist in Ollama' + noModel: 'Model does not exist in Ollama', }, model: { allModel: 'All Models', @@ -31,7 +31,7 @@ export default { STT: 'Speech2Text', TTS: 'TTS', IMAGE: 'Vision Model', - TTI: 'Image Generation' + TTI: 'Image Generation', }, modelForm: { title: { @@ -41,49 +41,44 @@ export default { editParam: 'Edit Parameter', addParam: 'Add Parameter', paramSetting: 'Model Parameter Settings', - apiParamPassing: 'Interface Parameters' + apiParamPassing: 'Interface Parameters', + }, + modeName: { + label: 'Model Name', + placeholder: 'Set a name for the base model', + tooltip: 'Custom model name in MaxKB', + requiredMessage: 'Model name cannot be empty', + }, + permissionType: { + label: 'Permission', + privateDesc: 'Available only to current user', + publicDesc: 'Available to all users', + requiredMessage: 'Permission cannot be empty', + }, + model_type: { + label: 'Model Type', + placeholder: 'Select a model type', + tooltip1: 'LLM: An inference model for AI chats in the APP.', + tooltip2: 'Embedding Model: A model for vectorizing document content in the knowledge.', + tooltip3: 'Speech2Text: A model used for speech recognition in the APP.', + tooltip4: 'TTS: A model used for TTS in the APP.', + tooltip5: + 'Rerank: A model used to reorder candidate segments when using multi-route recall in advanced orchestration APP.', + tooltip6: + 'Vision Model: A visual model used for image understanding in advanced orchestration APP.', + tooltip7: + 'Image Generation: A visual model used for image generation in advanced orchestration APP.', + requiredMessage: 'Model type cannot be empty', + }, + base_model: { + label: 'Base Model', + tooltip: 'For models not listed, enter the model name and press Enter', + placeholder: 'Enter the base model name and press Enter to add', + requiredMessage: 'Base model cannot be empty', }, - form: { - templateName: { - label: 'Model Name', - placeholder: 'Set a name for the base model', - tooltip: 'Custom model name in MaxKB', - requiredMessage: 'Model name cannot be empty' - }, - permissionType: { - label: 'Permission', - privateDesc: 'Available only to current user', - publicDesc: 'Available to all users', - requiredMessage: 'Permission cannot be empty' - }, - model_type: { - label: 'Model Type', - placeholder: 'Select a model type', - tooltip1: - 'LLM: An inference model for AI chats in the APP.', - tooltip2: - 'Embedding Model: A model for vectorizing document content in the knowledge.', - tooltip3: 'Speech2Text: A model used for speech recognition in the APP.', - tooltip4: 'TTS: A model used for TTS in the APP.', - tooltip5: - 'Rerank: A model used to reorder candidate segments when using multi-route recall in advanced orchestration APP.', - tooltip6: - 'Vision Model: A visual model used for image understanding in advanced orchestration APP.', - tooltip7: - 'Image Generation: A visual model used for image generation in advanced orchestration APP.', - requiredMessage: 'Model type cannot be empty' - }, - base_model: { - label: 'Base Model', - tooltip: - 'For models not listed, enter the model name and press Enter', - placeholder: 'Enter the base model name and press Enter to add', - requiredMessage: 'Base model cannot be empty' - } - } }, download: { downloading: 'Downloading...', - cancelDownload: 'Cancel Download' - } + cancelDownload: 'Cancel Download', + }, } diff --git a/ui/src/locales/lang/zh-CN/views/model.ts b/ui/src/locales/lang/zh-CN/views/model.ts index ec64bc27d..02b1df556 100644 --- a/ui/src/locales/lang/zh-CN/views/model.ts +++ b/ui/src/locales/lang/zh-CN/views/model.ts @@ -4,11 +4,11 @@ export default { providerPlaceholder: '选择供应商', addModel: '添加模型', searchBar: { - placeholder: '按名称搜索' + placeholder: '按名称搜索', }, delete: { confirmTitle: '删除模型', - confirmMessage: '是否删除模型:' + confirmMessage: '是否删除模型:', }, tip: { createSuccessMessage: '创建模型成功', @@ -19,7 +19,7 @@ export default { updateSuccessMessage: '修改模型成功', saveSuccessMessage: '模型参数保存成功', downloadError: '下载失败', - noModel: '模型在Ollama不存在' + noModel: '模型在Ollama不存在', }, modelType: { allModel: '全部模型', @@ -31,7 +31,7 @@ export default { STT: '语音识别', TTS: '语音合成', IMAGE: '视觉模型', - TTI: '图片生成' + TTI: '图片生成', }, modelForm: { title: { @@ -41,43 +41,41 @@ export default { editParam: '编辑参数', addParam: '添加参数', paramSetting: '模型参数设置', - apiParamPassing: '接口传参' + apiParamPassing: '接口传参', + }, + modeName: { + label: '模型名称', + placeholder: '请给基础模型设置一个名称', + tooltip: 'MaxKB 中自定义的模型名称', + requiredMessage: '模型名称不能为空', + }, + permissionType: { + label: '权限', + privateDesc: '仅当前用户使用', + publicDesc: '所有用户都可使用', + requiredMessage: '权限不能为空', + }, + model_type: { + label: '模型类型', + placeholder: '请选择模型类型', + tooltip1: '大语言模型:在应用中与AI对话的推理模型。', + tooltip2: '向量模型:在知识库中对文档内容进行向量化的模型。', + tooltip3: '语音识别:在应用中开启语音识别后用于语音转文字的模型。', + tooltip4: '语音合成:在应用中开启语音播放后用于文字转语音的模型。', + tooltip5: '重排模型:在高级编排应用中使用多路召回时,对候选分段进行重新排序的模型。', + tooltip6: '视觉模型:在高级编排应用中用于图片理解的视觉模型。', + tooltip7: '图片生成:在高级编排应用中用于图片生成的视觉模型。', + requiredMessage: '模型类型不能为空', + }, + base_model: { + label: '基础模型', + tooltip: '列表中未列出的模型,直接输入模型名称,回车即可添加', + placeholder: '自定义输入基础模型后回车即可', + requiredMessage: '基础模型不能为空', }, - form: { - templateName: { - label: '模型名称', - placeholder: '请给基础模型设置一个名称', - tooltip: 'MaxKB 中自定义的模型名称', - requiredMessage: '模型名称不能为空' - }, - permissionType: { - label: '权限', - privateDesc: '仅当前用户使用', - publicDesc: '所有用户都可使用', - requiredMessage: '权限不能为空' - }, - model_type: { - label: '模型类型', - placeholder: '请选择模型类型', - tooltip1: '大语言模型:在应用中与AI对话的推理模型。', - tooltip2: '向量模型:在知识库中对文档内容进行向量化的模型。', - tooltip3: '语音识别:在应用中开启语音识别后用于语音转文字的模型。', - tooltip4: '语音合成:在应用中开启语音播放后用于文字转语音的模型。', - tooltip5: '重排模型:在高级编排应用中使用多路召回时,对候选分段进行重新排序的模型。', - tooltip6: '视觉模型:在高级编排应用中用于图片理解的视觉模型。', - tooltip7: '图片生成:在高级编排应用中用于图片生成的视觉模型。', - requiredMessage: '模型类型不能为空' - }, - base_model: { - label: '基础模型', - tooltip: '列表中未列出的模型,直接输入模型名称,回车即可添加', - placeholder: '自定义输入基础模型后回车即可', - requiredMessage: '基础模型不能为空' - } - } }, download: { downloading: '正在下载中', - cancelDownload: '取消下载' - } + cancelDownload: '取消下载', + }, } diff --git a/ui/src/locales/lang/zh-Hant/views/model.ts b/ui/src/locales/lang/zh-Hant/views/model.ts index 92ee667cf..d6462bbe9 100644 --- a/ui/src/locales/lang/zh-Hant/views/model.ts +++ b/ui/src/locales/lang/zh-Hant/views/model.ts @@ -4,11 +4,11 @@ export default { providerPlaceholder: '選擇供應商', addModel: '新增模型', searchBar: { - placeholder: '按名稱搜尋' + placeholder: '按名稱搜尋', }, delete: { confirmTitle: '刪除模型', - confirmMessage: '是否刪除模型:' + confirmMessage: '是否刪除模型:', }, tip: { createSuccessMessage: '創建模型成功', @@ -19,7 +19,7 @@ export default { updateSuccessMessage: '修改模型成功', saveSuccessMessage: '模型參數儲存成功', downloadError: '下載失敗', - noModel: '模型在Ollama不存在' + noModel: '模型在Ollama不存在', }, model: { allModel: '全部模型', @@ -31,7 +31,7 @@ export default { STT: '語音辨識', TTS: '語音合成', IMAGE: '圖片理解', - TTI: '圖片生成' + TTI: '圖片生成', }, modelForm: { title: { @@ -41,43 +41,41 @@ export default { editParam: '編輯參數', addParam: '新增參數', paramSetting: '模型參數設定', - apiParamPassing: '接口傳參' + apiParamPassing: '接口傳參', + }, + modeName: { + label: '模型名稱', + placeholder: '請給基礎模型設定一個名稱', + tooltip: 'MaxKB 中自訂的模型名稱', + requiredMessage: '模型名稱不能為空', + }, + permissionType: { + label: '權限', + privateDesc: '僅當前使用者使用', + publicDesc: '所有使用者都可使用', + requiredMessage: '權限不能為空', + }, + model_type: { + label: '模型類型', + placeholder: '請選擇模型類型', + tooltip1: '大語言模型:在應用中與AI對話的推理模型。', + tooltip2: '向量模型:在知識庫中對文件內容進行向量化化的模型。', + tooltip3: '語音辨識:在應用中開啟語音辨識後用於語音轉文字的模型。', + tooltip4: '語音合成:在應用中開啟語音播放後用於文字轉語音的模型。', + tooltip5: '重排模型:在高階編排應用中使用多路召回時,對候選分段進行重新排序的模型。', + tooltip6: '圖片理解:在高階編排應用中用於圖片理解的視覺模型。', + tooltip7: '圖片生成:在高階編排應用中用於圖片生成的視覺模型。', + requiredMessage: '模型類型不能為空', + }, + base_model: { + label: '基礎模型', + tooltip: '列表中未列出的模型,直接輸入模型名稱,按 Enter 即可新增', + placeholder: '自訂輸入基礎模型後按 Enter 即可', + requiredMessage: '基礎模型不能為空', }, - form: { - templateName: { - label: '模型名稱', - placeholder: '請給基礎模型設定一個名稱', - tooltip: 'MaxKB 中自訂的模型名稱', - requiredMessage: '模型名稱不能為空' - }, - permissionType: { - label: '權限', - privateDesc: '僅當前使用者使用', - publicDesc: '所有使用者都可使用', - requiredMessage: '權限不能為空' - }, - model_type: { - label: '模型類型', - placeholder: '請選擇模型類型', - tooltip1: '大語言模型:在應用中與AI對話的推理模型。', - tooltip2: '向量模型:在知識庫中對文件內容進行向量化化的模型。', - tooltip3: '語音辨識:在應用中開啟語音辨識後用於語音轉文字的模型。', - tooltip4: '語音合成:在應用中開啟語音播放後用於文字轉語音的模型。', - tooltip5: '重排模型:在高階編排應用中使用多路召回時,對候選分段進行重新排序的模型。', - tooltip6: '圖片理解:在高階編排應用中用於圖片理解的視覺模型。', - tooltip7: '圖片生成:在高階編排應用中用於圖片生成的視覺模型。', - requiredMessage: '模型類型不能為空' - }, - base_model: { - label: '基礎模型', - tooltip: '列表中未列出的模型,直接輸入模型名稱,按 Enter 即可新增', - placeholder: '自訂輸入基礎模型後按 Enter 即可', - requiredMessage: '基礎模型不能為空' - } - } }, download: { downloading: '正在下載中', - cancelDownload: '取消下載' - } + cancelDownload: '取消下載', + }, } diff --git a/ui/src/views/model/component/CreateModelDialog.vue b/ui/src/views/model/component/CreateModelDialog.vue index 8b5c344d4..f28b90404 100644 --- a/ui/src/views/model/component/CreateModelDialog.vue +++ b/ui/src/views/model/component/CreateModelDialog.vue @@ -39,11 +39,11 @@