Skip to content

Commit 718b668

Browse files
perf: Optimize front-end code
1 parent 3c46251 commit 718b668

File tree

40 files changed

+728
-581
lines changed

40 files changed

+728
-581
lines changed

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ const imageExtensions = ['JPG', 'JPEG', 'PNG', 'GIF', 'BMP']
372372
const documentExtensions = ['PDF', 'DOCX', 'TXT', 'XLS', 'XLSX', 'MD', 'HTML', 'CSV']
373373
const videoExtensions: any = []
374374
const audioExtensions = ['MP3', 'WAV', 'OGG', 'AAC', 'M4A']
375-
let otherExtensions = ref(['PPT', 'DOC'])
375+
const otherExtensions = ref(['PPT', 'DOC'])
376376
377377
const getAcceptList = () => {
378378
const { image, document, audio, video, other } = props.applicationDetails.file_upload_setting
@@ -554,7 +554,7 @@ const switchMicrophone = (status: boolean) => {
554554
}
555555
}
556556
557-
const TouchEnd = (bool?: Boolean) => {
557+
const TouchEnd = (bool?: boolean) => {
558558
if (bool) {
559559
stopRecording()
560560
recorderStatus.value = 'STOP'

ui/src/components/ai-chat/component/control/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const menus = ref([
9999
*/
100100
const clearSelectedText = () => {
101101
if (window.getSelection) {
102-
var selection = window.getSelection()
102+
const selection = window.getSelection()
103103
if (selection) {
104104
selection.removeAllRanges()
105105
}

ui/src/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue

Lines changed: 669 additions & 517 deletions
Large diffs are not rendered by default.

ui/src/components/ai-chat/component/user-form/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ watch(
106106
107107
function handleInputFieldList() {
108108
dynamicsFormRefresh.value++
109-
let default_value: any = {}
109+
const default_value: any = {}
110110
props.application.work_flow?.nodes
111111
?.filter((v: any) => v.id === 'base-node')
112112
.map((v: any) => {
@@ -312,8 +312,8 @@ const validate = () => {
312312
}
313313
const validate_query = () => {
314314
// 浏览器query参数找到接口传参
315-
let msg = []
316-
for (let f of apiInputFieldList.value) {
315+
const msg = []
316+
for (const f of apiInputFieldList.value) {
317317
if (f.required && !api_form_data_context.value[f.field]) {
318318
msg.push(f.field)
319319
}
@@ -328,9 +328,9 @@ const validate_query = () => {
328328
}
329329
330330
const initRouteQueryValue = () => {
331-
for (let f of apiInputFieldList.value) {
331+
for (const f of apiInputFieldList.value) {
332332
if (!api_form_data_context.value[f.field]) {
333-
let _value = getRouteQueryValue(f.field)
333+
const _value = getRouteQueryValue(f.field)
334334
if (_value != null) {
335335
api_form_data_context.value[f.field] = _value
336336
}

ui/src/components/ai-chat/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function sendMessage(val: string, other_params_data?: any, chat?: chatType): Pro
277277
return userFormRef.value
278278
?.validate()
279279
.then((ok) => {
280-
let userFormData = accessToken
280+
const userFormData = accessToken
281281
? JSON.parse(localStorage.getItem(`${accessToken}userForm`) || '{}')
282282
: {}
283283
const newData = Object.keys(form_data.value).reduce((result: any, key: string) => {
@@ -640,7 +640,7 @@ const handleScroll = () => {
640640
641641
onMounted(() => {
642642
if (isUserInput.value && localStorage.getItem(`${accessToken}userForm`)) {
643-
let userFormData = JSON.parse(localStorage.getItem(`${accessToken}userForm`) || '{}')
643+
const userFormData = JSON.parse(localStorage.getItem(`${accessToken}userForm`) || '{}')
644644
form_data.value = userFormData
645645
}
646646
if (window.speechSynthesis) {

ui/src/components/back-button/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ const emit = defineEmits(['click'])
1919
const back: any = router.options.history.state.back
2020
function jump() {
2121
if (props.to === '-1') {
22-
back ? router.push(back) : router.go(-1)
22+
if (back) {
23+
router.push(back)
24+
} else {
25+
router.go(-1)
26+
}
2327
} else if (props.to) {
2428
router.push(props.to as RouteLocationRaw)
2529
} else {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ const resourceType = computed(() => {
149149
return 'model'
150150
} else if (props.source === 'TOOL') {
151151
return 'tool'
152+
} else {
153+
return 'application'
152154
}
153155
})
154156

ui/src/components/markdown/EchartsRander.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ function evalParseOption(option_json: any) {
4444
if (option_json.style) {
4545
style.value = option_json.style
4646
}
47-
let option = {}
48-
echarts
47+
const option = {}
4948
tmp.value = echarts
5049
eval(option_json.option)
5150
return option

ui/src/components/markdown/HtmlRander.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ onMounted(() => {
2020
range.selectNode(htmlRef.value)
2121
const scripts = htmlRef.value.getElementsByTagName('script')
2222
if (scripts) {
23-
var documentFragment = range.createContextualFragment(
23+
const documentFragment = range.createContextualFragment(
2424
[...scripts]
2525
.map((item: HTMLElement) => {
2626
htmlRef.value?.removeChild(item)

ui/src/components/markdown/MdEditorMagnify.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import { ref, computed, watch } from 'vue'
2929
defineOptions({ name: 'MdEditorMagnify' })
3030
const props = defineProps<{
31-
title: String
31+
title: string
3232
modelValue: any
3333
}>()
3434
const emit = defineEmits(['update:modelValue', 'submitDialog'])

0 commit comments

Comments
 (0)