Skip to content

Commit d9bd35e

Browse files
authored
fix: ui (#3302)
1 parent 4e5285c commit d9bd35e

File tree

15 files changed

+117
-112
lines changed

15 files changed

+117
-112
lines changed

ui/src/assets/404.png

359 KB
Loading

ui/src/main.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ import 'highlight.js/styles/atom-one-dark.css'
2828
config({
2929
editorExtensions: {
3030
highlight: {
31-
instance: highlight
31+
instance: highlight,
3232
},
3333
screenfull: {
34-
instance: screenfull
34+
instance: screenfull,
3535
},
3636
katex: {
37-
instance: katex
37+
instance: katex,
3838
},
3939
cropper: {
40-
instance: Cropper
40+
instance: Cropper,
4141
},
4242
mermaid: {
43-
instance: mermaid
44-
}
45-
}
43+
instance: mermaid,
44+
},
45+
},
4646
})
4747
const app = createApp(App)
4848
app.use(createPinia())
@@ -62,4 +62,3 @@ app.use(router)
6262
app.use(i18n)
6363
app.use(Components)
6464
app.mount('#app')
65-
export { app }

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ import type { FormField } from '@/components/dynamics-form/type'
4646
import modelAPi from '@/api/model/model'
4747
import applicationApi from '@/api/application/application'
4848
import DynamicsForm from '@/components/dynamics-form/index.vue'
49-
import { keys } from 'lodash'
50-
import { app } from '@/main'
51-
import { MsgError } from '@/utils/message'
52-
49+
import { useRoute } from 'vue-router'
50+
const route = useRoute()
5351
const {
54-
params: { id }
55-
} = app.config.globalProperties.$route as any
52+
params: { id },
53+
} = route as any
5654
5755
const tts_model_id = ref('')
5856
const model_form_field = ref<Array<FormField>>([])
@@ -75,7 +73,7 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
7573
model_form_field.value = ok.data
7674
const resp = ok.data
7775
.map((item: any) => ({
78-
[item.field]: item.show_default_value !== false ? item.default_value : undefined
76+
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
7977
}))
8078
.reduce((x, y) => ({ ...x, ...y }), {})
8179
// 删除不存在的字段
@@ -99,7 +97,7 @@ const reset_default = (model_id: string, application_id?: string) => {
9997
model_form_field.value = ok.data
10098
const model_setting_data = ok.data
10199
.map((item) => ({
102-
[item.field]: item.show_default_value !== false ? item.default_value : undefined
100+
[item.field]: item.show_default_value !== false ? item.default_value : undefined,
103101
}))
104102
.reduce((x, y) => ({ ...x, ...y }), {})
105103
@@ -118,7 +116,7 @@ const audioPlayer = ref<HTMLAudioElement | null>(null)
118116
const testPlay = () => {
119117
const data = {
120118
...form_data.value,
121-
tts_model_id: tts_model_id.value
119+
tts_model_id: tts_model_id.value,
122120
}
123121
// applicationApi
124122
// .playDemoText(id as string, data, playLoading)

ui/src/workflow/common/NodeContainer.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@
166166
</template>
167167
<script setup lang="ts">
168168
import { ref, computed, onMounted } from 'vue'
169-
import { app } from '@/main'
170169
import DropdownMenu from '@/views/application-workflow/component/DropdownMenu.vue'
171170
import { set } from 'lodash'
172171
import { iconComponent } from '../icons/utils'
@@ -175,9 +174,11 @@ import { WorkflowType } from '@/enums/application'
175174
import { MsgError, MsgConfirm } from '@/utils/message'
176175
import type { FormInstance } from 'element-plus'
177176
import { t } from '@/locales'
177+
import { useRoute } from 'vue-router'
178+
const route = useRoute()
178179
const {
179180
params: { id },
180-
} = app.config.globalProperties.$route as any
181+
} = route as any
181182
182183
const height = ref<{
183184
stepContainerHeight: number

ui/src/workflow/nodes/ai-chat-node/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@
170170
</template>
171171
<script setup lang="ts">
172172
import { cloneDeep, set, groupBy } from 'lodash'
173-
import { app } from '@/main'
174173
import NodeContainer from '@/workflow/common/NodeContainer.vue'
175174
import type { FormInstance } from 'element-plus'
176175
import { ref, computed, onMounted } from 'vue'
@@ -182,6 +181,8 @@ import AIModeParamSettingDialog from '@/views/application/component/AIModeParamS
182181
import { t } from '@/locales'
183182
import ReasoningParamSettingDialog from '@/views/application/component/ReasoningParamSettingDialog.vue'
184183
import McpServersDialog from '@/views/application/component/McpServersDialog.vue'
184+
import { useRoute } from 'vue-router'
185+
const route = useRoute()
185186
const { model } = useStore()
186187
187188
const wheel = (e: any) => {
@@ -211,7 +212,7 @@ const model_change = (model_id?: string) => {
211212
}
212213
const {
213214
params: { id },
214-
} = app.config.globalProperties.$route as any
215+
} = route as any
215216
216217
// @ts-ignore
217218
const defaultPrompt = `${t('views.applicationWorkflow.nodes.aiChatNode.defaultPrompt')}:

ui/src/workflow/nodes/application-node/index.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
prop="question_reference_address"
1616
:rules="{
1717
message: $t(
18-
'views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.requiredMessage'
18+
'views.applicationWorkflow.nodes.searchKnowledgeNode.searchQuestion.requiredMessage',
1919
),
2020
trigger: 'blur',
21-
required: true
21+
required: true,
2222
}"
2323
>
2424
<NodeCascader
@@ -39,7 +39,7 @@
3939
:rules="{
4040
message: $t('views.chatLog.documentPlaceholder'),
4141
trigger: 'blur',
42-
required: false
42+
required: false,
4343
}"
4444
>
4545
<NodeCascader
@@ -57,10 +57,10 @@
5757
prop="image_list"
5858
:rules="{
5959
message: $t(
60-
'views.applicationWorkflow.nodes.imageUnderstandNode.image.requiredMessage'
60+
'views.applicationWorkflow.nodes.imageUnderstandNode.image.requiredMessage',
6161
),
6262
trigger: 'blur',
63-
required: false
63+
required: false,
6464
}"
6565
>
6666
<NodeCascader
@@ -81,7 +81,7 @@
8181
:rules="{
8282
message: $t('views.applicationWorkflow.nodes.speechToTextNode.audio.placeholder'),
8383
trigger: 'blur',
84-
required: false
84+
required: false,
8585
}"
8686
>
8787
<NodeCascader
@@ -100,8 +100,8 @@
100100
{
101101
required: field.is_required,
102102
message: `${$t('common.inputPlaceholder')}${field.variable}`,
103-
trigger: 'blur'
104-
}
103+
trigger: 'blur',
104+
},
105105
]"
106106
>
107107
<NodeCascader
@@ -124,8 +124,8 @@
124124
{
125125
required: field.required,
126126
message: `${$t('common.inputPlaceholder')}${field.label}`,
127-
trigger: 'blur'
128-
}
127+
trigger: 'blur',
128+
},
129129
]"
130130
>
131131
<NodeCascader
@@ -167,26 +167,26 @@
167167

168168
<script setup lang="ts">
169169
import { set, groupBy, create, cloneDeep } from 'lodash'
170-
import { app } from '@/main'
171170
import NodeContainer from '@/workflow/common/NodeContainer.vue'
172171
import { ref, computed, onMounted, onActivated } from 'vue'
173172
import NodeCascader from '@/workflow/common/NodeCascader.vue'
174173
import type { FormInstance } from 'element-plus'
175174
import applicationApi from '@/api/application/application'
176175
import { isWorkFlow } from '@/utils/application'
177-
176+
import { useRoute } from 'vue-router'
177+
const route = useRoute()
178178
const form = {
179179
question_reference_address: ['start-node', 'question'],
180180
api_input_field_list: [],
181181
user_input_field_list: [],
182182
document_list: ['start-node', 'document'],
183183
image_list: ['start-node', 'image'],
184-
audio_list: ['start-node', 'audio']
184+
audio_list: ['start-node', 'audio'],
185185
}
186186
187187
const {
188-
params: { id }
189-
} = app.config.globalProperties.$route as any
188+
params: { id },
189+
} = route as any
190190
191191
const applicationNodeFormRef = ref<FormInstance>()
192192
@@ -201,7 +201,7 @@ const form_data = computed({
201201
},
202202
set: (value) => {
203203
set(props.nodeModel.properties, 'node_data', value)
204-
}
204+
},
205205
})
206206
207207
function handleFileUpload(type: string, isEnabled: boolean) {

ui/src/workflow/nodes/base-node/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@
167167
</NodeContainer>
168168
</template>
169169
<script setup lang="ts">
170-
import { app } from '@/main'
171170
import { groupBy, set } from 'lodash'
172171
import NodeContainer from '@/workflow/common/NodeContainer.vue'
173172
import type { FormInstance } from 'element-plus'
@@ -180,10 +179,11 @@ import TTSModeParamSettingDialog from '@/views/application/component/TTSModePara
180179
import ApiInputFieldTable from './component/ApiInputFieldTable.vue'
181180
import UserInputFieldTable from './component/UserInputFieldTable.vue'
182181
import FileUploadSettingDialog from '@/workflow/nodes/base-node/component/FileUploadSettingDialog.vue'
183-
182+
import { useRoute } from 'vue-router'
183+
const route = useRoute()
184184
const {
185185
params: { id },
186-
} = app.config.globalProperties.$route as any
186+
} = route as any
187187
188188
const props = defineProps<{ nodeModel: any }>()
189189

ui/src/workflow/nodes/image-generate/index.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,18 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
156156
import { computed, onMounted, ref } from 'vue'
157157
import { groupBy, set } from 'lodash'
158158
import applicationApi from '@/api/application/application'
159-
import { app } from '@/main'
159+
160160
import useStore from '@/stores'
161161
import type { FormInstance } from 'element-plus'
162162
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
163163
import { t } from '@/locales'
164164
const { model } = useStore()
165165
166+
import { useRoute } from 'vue-router'
167+
const route = useRoute()
166168
const {
167169
params: { id },
168-
} = app.config.globalProperties.$route as any
170+
} = route as any
169171
170172
const props = defineProps<{ nodeModel: any }>()
171173
const modelOptions = ref<any>(null)

ui/src/workflow/nodes/image-understand/index.vue

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
:rules="{
1818
required: true,
1919
message: $t(
20-
'views.applicationWorkflow.nodes.imageUnderstandNode.model.requiredMessage'
20+
'views.applicationWorkflow.nodes.imageUnderstandNode.model.requiredMessage',
2121
),
22-
trigger: 'change'
22+
trigger: 'change',
2323
}"
2424
>
2525
<template #label>
@@ -70,7 +70,7 @@
7070
:rules="{
7171
required: true,
7272
message: $t('views.application.form.prompt.requiredMessage'),
73-
trigger: 'blur'
73+
trigger: 'blur',
7474
}"
7575
>
7676
<template #label>
@@ -82,9 +82,7 @@
8282
>
8383
</div>
8484
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
85-
<template #content
86-
>{{ $t('views.application.form.prompt.tooltip') }}
87-
</template>
85+
<template #content>{{ $t('views.application.form.prompt.tooltip') }} </template>
8886
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
8987
</el-tooltip>
9088
</div>
@@ -123,9 +121,9 @@
123121
type: 'array',
124122
required: true,
125123
message: $t(
126-
'views.applicationWorkflow.nodes.imageUnderstandNode.image.requiredMessage'
124+
'views.applicationWorkflow.nodes.imageUnderstandNode.image.requiredMessage',
127125
),
128-
trigger: 'change'
126+
trigger: 'change',
129127
}"
130128
>
131129
<template #label
@@ -149,10 +147,9 @@
149147
<template #label>
150148
<div class="flex align-center">
151149
<div class="mr-4">
152-
<span
153-
>{{ $t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
154-
}}</span
155-
>
150+
<span>{{
151+
$t('views.applicationWorkflow.nodes.aiChatNode.returnContent.label')
152+
}}</span>
156153
</div>
157154
<el-tooltip effect="dark" placement="right" popper-class="max-w-200">
158155
<template #content>
@@ -175,17 +172,19 @@ import NodeContainer from '@/workflow/common/NodeContainer.vue'
175172
import { computed, onMounted, ref } from 'vue'
176173
import { groupBy, set } from 'lodash'
177174
import applicationApi from '@/api/application/application'
178-
import { app } from '@/main'
175+
179176
import useStore from '@/stores'
180177
import NodeCascader from '@/workflow/common/NodeCascader.vue'
181178
import type { FormInstance } from 'element-plus'
182179
import AIModeParamSettingDialog from '@/views/application/component/AIModeParamSettingDialog.vue'
183180
import { t } from '@/locales'
184181
const { model } = useStore()
185182
183+
import { useRoute } from 'vue-router'
184+
const route = useRoute()
186185
const {
187-
params: { id }
188-
} = app.config.globalProperties.$route as any
186+
params: { id },
187+
} = route as any
189188
190189
const props = defineProps<{ nodeModel: any }>()
191190
const modelOptions = ref<any>(null)
@@ -196,7 +195,7 @@ const nodeCascaderRef = ref()
196195
const validate = () => {
197196
return Promise.all([
198197
nodeCascaderRef.value ? nodeCascaderRef.value.validate() : Promise.resolve(''),
199-
aiChatNodeFormRef.value?.validate()
198+
aiChatNodeFormRef.value?.validate(),
200199
]).catch((err: any) => {
201200
return Promise.reject({ node: props.nodeModel, errMessage: err })
202201
})
@@ -223,7 +222,7 @@ const form = {
223222
is_result: true,
224223
temperature: null,
225224
max_tokens: null,
226-
image_list: ['start-node', 'image']
225+
image_list: ['start-node', 'image'],
227226
}
228227
229228
const form_data = computed({
@@ -237,7 +236,7 @@ const form_data = computed({
237236
},
238237
set: (value) => {
239238
set(props.nodeModel.properties, 'node_data', value)
240-
}
239+
},
241240
})
242241
243242
function getModel() {

0 commit comments

Comments
 (0)