feat: 重构知识库系统,移除Hermes集成,增强RAG和同步功能
主要变更: - 移除Hermes智能体及相关回调服务 - 新增知识库RAG、同步、调度、规范化和索引任务服务 - 重构orchestrator服务,增强运行时聊天功能 - 更新前端聊天、政策制度、设置等页面样式和逻辑 - 更新expense_claims和document_intelligence服务 - 删除llm_wiki相关服务和测试文件 - 更新docker-compose配置和启动脚本
This commit is contained in:
@@ -48,13 +48,13 @@ async function testSupportsBlobResponses() {
|
||||
async function testInjectsAuthenticatedUserHeaders() {
|
||||
const sessionStorage = new Map([
|
||||
[
|
||||
'x-financial-auth-user',
|
||||
JSON.stringify({
|
||||
username: 'admin',
|
||||
name: '系统管理员',
|
||||
roleCodes: ['manager'],
|
||||
isAdmin: true
|
||||
})
|
||||
'x-financial-auth-user',
|
||||
JSON.stringify({
|
||||
username: 'admin',
|
||||
name: 'Admin User',
|
||||
roleCodes: ['manager'],
|
||||
isAdmin: true
|
||||
})
|
||||
]
|
||||
])
|
||||
|
||||
@@ -79,9 +79,9 @@ async function testInjectsAuthenticatedUserHeaders() {
|
||||
}
|
||||
|
||||
await apiRequest('/knowledge/library')
|
||||
|
||||
assert.equal(capturedOptions.headers['x-auth-username'], 'admin')
|
||||
assert.equal(capturedOptions.headers['x-auth-name'], '系统管理员')
|
||||
|
||||
assert.equal(capturedOptions.headers['x-auth-username'], 'admin')
|
||||
assert.equal(capturedOptions.headers['x-auth-name'], 'Admin User')
|
||||
assert.equal(capturedOptions.headers['x-auth-role-codes'], 'manager')
|
||||
assert.equal(capturedOptions.headers['x-auth-is-admin'], 'true')
|
||||
}
|
||||
@@ -117,11 +117,35 @@ async function testFormatsValidationErrors() {
|
||||
)
|
||||
}
|
||||
|
||||
async function testRejectsWithCustomTimeoutMessage() {
|
||||
global.fetch = async (_url, options) =>
|
||||
new Promise((_, reject) => {
|
||||
options.signal.addEventListener('abort', () => {
|
||||
const error = new Error('aborted')
|
||||
error.name = 'AbortError'
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
|
||||
await assert.rejects(
|
||||
() =>
|
||||
apiRequest('/knowledge/library', {
|
||||
timeoutMs: 1,
|
||||
timeoutMessage: '知识问答整理超时,已停止等待。'
|
||||
}),
|
||||
(error) => {
|
||||
assert.equal(error.message, '知识问答整理超时,已停止等待。')
|
||||
return true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async function run() {
|
||||
await testUsesCustomContentTypeHeader()
|
||||
await testSupportsBlobResponses()
|
||||
await testInjectsAuthenticatedUserHeaders()
|
||||
await testFormatsValidationErrors()
|
||||
await testRejectsWithCustomTimeoutMessage()
|
||||
console.log('api-request tests passed')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user