feat(权限优化)1.AI对话中点击快捷标签问题时,明明已经配置了默认默写为什么还会提示配置?必须点击一下保存并关闭才可以这个不对,只要配置了就可以问答不需要再让用户过来点击一次!如图一、二所示
deploy-hxtesting / build-and-deploy (push) Successful in 1m20s

2.知识库中的企业培训(课件)、企业培训(试题)、配置中心、组织架构、共享空间如图三所示可查看权限归属到超级管理员权限中!如何对
This commit is contained in:
runny committed 2026-11-27 14:49:06 +08:00
1 parent 353f60a175
commit 043e0485e2
14 files changed
+368 -74

No files matched your search

+62 -6
View File
@@ -9,10 +9,29 @@ import {
resolveAgentNotReadyHighlight,
} from './agent-readiness.ts'
test('does not treat an unrelated built-in chat model as agent configuration', () => {
test('an empty model_id falls back to the workspace default chat model', () => {
// Built-in agents are seeded without model_id; the run resolves the
// workspace default, so they are ready as long as one exists.
assert.equal(agentHasConfiguredChatModel(
{},
[{ id: 'builtin-chat', type: 'KnowledgeQA' }],
), true)
})
test('an empty model_id is not ready when the workspace has no KnowledgeQA model', () => {
assert.equal(agentHasConfiguredChatModel(
{},
[{ id: 'embed-1', type: 'Embedding' }],
), false)
assert.equal(agentHasConfiguredChatModel({}, []), false)
})
test('an empty model_id stays unready for shared agents', () => {
// The model belongs to the source tenant; existence is validated backend-side.
assert.equal(agentHasConfiguredChatModel(
{},
[{ id: 'builtin-chat', type: 'KnowledgeQA' }],
true,
), false)
})
@@ -110,25 +129,62 @@ test('resolveAgentNotReadyHighlight returns the first missing item', () => {
assert.equal(resolveAgentNotReadyHighlight([]), undefined)
})
test('getAgentNotReadyReasonKeys flags missing chat model', () => {
test('getAgentNotReadyReasonKeys flags a missing chat model only without a workspace default', () => {
// No KnowledgeQA model in the workspace: nothing to fall back to.
assert.deepEqual(getAgentNotReadyReasonKeys(
{},
[],
{ isAgentMode: false, isSharedAgent: false },
), ['summary_model'])
// Workspace default exists: the empty model_id resolves at run time.
assert.deepEqual(getAgentNotReadyReasonKeys(
{},
[{ id: 'chat-1', type: 'KnowledgeQA' }],
{ isAgentMode: false, isSharedAgent: false },
), [])
// Shared agents must declare an explicit model; cannot validate locally.
assert.deepEqual(getAgentNotReadyReasonKeys(
{},
[{ id: 'chat-1', type: 'KnowledgeQA' }],
{ isAgentMode: false, isSharedAgent: true },
), ['summary_model'])
})
test('getAgentNotReadyReasonKeys requires rerank only in agent mode with KB search', () => {
assert.deepEqual(getAgentNotReadyReasonKeys(
{ kb_selection_mode: 'all', allowed_tools: ['search_knowledge'] },
{ model_id: 'chat-1', kb_selection_mode: 'all', allowed_tools: ['search_knowledge'] },
[{ id: 'chat-1', type: 'KnowledgeQA' }, { id: 'rerank-1', type: 'Rerank' }],
{ isAgentMode: true, isSharedAgent: false },
), ['summary_model', 'rerank_model'])
), ['rerank_model'])
assert.deepEqual(getAgentNotReadyReasonKeys(
{ kb_selection_mode: 'all', allowed_tools: ['knowledge_search'] },
{ model_id: 'chat-1', kb_selection_mode: 'all', allowed_tools: ['knowledge_search'] },
[{ id: 'chat-1', type: 'KnowledgeQA' }, { id: 'rerank-1', type: 'Rerank' }],
{ isAgentMode: true, isSharedAgent: false },
), ['summary_model', 'rerank_model'])
), ['rerank_model'])
})
test('built-in agents fall back to the workspace rerank without a reason', () => {
// Mirrors session_agent_qa.go: empty rerank on a builtin resolves from the
// workspace (or searches without reranking) instead of blocking the run.
assert.deepEqual(getAgentNotReadyReasonKeys(
{ model_id: 'chat-1', kb_selection_mode: 'all', allowed_tools: ['search_knowledge'] },
[{ id: 'chat-1', type: 'KnowledgeQA' }, { id: 'rerank-1', type: 'Rerank' }],
{ isAgentMode: true, isSharedAgent: false, isBuiltin: true },
), [])
// Even with no rerank model at all: builtin searches without reranking.
assert.deepEqual(getAgentNotReadyReasonKeys(
{ model_id: 'chat-1', kb_selection_mode: 'all', allowed_tools: ['search_knowledge'] },
[{ id: 'chat-1', type: 'KnowledgeQA' }],
{ isAgentMode: true, isSharedAgent: false, isBuiltin: true },
), [])
})
test('custom agents without a rerank model stay flagged', () => {
assert.deepEqual(getAgentNotReadyReasonKeys(
{ model_id: 'chat-1', kb_selection_mode: 'all', allowed_tools: ['search_knowledge'] },
[{ id: 'chat-1', type: 'KnowledgeQA' }, { id: 'rerank-1', type: 'Rerank' }],
{ isAgentMode: true, isSharedAgent: false, isBuiltin: false },
), ['rerank_model'])
})
test('getAgentNotReadyReasonKeys does not treat current shared context as shared without sourceTenantId', () => {