diff --git a/ui/src/api/tool/tool.ts b/ui/src/api/tool/tool.ts index 2d5d3b64a..f3be669cf 100644 --- a/ui/src/api/tool/tool.ts +++ b/ui/src/api/tool/tool.ts @@ -39,12 +39,24 @@ const getToolList: ( ) } +/** + * 创建工具 + * @param 参数 + */ +const postTool: ( + wordspace_id: string, + data: toolData, + loading?: Ref, +) => Promise> = (wordspace_id, data, loading) => { + return post(`${prefix}/${wordspace_id}/tool`, data, undefined, loading) +} + /** * 修改工具 * @param 参数 */ -const putToolLib: ( +const putTool: ( wordspace_id: string, tool_id: string, data: toolData, @@ -67,9 +79,22 @@ const getToolById: ( return get(`${prefix}/${wordspace_id}/tool/${function_lib_id}`, undefined, loading) } +/** + * 调试工具 + * @param 参数 + + */ +// const postToolDebug: (data: any, loading?: Ref) => Promise> = ( +// data: any, +// loading +// ) => { +// return post(`${prefix}/debug`, data, undefined, loading) +// } + export default { getToolByFolder, getToolList, - putToolLib, - getToolById + putTool, + getToolById, + postTool } diff --git a/ui/src/layout/components/breadcrumb/index.vue b/ui/src/layout/components/breadcrumb/index.vue index f001a7511..2cd025195 100644 --- a/ui/src/layout/components/breadcrumb/index.vue +++ b/ui/src/layout/components/breadcrumb/index.vue @@ -138,14 +138,16 @@ import { ref, onMounted, computed } from 'vue' import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router' // import CreateApplicationDialog from '@/views/application/component/CreateApplicationDialog.vue' // import CreateDatasetDialog from '@/views/dataset/component/CreateDatasetDialog.vue' -import { isAppIcon, isWorkFlow } from '@/utils/application' +import { isWorkFlow } from '@/utils/application' +import { isAppIcon } from '@/utils/common' + import useStore from '@/stores' const { common, dataset, application } = useStore() const route = useRoute() const router = useRouter() const { meta: { activeMenu }, - params: { id } + params: { id }, } = route as any onBeforeRouteLeave((to, from) => { @@ -193,7 +195,7 @@ function changeMenu(id: string) { } else { router.push({ name: lastMatched.name, - params: { id: id, type: type } + params: { id: id, type: type }, }) } } diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 527f0967d..46e2b71d8 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -58,10 +58,21 @@ export default { outputParam: 'Output Parameters', inputParam: 'Input Parameters', initParam: 'Startup Parameters', + editParam: 'Edit Parameter', + addParam: 'Add Parameter', }, - inputPlaceholder: 'Please input', title: 'Title', content: 'Content', rename: 'Rename', + EditAvatarDialog: { + title: 'App Logo', + customizeUpload: 'Custom Upload', + upload: 'Upload', + default: 'Default Logo', + custom: 'Custom', + sizeTip: 'Recommended size: 32×32 pixels. Supports JPG, PNG, and GIF formats. Max size: 10 MB', + fileSizeExceeded: 'File size exceeds 10 MB', + uploadImagePrompt: 'Please upload an image', + }, } diff --git a/ui/src/locales/lang/en-US/views/application-overview.ts b/ui/src/locales/lang/en-US/views/application-overview.ts index 7580cdd53..a89a6148c 100644 --- a/ui/src/locales/lang/en-US/views/application-overview.ts +++ b/ui/src/locales/lang/en-US/views/application-overview.ts @@ -27,17 +27,6 @@ export default { enabledSuccess: 'Enabled', disabledSuccess: 'Disabled' }, - EditAvatarDialog: { - title: 'App Logo', - customizeUpload: 'Custom Upload', - upload: 'Upload', - default: 'Default Logo', - custom: 'Custom', - sizeTip: - 'Recommended size: 32×32 pixels. Supports JPG, PNG, and GIF formats. Max size: 10 MB', - fileSizeExceeded: 'File size exceeds 10 MB', - uploadImagePrompt: 'Please upload an image' - }, EmbedDialog: { fullscreenModeTitle: 'Fullscreen Mode', copyInstructions: 'Copy the code below to embed', diff --git a/ui/src/locales/lang/en-US/views/model.ts b/ui/src/locales/lang/en-US/views/model.ts index 1440926af..c61d06c78 100644 --- a/ui/src/locales/lang/en-US/views/model.ts +++ b/ui/src/locales/lang/en-US/views/model.ts @@ -38,8 +38,6 @@ export default { baseInfo: 'Basic Information', advancedInfo: 'Advanced Settings', modelParams: 'Model Parameters', - editParam: 'Edit Parameter', - addParam: 'Add Parameter', paramSetting: 'Model Parameter Settings', apiParamPassing: 'Interface Parameters', }, diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index e81524e7c..c5512a0e2 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -58,13 +58,25 @@ export default { enableSuccess: '启用成功', disableSuccess: '禁用成功', }, - inputPlaceholder: '请输入', - title: '标题', - content: '内容', param: { outputParam: '输出参数', inputParam: '输入参数', initParam: '启动参数', + editParam: '编辑参数', + addParam: '添加参数', }, + inputPlaceholder: '请输入', + title: '标题', + content: '内容', rename: '重命名', + EditAvatarDialog: { + title: 'App Logo', + customizeUpload: 'Custom Upload', + upload: 'Upload', + default: 'Default Logo', + custom: 'Custom', + sizeTip: 'Recommended size: 32×32 pixels. Supports JPG, PNG, and GIF formats. Max size: 10 MB', + fileSizeExceeded: 'File size exceeds 10 MB', + uploadImagePrompt: 'Please upload an image', + }, } diff --git a/ui/src/locales/lang/zh-CN/views/model.ts b/ui/src/locales/lang/zh-CN/views/model.ts index 02b1df556..117639618 100644 --- a/ui/src/locales/lang/zh-CN/views/model.ts +++ b/ui/src/locales/lang/zh-CN/views/model.ts @@ -38,8 +38,6 @@ export default { baseInfo: '基础信息', advancedInfo: '高级设置', modelParams: '模型参数', - editParam: '编辑参数', - addParam: '添加参数', paramSetting: '模型参数设置', apiParamPassing: '接口传参', }, diff --git a/ui/src/locales/lang/zh-CN/views/tool.ts b/ui/src/locales/lang/zh-CN/views/tool.ts index 4702ef7e9..7dd251f52 100644 --- a/ui/src/locales/lang/zh-CN/views/tool.ts +++ b/ui/src/locales/lang/zh-CN/views/tool.ts @@ -7,6 +7,10 @@ export default { confirmMessage: '禁用后,引用了该工具的应用提问时会报错 ,请谨慎操作。', }, form: { + title: { + copy: '副本', + baseInfo: '基础信息' + }, toolName: { label: '名称', name: '工具名称', diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index a1aa4e8ec..511b7d636 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -54,13 +54,25 @@ export default { enableSuccess: '啟用成功', disableSuccess: '停用成功', }, - inputPlaceholder: '請輸入', - title: '標題', - content: '内容', param: { outputParam: '輸出參數', inputParam: '輸入參數', initParam: '啟動參數', + editParam: '編輯參數', + addParam: '新增參數', }, + inputPlaceholder: '請輸入', + title: '標題', + content: '内容', rename: '重命名', + EditAvatarDialog: { + title: '應用頭像', + customizeUpload: '自訂上傳', + upload: '上傳', + default: '預設logo', + custom: '自訂', + sizeTip: '建議尺寸 32*32,支援 JPG、PNG、GIF,大小不超過 10 MB', + fileSizeExceeded: '檔案大小超過 10 MB', + uploadImagePrompt: '請上傳一張圖片' + }, } diff --git a/ui/src/locales/lang/zh-Hant/views/application-overview.ts b/ui/src/locales/lang/zh-Hant/views/application-overview.ts index c402d9de3..25b366be4 100644 --- a/ui/src/locales/lang/zh-Hant/views/application-overview.ts +++ b/ui/src/locales/lang/zh-Hant/views/application-overview.ts @@ -26,16 +26,6 @@ export default { enabledSuccess: '已啟用', disabledSuccess: '已停用' }, - EditAvatarDialog: { - title: '應用頭像', - customizeUpload: '自訂上傳', - upload: '上傳', - default: '預設logo', - custom: '自訂', - sizeTip: '建議尺寸 32*32,支援 JPG、PNG、GIF,大小不超過 10 MB', - fileSizeExceeded: '檔案大小超過 10 MB', - uploadImagePrompt: '請上傳一張圖片' - }, EmbedDialog: { fullscreenModeTitle: '全螢幕模式', copyInstructions: '複製以下程式碼進行嵌入', diff --git a/ui/src/locales/lang/zh-Hant/views/model.ts b/ui/src/locales/lang/zh-Hant/views/model.ts index d6462bbe9..f682db8c0 100644 --- a/ui/src/locales/lang/zh-Hant/views/model.ts +++ b/ui/src/locales/lang/zh-Hant/views/model.ts @@ -38,8 +38,6 @@ export default { baseInfo: '基礎資訊', advancedInfo: '進階設定', modelParams: '模型參數', - editParam: '編輯參數', - addParam: '新增參數', paramSetting: '模型參數設定', apiParamPassing: '接口傳參', }, diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index 4118c36ca..5b7fdd00d 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -395,3 +395,21 @@ h5 { .avatar-green { background: var(--el-color-success); } + +/* + 标题前带竖线样式 +*/ +.title-decoration-1 { + position: relative; + padding-left: 12px; + &:before { + position: absolute; + left: 2px; + top: 50%; + transform: translate(-50%, -50%); + width: 2px; + height: 80%; + content: ''; + background: var(--el-color-primary); + } +} diff --git a/ui/src/styles/component.scss b/ui/src/styles/component.scss index 0b077e383..5615524b2 100644 --- a/ui/src/styles/component.scss +++ b/ui/src/styles/component.scss @@ -12,3 +12,46 @@ border-right: 1px solid var(--el-border-color); } } + +// 编辑头像 +.edit-avatar { + position: relative; + line-height: 0; + .edit-mask { + position: absolute; + left: 0; + background: rgba(0, 0, 0, 0.4); + } +} + +// radio 一行一个样式 +.radio-block { + width: 100%; + display: inline-flex; + .el-radio { + align-items: flex-start; + height: 100%; + width: 100%; + margin-top: 8px; + } + .el-radio__label { + width: 100%; + margin-top: -8px; + line-height: 30px; + } +} +// radio 一行一个样式 有输入框 上传头像的内容 +.radio-block-avatar { + width: 100%; + display: block; + .el-radio { + align-items: flex-start; + height: 100%; + width: 100%; + } + .el-radio__label { + width: 100%; + margin-top: -8px; + line-height: 30px; + } +} diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index 8a853f162..ac2047f9b 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -165,3 +165,29 @@ $primary-color: #3370ff; .el-popper { --el-popper-border-radius: 6px; } + +// table +.el-table { + --el-table-header-bg-color: var(--app-layout-bg-color); + --el-table-text-color: var(--app-text-color); + font-weight: 400; + thead { + color: var(--app-text-color-secondary); + th { + font-weight: 500; + } + } + + th.el-table__cell { + border-top: var(--el-table-border); + } + .el-table__cell { + padding: 12px 0; + } + .el-checkbox { + height: 23px; + } + tr.highlight { + background: var(--el-table-current-row-bg-color); + } +} diff --git a/ui/src/utils/application.ts b/ui/src/utils/application.ts index fd7d0a201..9f4999ece 100644 --- a/ui/src/utils/application.ts +++ b/ui/src/utils/application.ts @@ -1,10 +1,3 @@ -export const defaultIcon = '/ui/favicon.ico' - -// 是否显示字母 / icon -export function isAppIcon(url: String | undefined) { - return url === defaultIcon ? '' : url -} - export function isWorkFlow(type: string | undefined) { return type === 'WORK_FLOW' } diff --git a/ui/src/utils/common.ts b/ui/src/utils/common.ts index 6865f61b9..31dd2dfe4 100644 --- a/ui/src/utils/common.ts +++ b/ui/src/utils/common.ts @@ -46,3 +46,9 @@ export function filesize(size: number) { if (size < Math.pow(num, 4)) return (size / Math.pow(num, 3)).toFixed(2) + 'G' //G return (size / Math.pow(num, 4)).toFixed(2) + 'T' //T } + +// 头像 +export const defaultIcon = '/ui/favicon.ico' +export function isAppIcon(url: String | undefined) { + return url === defaultIcon ? '' : url +} diff --git a/ui/src/views/model/component/AddParamDrawer.vue b/ui/src/views/model/component/AddParamDrawer.vue index 3024bbdf9..634b772af 100644 --- a/ui/src/views/model/component/AddParamDrawer.vue +++ b/ui/src/views/model/component/AddParamDrawer.vue @@ -10,8 +10,8 @@

{{ isEdit - ? $t('views.model.modelForm.title.editParam') - : $t('views.model.modelForm.title.addParam') + ? $t('common.param.editParam') + : $t('common.param.addParam') }}

diff --git a/ui/src/views/tool/component/FunctionDebugDrawer.vue b/ui/src/views/tool/ToolDebugDrawer.vue similarity index 94% rename from ui/src/views/tool/component/FunctionDebugDrawer.vue rename to ui/src/views/tool/ToolDebugDrawer.vue index e2c6936e5..0e8e0c0ad 100644 --- a/ui/src/views/tool/component/FunctionDebugDrawer.vue +++ b/ui/src/views/tool/ToolDebugDrawer.vue @@ -11,7 +11,7 @@
-
+

{{ $t('common.param.initParam') }}

@@ -48,13 +48,13 @@ :rules="{ required: item.is_required, message: $t('views.tool.form.param.inputPlaceholder'), - trigger: 'blur' + trigger: 'blur', }" >

- {{ $t('views.tool.functionForm.title.baseInfo') }} + {{ $t('views.tool.form.title.baseInfo') }}

- +
- - - - + + + + - +
- - - + + + - + - + - + - - + + + diff --git a/ui/src/views/tool/index.vue b/ui/src/views/tool/index.vue index 6226e9261..71b29876a 100644 --- a/ui/src/views/tool/index.vue +++ b/ui/src/views/tool/index.vue @@ -74,7 +74,16 @@ @@ -178,8 +187,9 @@ import ToolApi from '@/api/tool/tool' import useStore from '@/stores' import { MsgConfirm } from '@/utils/message' import InitParamDrawer from '@/views/tool/component/InitParamDrawer.vue' -import ToolFormDrawer from './component/ToolFormDrawer.vue' +import ToolFormDrawer from './ToolFormDrawer.vue' import { t } from '@/locales' +import { isAppIcon } from '@/utils/common' const { folder, user } = useStore() @@ -267,7 +277,7 @@ async function changeState(row: any) { const obj = { is_active: !row.is_active, } - ToolApi.putToolLib('default', row.id, obj, changeStateloading) + ToolApi.putTool('default', row.id, obj, changeStateloading) .then(() => { return true }) @@ -290,7 +300,7 @@ async function changeState(row: any) { const obj = { is_active: !row.is_active, } - ToolApi.putToolLib('default', row.id, obj, changeStateloading) + ToolApi.putTool('default', row.id, obj, changeStateloading) .then(() => { return true })