-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Support searching application conversation logs by user #3922
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 |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ export default { | |
| }, | ||
| table: { | ||
| abstract: '摘要', | ||
| username: '用户', | ||
| chat_record_count: '对话提问数', | ||
| user: '用户', | ||
| feedback: { | ||
|
Contributor
Author
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 code snippet seems to be part of a configuration file for iView UI components, possibly related to displaying tables with specific properties like titles. Here’s a quick review: Potential Issues and Suggestions
Here's a slightly optimized version of the code without duplicating the same key: export default {
// other configurations...
table: {
abstract: '摘要',
username: '用户', // Assuming a consistent naming convention here
chat_record_count: '对话提问数'
},
feedback: { // ...other configurations may follow as needed }
};By addressing these points, the code will be more robust and easier to maintain. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,23 @@ | |
|
|
||
| <el-card style="--el-card-padding: 24px"> | ||
| <div class="mb-16"> | ||
| <el-select | ||
| v-model="query_option" | ||
| class="mr-12" | ||
| @change="search_type_change" | ||
| style="width: 75px" | ||
| > | ||
| <el-option :label="$t('views.chatLog.table.abstract')" value="abstract" /> | ||
| <el-option :label="$t('views.chatLog.table.username')" value="username" /> | ||
| </el-select> | ||
| <el-input | ||
| v-model="search" | ||
| @change="getList" | ||
| :placeholder="$t('common.search')" | ||
| prefix-icon="Search" | ||
| class="w-240 mr-12" | ||
| clearable | ||
| /> | ||
| <el-select | ||
| v-model="history_day" | ||
| class="mr-12" | ||
|
|
@@ -29,14 +46,6 @@ | |
| style="width: 240px" | ||
| class="mr-12" | ||
| /> | ||
| <el-input | ||
| v-model="search" | ||
| @change="getList" | ||
| :placeholder="$t('common.search')" | ||
| prefix-icon="Search" | ||
| class="w-240" | ||
| clearable | ||
| /> | ||
| <div style="display: flex; align-items: center" class="float-right"> | ||
| <el-button @click="dialogVisible = true" v-if="permissionPrecise.chat_log_clear(id)"> | ||
| {{ $t('views.chatLog.buttons.clearStrategy') }} | ||
|
|
@@ -256,6 +265,15 @@ const { | |
| const emit = defineEmits(['refresh']) | ||
| const formRef = ref() | ||
|
|
||
| const search_form = ref<any>({ | ||
| abstract: '', | ||
| username: '', | ||
| }) | ||
|
|
||
| const search_type_change = () => { | ||
| search_form.value = {abstract: '', username: ''} | ||
| } | ||
|
|
||
| const dayOptions = [ | ||
| { | ||
| value: 7, | ||
|
|
@@ -308,6 +326,7 @@ const tableIndexMap = computed<Dict<number>>(() => { | |
| .reduce((pre, next) => ({ ...pre, ...next }), {}) | ||
| }) | ||
| const history_day = ref<number | string>(7) | ||
| const query_option = ref<string>('abstract') | ||
|
|
||
| const search = ref('') | ||
| const detail = ref<any>(null) | ||
|
|
@@ -416,7 +435,8 @@ function getList() { | |
| ...filter.value, | ||
| } | ||
| if (search.value) { | ||
| obj = { ...obj, abstract: search.value } | ||
| if (query_option.value === 'abstract'){obj = { ...obj, abstract: search.value }} | ||
| else if (query_option.value === 'username'){obj = { ...obj, username: search.value }} | ||
| } | ||
| return loadSharedApi({ type: 'chatLog', systemType: apiType.value }) | ||
| .getChatLog(id as string, paginationConfig, obj, loading) | ||
|
Contributor
Author
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. Here's a concise review of the provided code with suggestions for improvements: Improvements:
Suggestions:// Step 1: Remove duplicate instances of search_form
const emit = defineEmits(['refresh']);
const formRef = ref();
const search = ref('');
const detail = ref<any>(null);
const filter = ref({});
const tableIndexMap = computed(() => {}); // Assuming this remains same
const history_day = ref(7);
const searchForm = ref({
abstract: '',
username: ''
});
// Step 2: Refactor search_type_change logic
const handleSearchOptionChange = () => {
searchForm.value.abstract = '';
searchForm.value.username = '';
};
// Step 3: Simplify search option handling outside getList
if (searchForm[queryOption].value.length > 0) {
obj = { ...obj, [`${queryOption}Name`]: search };
}
// Updated getList function without redundant properties assignment
function getList() {
const params = {
userIdList: userInfos || [],
systemType: apiType.value,
pageSize: paginationConfig.pageSize,
pageNum: paginationConfig.currentPage,
statusSet: setStatus ? [...setStatus] : null as number[] | undefined,
sortParamJsonStr: {},
...filter.value,
...{ [queryOption]: search.value }
};
return loadSharedApi({ type: 'chatLog', systemType: apiType.value })
.getChatLog(id as string, paginationConfig, params, loading);
}
// Additional changes based on feedback:
// Keep the rest of the existing code clean and focused.This set of improvements enhances maintainability, reduces redundancy, and optimizes certain parts of the code while maintaining clarity. |
||
|
|
||
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.
Here are some observations and improvements regarding your code:
Duplicate Entries for
userField:'user'appears twice in the translation object (user: 'User', feedback: { ... }). It is recommended to ensure consistency by removing one of these entries.Potential Typographical Error in "Title" Translation:
Consistency Check with Feedback Structure:
Language Specifics:
This refactored version maintains clarity and separates structure definition from use, which can improve readability and maintainability in larger applications.