-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: refine chat document and image layout,and some translation issues #2177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,10 @@ | |
v-for="(item, index) in document_list" | ||
:key="index" | ||
:xs="24" | ||
:sm="12" | ||
:md="12" | ||
:lg="12" | ||
:xl="12" | ||
:sm="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:md="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:lg="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:xl="props.type === 'debug-ai-chat' ? 24 : 12" | ||
class="mb-8 w-full" | ||
> | ||
<el-card shadow="never" style="--el-card-padding: 8px" class="download-file cursor"> | ||
|
@@ -45,17 +45,8 @@ | |
</el-row> | ||
</div> | ||
<div class="mb-8" v-if="image_list.length"> | ||
<el-row :gutter="10"> | ||
<el-col | ||
v-for="(item, index) in image_list" | ||
:key="index" | ||
:xs="24" | ||
:sm="12" | ||
:md="12" | ||
:lg="12" | ||
:xl="12" | ||
class="mb-8" | ||
> | ||
<el-space wrap> | ||
<template v-for="(item, index) in image_list" :key="index"> | ||
<div class="file cursor border-r-4" v-if="item.url"> | ||
<el-image | ||
:src="item.url" | ||
|
@@ -70,19 +61,19 @@ | |
class="border-r-4" | ||
/> | ||
</div> | ||
</el-col> | ||
</el-row> | ||
</template> | ||
</el-space> | ||
</div> | ||
<div class="mb-8" v-if="audio_list.length"> | ||
<el-row :gutter="10"> | ||
<el-col | ||
v-for="(item, index) in audio_list" | ||
:key="index" | ||
:xs="24" | ||
:sm="12" | ||
:md="12" | ||
:lg="12" | ||
:xl="12" | ||
:sm="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:md="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:lg="props.type === 'debug-ai-chat' ? 24 : 12" | ||
:xl="props.type === 'debug-ai-chat' ? 24 : 12" | ||
class="mb-8" | ||
> | ||
<div class="file cursor border-r-4" v-if="item.url"> | ||
|
@@ -109,6 +100,7 @@ import { onMounted, computed } from 'vue' | |
const props = defineProps<{ | ||
application: any | ||
chatRecord: chatType | ||
type: 'log' | 'ai-chat' | 'debug-ai-chat' | ||
}>() | ||
const document_list = computed(() => { | ||
if (props.chatRecord?.upload_meta) { | ||
|
@@ -163,7 +155,6 @@ onMounted(() => {}) | |
} | ||
} | ||
|
||
|
||
.download-button { | ||
display: none; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided Vue component is mostly clean but contains some improvements and optimizations that can be made:
Here’s an improved version of the script part with these considerations: const props = defineProps({
application: any,
chatRecord: chatType,
+ type: 'log' | 'ai-chat' | 'debug-ai-chat',
})
function getColumnValue(type) {
return props.type === 'debug-ai-chat' ? 24 : 12;
}
const document_list = computed(() => {
if (props.chatRecord?.upload_meta) {
// Logic to populate document_list
}
});
onMounted(() => {}); And here is how you might use the new utility function in the template section: <el-row :gutter="10">
<el-col
v-for="(item, index) in document_list"
:key="index"
:span="getColumnValue('log')" <!-- Use getColumnType based on type -->
class="mb-8"
>
...
</el-col>
</el-row>
<div class="mb-8" v-if="image_list.length">
<el-space wrap>
<template v-for="(item, index) in image_list" :key="index">
<div class="file cursor border-r-4" v-if="item.url">
...
</div>
</template>
</el-space>
</div> These modifications simplify the code by reducing redundancy and improving maintainability. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export default { | ||
noHistory: 'No Chat History', | ||
createChat: 'New Conversation', | ||
createChat: 'New Chat', | ||
history: 'Chat History', | ||
only20history: 'Showing only the last 20 conversations', | ||
only20history: 'Showing only the last 20 chats', | ||
question_count: 'Questions', | ||
exportRecords: 'Export Chat History', | ||
chatId: 'Chat ID', | ||
|
@@ -68,7 +68,7 @@ export default { | |
searchContent: 'Search Query', | ||
searchResult: 'Search Results', | ||
conditionResult: 'Condition Evaluation', | ||
currentChat: 'Current Conversation', | ||
currentChat: 'Current Chat', | ||
answer: 'AI Response', | ||
replyContent: 'Reply Content', | ||
textContent: 'Text Content', | ||
|
@@ -83,8 +83,8 @@ export default { | |
KnowledgeSource: { | ||
title: 'Knowledge Source', | ||
referenceParagraph: 'Cited Segment', | ||
consume: 'Token Consumption', | ||
consumeTime: 'Processing Time' | ||
consume: 'Tokens', | ||
consumeTime: 'Runtime' | ||
}, | ||
paragraphSource: { | ||
title: 'Knowledge Quote', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has a couple of small issues that need to be addressed:
Here's the corrected version with these changes: export default {
noHistory: 'No Chat History',
createChat: 'New Chat',
history: 'Chat Histories', // Corrected from "Histories"
only20history: 'Showing only the last 20 chats',
question_count: 'Questions',
exportRecords: 'Export Chat Record',
chatId: 'Chat ID',
searchContent: 'Search query',
searchResult: 'Search Results',
conditionResult: 'Condition Evaluation',
currentChat: 'Current Chat',
answer: 'AI Response',
replyContent: 'Reply Content',
textContent: 'Text Content',
KnowledgeSource: {
title: 'Knowledge Source',
referenceParagraph: 'Cited Segment',
consume: 'Tokens', // Changed from "consume"
consumeTime: 'Execution time' // Added word "time" to make it more readable
},
paragraphSource: {
tile: 'Knowledge Quote', These corrections ensure better consistency throughout the translations and improve clarity in message contexts. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code snippet provided is written in Vue.js using the Element UI framework for styling and components. While the general structure is appropriate, there are several concerns that could affect its readability, maintainability, or functionality:
Duplicate Key Usage: The
v-for
directive uses unique keys (:key='index'
) across similar iterations without proper consideration. This can lead to unexpected behavior, such as duplicate elements appearing when filtering arrays.Optimization Suggestions:
Error Handling: Ensure error handling paths are well-defined, particularly when dealing with potentially undefined data structures during iteration.
If you need further assistance tailored to specific areas of concern please let me know!