-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Whether the document support settings of the General Knowledge Base and Feishu Knowledge Base allow downloading #3924
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 |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ | |
| <span :title="data?.document_name?.trim()">{{ data?.document_name }}</span> | ||
| </a> | ||
| </div> | ||
| <div v-else @click="infoMessage"> | ||
| <div v-else @click="infoMessage(data)"> | ||
| <span class="ellipsis-1 break-all" :title="data?.document_name?.trim()"> | ||
| {{ data?.document_name?.trim() }} | ||
| </span> | ||
|
|
@@ -87,8 +87,12 @@ const parsedMeta = computed(() => { | |
| }) | ||
|
|
||
| const meta = computed(() => (isMetaObject.value ? props.data.meta : parsedMeta.value)) | ||
| function infoMessage() { | ||
| MsgInfo(t('chat.noDocument')) | ||
| function infoMessage(data: any) { | ||
| if (data?.meta?.allow_download === false) { | ||
| MsgInfo(t('chat.noPermissionDownload')) | ||
| } else { | ||
| MsgInfo(t('chat.noDocument')) | ||
| } | ||
| } | ||
| </script> | ||
| <style lang="scss" scoped></style> | ||
|
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 code looks mostly correct, with some minor improvements to enhance readability and functionality:
These updates make the code more efficient and easier to understand while maintaining the same behavior. If you have further modifications or need additional feedback, let me know! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ | |
| <span :title="item?.document_name?.trim()">{{ item?.document_name }}</span> | ||
| </a> | ||
| </div> | ||
| <div v-else @click="infoMessage"> | ||
| <div v-else @click="infoMessage(item)"> | ||
| <span class="ellipsis-1 break-all" :title="item?.document_name?.trim()"> | ||
| {{ item?.document_name?.trim() }} | ||
| </span> | ||
|
|
@@ -167,8 +167,12 @@ const currentComponent = shallowRef<any>(null) | |
| const currentChatDetail = ref<any>(null) | ||
| const dialogType = ref('') | ||
|
|
||
| function infoMessage() { | ||
| MsgInfo(t('chat.noDocument')) | ||
| function infoMessage(data: any) { | ||
| if (data?.meta?.allow_download === false) { | ||
| MsgInfo(t('chat.noPermissionDownload')) | ||
| } else { | ||
| MsgInfo(t('chat.noDocument')) | ||
| } | ||
| } | ||
| function openParagraph(row: any, id?: string) { | ||
| dialogTitle.value = t('chat.KnowledgeSource.title') | ||
|
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 is mostly correct, but there are a few minor suggestions and improvements:
Here’s the revised version with these suggestions: @@ -45,7 +45,7 @@
<span :title="item?.document_name?.trim()? trim(item.document_name ?? '') : 'no_document'">{{ item?.document_name }}</span>
</div>
)
} else {
return (
- <div v-else @click="infoMessage(item ?? {})">
+ <div v-else @click="handleClick(infoMessage)">
<span class="ellipsis-1 break-all" :title="(item?.document_name ?? '').trim()">
{{ (item?.document_name ?? '').trim() }}Function DefinitionIf the intent is to pass additional context when opening the paragraph, consider defining this behavior differently: const handleClick = (callback: (arg: any) => void, data: any) => () => callback(data);
// Usage:
openParagraph(row, id);This approach decouples the handling of clicking different elements and provides more flexibility. Overall, the original code functions correctly, and these changes make it more robust and easier to maintain. |
||
|
|
||
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 provided code has a few potential improvements and corrections:
Import Statement: The first line seems incomplete as it only contains
@@. Ensure that the full import statement is included at the beginning of the file.Function
reset_metadata:metamight beNone.Class Inheritance:
IRerankerNodeis defined before using it. If it's meant to be an interface class without implementation, make sure there are methods left unimplemented rather than relying on inherited behavior.Logic Flow:
save_contextandexecutehandles all possible states gracefully.reranker_model_id, which should refer to existing models or throw appropriate errors if not found.Edge Cases:
documentslist is empty, ensuring no unexpected behavior occurs during execution.Here's a revised version based on these considerations:
This version includes proper syntax (
>>>) with comments explaining each change suggested. Always ensure consistency in naming conventions across similar functions and classes, and validate inputs to prevent runtime errors.