Repository navigation
feat: system shared knowledge MCP permission #7765
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 |
|---|---|---|
|
|
@@ -144,6 +144,7 @@ function handleSearchChange(query?: Dict<unknown>) { | |
| label="MCP 服务配置" | ||
| :api="SystemSharedKnowledgeApi" | ||
| :knowledge="knowledge" | ||
| v-if="perm.knowledge.share.mcpConfig()" | ||
| /> | ||
|
|
||
| <!-- 授权工作空间 --> | ||
|
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 is the review of the provided code snippet: 1. Syntax Error (Critical)The most significant issue is that ✅ Fix: Move - <component-or-tag
+ <component-or-tag
+ v-if="perm.knowledge.share.mcpConfig()"
label="MCP 服务配置"
:api="SystemSharedKnowledgeApi"
:knowledge="knowledge"
- v-if="perm.knowledge.share.mcpConfig()"
/>2. Potential Runtime ErrorThe expression
If any intermediate object in this chain is ✅ Optimization/Safety: Add optional chaining ( v-if="perm?.knowledge?.share?.mcpConfig?"
3. Performance & Best PracticeCalling methods like
✅ Suggestion: Wrap the condition in a // In <script setup> or Options API computed
const showMcpConfig = computed(() =>
perm?.value?.knowledge?.share?.mcpConfig?.() ?? false
)<!-- In template -->
v-if="showMcpConfig"4. Localization/I18n (Minor)The label ✅ Recommended Final Code<SomeComponent
v-if="showMcpConfig"
label="MCP 服务配置"
:api="SystemSharedKnowledgeApi"
:knowledge="knowledge"
/>With corresponding script logic: const showMcpConfig = computed(() =>
Boolean(perm.value?.knowledge?.share?.mcpConfig?.())
) |
||
|
|
||
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 is the analysis of the provided code snippet:
1. Irregularities & Issues:
mcpConfig) use a mix of indentation levels that likely do not match the surrounding file's standard (which appears to use 2 spaces). The comment/**starts at column 0, while the functionmcpConfig:starts with 2 spaces. If the surrounding code uses 2 spaces for properties, the comment should also be indented accordingly.publishmight be defined ifpublishalso had a preceding comment.2. Optimization Suggestions:
P.SHARED_KNOWLEDGE_MCP_CONFIGis actually defined in your permissions enum/map. If this constant is missing or misspelled, the application will fail or behave unexpectedly.mcpConfigis clear and consistent with the existingpublishproperty, assuming other permissions follow simple camelCase naming for feature-specific access.3. Recommended Fix:
Summary: The logic is sound and follows the existing pattern. The primary recommendation is to verify the existence of
P.SHARED_KNOWLEDGE_MCP_CONFIGand ensure indentation matches your project's linting rules.