Skip to content

Commit 73ab721

Browse files
feat: create application template
1 parent d8132fa commit 73ab721

File tree

10 files changed

+519
-21
lines changed

10 files changed

+519
-21
lines changed

ui/src/components/card-box/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function subHoveredEnter() {
8787
position: relative;
8888
min-height: var(--card-min-height);
8989
min-width: var(--card-min-width);
90+
line-height: 20px !important;
9091
.card-header {
9192
margin-top: -5px;
9293
}

ui/src/components/folder-tree/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function refreshFolder() {
251251
}
252252
.tree-height {
253253
padding-top: 4px;
254-
height: calc(100vh - 210px);
254+
height: calc(100vh - 175px);
255255
}
256256
}
257257
:deep(.overflow-inherit_node__children) {

ui/src/components/layout-container/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const showBack = computed(() => {
5353
5454
.layout-container__left_content {
5555
width: 100%;
56-
height: 100%;
56+
// height: 100%;
5757
}
5858
5959
&.hidden {

ui/src/locales/lang/en-US/views/application.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ export default {
5353
workflowPlaceholder: 'Suitable for advanced users to customize the workflow of assistant',
5454
},
5555
appTemplate: {
56-
blankApp: 'Blank APP',
57-
assistantApp: 'Knowledge Assistant',
56+
blankApp: {
57+
title: 'Blank APP',
58+
},
59+
assistantApp: {
60+
title: 'Knowledge Assistant',
61+
description: 'Suitable for advanced users to customize the workflow of assistant',
62+
},
5863
},
5964
aiModel: {
6065
label: 'AI Model',

ui/src/locales/lang/zh-CN/views/application.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { title } from 'process'
2+
13
export default {
24
title: '应用',
35
createApplication: '创建简易应用',
@@ -49,8 +51,13 @@ export default {
4951
workflowPlaceholder: '适合高级用户自定义小助手的工作流',
5052
},
5153
appTemplate: {
52-
blankApp: '空白应用',
53-
assistantApp: '知识库问答助手',
54+
blankApp: {
55+
title: '空白创建',
56+
},
57+
assistantApp: {
58+
title: '知识库问答助手',
59+
description: '基于用户问题,检索知识库相关内容作为AI模型的参考内容',
60+
},
5461
},
5562
aiModel: {
5663
label: 'AI 模型',

ui/src/locales/lang/zh-Hant/views/application.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ export default {
4747
simplePlaceholder: '適合新手建立小助手',
4848
workflowPlaceholder: '適合高階用戶自訂小助手的工作流程',
4949
},
50+
5051
appTemplate: {
51-
blankApp: '空白應用',
52-
assistantApp: '知識庫問答助手',
52+
blankApp: {
53+
title: '空白创建',
54+
},
55+
assistantApp: {
56+
title: '知識庫問答助手',
57+
description: '基於用戶問題,檢索知識庫相關內容作爲AI模型的參考內容',
58+
},
5359
},
5460
aiModel: {
5561
label: 'AI 模型',

ui/src/views/application/component/CreateApplicationDialog.vue

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,35 @@
4747
<el-row :gutter="16">
4848
<el-col :span="12">
4949
<el-card
50-
class="radio-card cursor"
50+
class="template-radio-card cursor text-center flex-center"
5151
shadow="never"
5252
@click="selectedType('blank')"
5353
:class="appTemplate === 'blank' ? 'active' : ''"
5454
>
55-
{{ $t('views.application.form.appTemplate.blankApp') }}
55+
<div class="flex-center p-24">
56+
<el-icon class="mr-12"><Plus /></el-icon>
57+
{{ $t('views.application.form.appTemplate.blankApp.title') }}
58+
</div>
5659
</el-card>
5760
</el-col>
5861
<el-col :span="12">
59-
<el-card
60-
class="radio-card cursor"
62+
<CardBox
63+
:title="$t('views.application.form.appTemplate.assistantApp.title')"
64+
:description="$t('views.application.form.appTemplate.assistantApp.description')"
6165
shadow="never"
66+
class="template-radio-card cursor"
6267
:class="appTemplate === 'assistant' ? 'active' : ''"
6368
@click="selectedType('assistant')"
6469
>
65-
{{ $t('views.application.form.appTemplate.assistantApp') }}
66-
</el-card>
70+
<template #icon>
71+
<LogoIcon height="32px" />
72+
</template>
73+
<template #subTitle>
74+
<el-text class="color-secondary" size="small">
75+
{{ $t('views.application.workflow') }}
76+
</el-text>
77+
</template>
78+
</CardBox>
6779
</el-col>
6880
</el-row>
6981
</div>
@@ -90,6 +102,7 @@ import applicationApi from '@/api/application/application'
90102
import { MsgSuccess, MsgAlert } from '@/utils/message'
91103
import { isWorkFlow } from '@/utils/application'
92104
import { baseNodes } from '@/workflow/common/data'
105+
import { applicationTemplate } from '@/views/application/template'
93106
import { t } from '@/locales'
94107
import useStore from '@/stores'
95108
const { user } = useStore()
@@ -220,7 +233,7 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
220233
if (!formEl) return
221234
await formEl.validate((valid) => {
222235
if (valid) {
223-
if (isWorkFlow(applicationForm.value.type) && appTemplate.value === 'blank') {
236+
if (isWorkFlow(applicationForm.value.type)) {
224237
workflowDefault.value.nodes[0].properties.node_data.desc = applicationForm.value.desc
225238
workflowDefault.value.nodes[0].properties.node_data.name = applicationForm.value.name
226239
applicationForm.value['work_flow'] = workflowDefault.value
@@ -248,17 +261,18 @@ const submitHandle = async (formEl: FormInstance | undefined) => {
248261
249262
function selectedType(type: string) {
250263
appTemplate.value = type
264+
workflowDefault.value = applicationTemplate[type]
251265
}
252266
253267
defineExpose({ open })
254268
</script>
255269
<style lang="scss" scoped>
256-
.radio-card {
257-
line-height: 22px;
270+
.template-radio-card {
271+
height: 130px !important;
272+
min-height: 130px !important;
258273
259274
&.active {
260275
border-color: var(--el-color-primary);
261-
color: var(--el-color-primary);
262276
}
263277
}
264278
</style>

ui/src/views/application/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
:limit="1"
102102
:on-change="(file: any, fileList: any) => importApplication(file)"
103103
>
104-
<el-dropdown-item class="w-full">
104+
<el-dropdown-item>
105105
<div class="flex align-center w-full">
106106
<el-avatar shape="square" class="mt-4" :size="36" style="background: none">
107107
<img src="@/assets/icon_import.svg" alt="" />
@@ -129,7 +129,7 @@
129129
</template>
130130
<div
131131
v-loading.fullscreen.lock="paginationConfig.current_page === 1 && loading"
132-
style="max-height: calc(100vh - 140px)"
132+
style="max-height: calc(100vh - 120px)"
133133
>
134134
<InfiniteScroll
135135
:size="applicationList.length"

0 commit comments

Comments
 (0)