Skip to content

Commit 56a8795

Browse files
committed
feat: add local and URL upload options with validation messages
1 parent 8c08366 commit 56a8795

File tree

11 files changed

+474
-110
lines changed

11 files changed

+474
-110
lines changed

ui/src/api/image.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Result } from '@/request/Result'
2-
import { get, post, del, put } from '@/request/index'
1+
import {Result} from '@/request/Result'
2+
import {get, post, del, put} from '@/request/index'
33

44
const prefix = '/oss/file'
55
/**
@@ -10,6 +10,10 @@ const postImage: (data: any) => Promise<Result<any>> = (data) => {
1010
return post(`${prefix}`, data)
1111
}
1212

13+
const getFile: (params: any) => Promise<Result<any>> = (params) => {
14+
return get(`/oss/get_url` , params)
15+
}
1316
export default {
1417
postImage,
18+
getFile
1519
}

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

Lines changed: 405 additions & 87 deletions
Large diffs are not rendered by default.

ui/src/locales/lang/en-US/ai-chat.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ export default {
8181
errorMessage: 'Upload Failed',
8282
fileMessage: 'Please process the file content',
8383
fileRepeat: 'File already exists',
84+
invalidUrl: 'Invalid URL',
85+
localUpload: 'Local Upload',
86+
urlPlaceholder: 'Please enter URL addresses, one per line',
87+
urlTitle: 'URL Address',
88+
urlErrorMessage: 'File type does not meet requirements'
8489
},
8590
executionDetails: {
8691
title: 'Execution Details',

ui/src/locales/lang/en-US/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export default {
6161
other: 'Other',
6262
addExtensions: 'Add Extensions',
6363
existingExtensionsTip: 'The following extensions already exist',
64+
localUpload: 'Local Files',
65+
urlUpload: 'URL',
6466
},
6567
status: {
6668
label: 'Status',

ui/src/locales/lang/zh-CN/ai-chat.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export default {
7979
errorMessage: '上传失败',
8080
fileMessage: '请解析文件内容',
8181
fileRepeat: '文件已存在',
82+
invalidUrl: '无效的URL',
83+
localUpload: '本地上传',
84+
urlPlaceholder: '请输入 URL 地址,每行一个地址',
85+
urlTitle: 'URL 地址',
86+
urlErrorMessage: '文件类型不符合要求'
8287
},
8388
executionDetails: {
8489
title: '执行详情',

ui/src/locales/lang/zh-CN/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export default {
6262
other: '其他文件',
6363
addExtensions: '添加后缀名',
6464
existingExtensionsTip: '文件后缀已存在',
65+
localUpload: '本地文件',
66+
urlUpload: 'URL 地址',
6567
},
6668
status: {
6769
label: '状态',

ui/src/locales/lang/zh-Hant/ai-chat.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export default {
7979
fileMessage: '請解析文件內容',
8080
errorMessage: '上傳失敗',
8181
fileRepeat: '文件已存在',
82+
invalidUrl: '无效的URL',
83+
localUpload: '本地上傳',
84+
urlPlaceholder: '請輸入 URL 地址,每行一個地址',
85+
urlTitle: 'URL 地址',
86+
urlErrorMessage: '文件类型不符合要求'
8287
},
8388
executionDetails: {
8489
title: '執行詳細',

ui/src/locales/lang/zh-Hant/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export default {
6161
other: '其他文件',
6262
addExtensions: '添加後綴名',
6363
existingExtensionsTip: '文件後綴已存在',
64+
localUpload: '本地文件',
65+
urlUpload: 'URL 地址',
6466
},
6567
status: {
6668
label: '狀態',

ui/src/views/application-overview/component/StatisticsCharts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const statisticsType = computed(() => [
199199
},
200200
])
201201
202-
const topOptions = [{ label: 'TOP 10', value: 10 }]
202+
const topOptions = [{ label: 'TOP 10', value: 10 }, { label: 'TOP 20', value: 20}, { label: 'TOP 50', value: 50}, { label: 'TOP 100', value: 100}]
203203
const tokenUsageCount = ref(10)
204204
const topQuestionsCount = ref(10)
205205
const tokenUsageOption = computed(() => {

ui/src/workflow/nodes/base-node/component/FileUploadSettingDialog.vue

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
>
5656
<div class="flex-between">
5757
<div class="flex align-center">
58-
<img class="mr-12" src="@/assets/workflow/icon_file-doc.svg" alt="" />
58+
<img class="mr-12" src="@/assets/workflow/icon_file-doc.svg" alt=""/>
5959
<div>
6060
<p class="line-height-22 mt-4">
6161
{{ $t('common.fileUpload.document') }}
6262
<el-text class="color-secondary"
63-
>{{
63+
>{{
6464
$t(
6565
'views.applicationWorkflow.nodes.baseNode.FileUploadSetting.fileUploadType.documentText',
6666
)
@@ -85,12 +85,12 @@
8585
>
8686
<div class="flex-between">
8787
<div class="flex align-center">
88-
<img class="mr-12" src="@/assets/workflow/icon_file-image.svg" alt="" />
88+
<img class="mr-12" src="@/assets/workflow/icon_file-image.svg" alt=""/>
8989
<div>
9090
<p class="line-height-22 mt-4">
9191
{{ $t('common.fileUpload.image') }}
9292
<el-text class="color-secondary"
93-
>{{
93+
>{{
9494
$t(
9595
'views.applicationWorkflow.nodes.baseNode.FileUploadSetting.fileUploadType.imageText',
9696
)
@@ -116,12 +116,12 @@
116116
>
117117
<div class="flex-between">
118118
<div class="flex align-center">
119-
<img class="mr-12" src="@/assets/workflow/icon_file-audio.svg" alt="" />
119+
<img class="mr-12" src="@/assets/workflow/icon_file-audio.svg" alt=""/>
120120
<div>
121121
<p class="line-height-22 mt-4">
122122
{{ $t('common.fileUpload.audio') }}
123123
<el-text class="color-secondary"
124-
>{{
124+
>{{
125125
$t(
126126
'views.applicationWorkflow.nodes.baseNode.FileUploadSetting.fileUploadType.audioText',
127127
)
@@ -156,7 +156,7 @@
156156
<p class="line-height-22 mt-4">
157157
{{ $t('common.fileUpload.video') }}
158158
<el-text class="color-secondary"
159-
>{{
159+
>{{
160160
$t(
161161
'views.applicationWorkflow.nodes.baseNode.FileUploadSetting.fileUploadType.videoText',
162162
)
@@ -181,12 +181,12 @@
181181
>
182182
<div class="flex-between">
183183
<div class="flex align-center">
184-
<img class="mr-12" :width="32" src="@/assets/fileType/unknown-icon.svg" alt="" />
184+
<img class="mr-12" :width="32" src="@/assets/fileType/unknown-icon.svg" alt=""/>
185185
<div>
186186
<p class="line-height-22 mt-4">
187187
{{ $t('common.fileUpload.other') }}
188188
<el-text class="color-secondary"
189-
>{{
189+
>{{
190190
$t(
191191
'views.applicationWorkflow.nodes.baseNode.FileUploadSetting.fileUploadType.otherText',
192192
)
@@ -230,6 +230,21 @@
230230
/>
231231
</div>
232232
</el-card>
233+
<el-form-item>
234+
<div class="flex align-center">
235+
<el-checkbox
236+
v-model="form_data.local_upload"
237+
class="mr-16"
238+
>
239+
{{ $t('common.fileUpload.localUpload') }}
240+
</el-checkbox>
241+
<el-checkbox
242+
v-model="form_data.url_upload"
243+
>
244+
{{ $t('common.fileUpload.urlUpload') }}
245+
</el-checkbox>
246+
</div>
247+
</el-form-item>
233248
</el-form-item>
234249
</el-form>
235250
</div>
@@ -246,11 +261,11 @@
246261
</template>
247262

248263
<script setup lang="ts">
249-
import { nextTick, ref } from 'vue'
250-
import type { InputInstance } from 'element-plus'
251-
import { cloneDeep } from 'lodash'
252-
import { MsgWarning } from '@/utils/message'
253-
import { t } from '@/locales'
264+
import {nextTick, ref} from 'vue'
265+
import type {InputInstance} from 'element-plus'
266+
import {cloneDeep} from 'lodash'
267+
import {MsgWarning} from '@/utils/message'
268+
import {t} from '@/locales'
254269
255270
const emit = defineEmits(['refresh'])
256271
const props = defineProps<{ nodeModel: any }>()
@@ -276,12 +291,14 @@ const form_data = ref({
276291
video: false,
277292
other: false,
278293
otherExtensions: ['PPT', 'DOC'],
294+
local_upload: true,
295+
url_upload: false,
279296
})
280297
281298
function open(data: any) {
282299
dialogVisible.value = true
283300
nextTick(() => {
284-
form_data.value = { ...form_data.value, ...data }
301+
form_data.value = {...form_data.value, ...data}
285302
})
286303
}
287304

0 commit comments

Comments
 (0)