Skip to content

Commit 5e02809

Browse files
committed
feat: add support for handling and displaying additional file types in the chat interface
1 parent 6fe001f commit 5e02809

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

ui/src/api/type/application.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ interface chatType {
7272
document_list: Array<any>
7373
image_list: Array<any>
7474
audio_list: Array<any>
75+
other_list: Array<any>
7576
}
7677
}
7778

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,28 @@
125125
</template>
126126
</el-space>
127127
</div>
128+
<div v-if="item.other_list?.length > 0">
129+
<p class="mb-8 color-secondary">
130+
{{ $t('common.fileUpload.document') }}:
131+
</p>
132+
133+
<el-space wrap>
134+
<template v-for="(f, i) in item.other_list" :key="i">
135+
<el-card
136+
shadow="never"
137+
style="--el-card-padding: 8px"
138+
class="file cursor"
139+
>
140+
<div class="flex align-center">
141+
<img :src="getImgUrl(f && f?.name)" alt="" width="24" />
142+
<div class="ml-4 ellipsis" :title="f && f?.name">
143+
{{ f && f?.name }}
144+
</div>
145+
</div>
146+
</el-card>
147+
</template>
148+
</el-space>
149+
</div>
128150
</div>
129151
</div>
130152
</template>

ui/src/components/ai-chat/component/question-content/index.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@
6060
</template>
6161
</el-space>
6262
</div>
63+
<div class="mb-8" v-if="other_list.length">
64+
<el-space wrap class="w-full media-file-width">
65+
<template v-for="(item, index) in other_list" :key="index">
66+
<el-card shadow="never" style="--el-card-padding: 8px" class="download-file cursor">
67+
<div class="download-button flex align-center" @click="downloadFile(item)">
68+
<el-icon class="mr-4">
69+
<Download />
70+
</el-icon>
71+
{{ $t('chat.download') }}
72+
</div>
73+
<div class="show flex align-center">
74+
<img :src="getImgUrl(item && item?.name)" alt="" width="24" />
75+
<div class="ml-4 ellipsis-1" :title="item && item?.name">
76+
{{ item && item?.name }}
77+
</div>
78+
</div>
79+
</el-card>
80+
</template>
81+
</el-space>
82+
</div>
6383
<span> {{ chatRecord.problem_text }}</span>
6484
</div>
6585
</div>
@@ -121,6 +141,15 @@ const audio_list = computed(() => {
121141
)
122142
return startNode?.audio_list || []
123143
})
144+
const other_list = computed(() => {
145+
if (props.chatRecord?.upload_meta) {
146+
return props.chatRecord.upload_meta?.other_list || []
147+
}
148+
const startNode = props.chatRecord.execution_details?.find(
149+
(detail) => detail.type === 'start-node'
150+
)
151+
return startNode?.other_list || []
152+
})
124153
125154
function downloadFile(item: any) {
126155
downloadByURL(item.url, item.name)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_para
424424
? other_params_data.document_list
425425
: [],
426426
audio_list:
427-
other_params_data && other_params_data.audio_list ? other_params_data.audio_list : []
427+
other_params_data && other_params_data.audio_list ? other_params_data.audio_list : [],
428+
other_list:
429+
other_params_data && other_params_data.other_list ? other_params_data.other_list : []
428430
}
429431
})
430432
chatList.value.push(chat)

0 commit comments

Comments
 (0)