Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(knowledge): hide parser hint for read-only users (#4487)
LuckVd23d6531451b0
diff --git a/frontend/src/views/knowledge/KnowledgeBase.vue b/frontend/src/views/knowledge/KnowledgeBase.vueindex b3fd47a5e..15bcc01e5 100644--- a/frontend/src/views/knowledge/KnowledgeBase.vue+++ b/frontend/src/views/knowledge/KnowledgeBase.vue@@ -2440,7 +2440,7 @@ const handleKBEditorSuccess = (kbIdValue: string) => {</div></div><p v-if="kbInfo?.description" class="document-subtitle">{{ kbInfo.description }}</p>- <p v-if="unsupportedFileTypes.length" class="parser-hint" @click="goToParserSettings">+ <p v-if="canEdit && unsupportedFileTypes.length" class="parser-hint" @click="goToParserSettings"><t-icon name="info-circle" class="parser-hint-icon" /><span>{{$t('knowledgeBase.unsupportedTypesHint', {types: unsupportedFileTypes.map(t => '.' + t).join('、')diff --git a/frontend/src/views/knowledge/KnowledgeBaseParserHint.test.ts b/frontend/src/views/knowledge/KnowledgeBaseParserHint.test.tsnew file mode 100644index 000000000..601fd7389--- /dev/null+++ b/frontend/src/views/knowledge/KnowledgeBaseParserHint.test.ts@@ -0,0 +1,19 @@+import assert from 'node:assert/strict'+import test from 'node:test'+import { readFileSync } from 'node:fs'++const source = readFileSync(new URL('./KnowledgeBase.vue', import.meta.url), 'utf8')+const condition = source.match(/<p v-if="([^"]+)" class="parser-hint"/)?.[1]++function shouldShowParserHint(canEdit: boolean, unsupportedFileTypes: string[]): boolean {+ assert.ok(condition, 'parser hint has a render condition')+ return Boolean(new Function('canEdit', 'unsupportedFileTypes', `return ${condition}`)(canEdit, unsupportedFileTypes))+}++test('read-only users do not see the parser-engine warning (#4486)', () => {+ assert.equal(shouldShowParserHint(false, ['pdf']), false)+})++test('editable users still see the parser-engine warning when needed (#4486)', () => {+ assert.equal(shouldShowParserHint(true, ['pdf']), true)+})