Update agent orchestration and knowledge flow
Add sub-commander orchestration updates, align frontend integrations, and refine knowledge view behavior without including local data artifacts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,14 @@ export interface AgentStats {
|
||||
status: 'active' | 'idle' | 'disabled'
|
||||
}
|
||||
|
||||
export interface AgentHierarchyStatsNode extends AgentStats {
|
||||
sub_commanders: AgentStats[]
|
||||
}
|
||||
|
||||
export interface AgentHierarchyStats {
|
||||
main_agents: AgentHierarchyStatsNode[]
|
||||
}
|
||||
|
||||
export interface AgentConfig {
|
||||
id: string
|
||||
name: string
|
||||
@@ -22,6 +30,11 @@ export const agentApi = {
|
||||
return res.data
|
||||
},
|
||||
|
||||
async getHierarchyStats(): Promise<AgentHierarchyStats> {
|
||||
const res = await api.get('/api/agents/stats/hierarchy')
|
||||
return res.data
|
||||
},
|
||||
|
||||
async getConfig(id: string): Promise<AgentConfig> {
|
||||
const res = await api.get(`/api/agents/config/${id}`)
|
||||
return res.data
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface NavItem {
|
||||
|
||||
export const navItems: NavItem[] = [
|
||||
{ name: '沟通系统', path: '/chat', icon: MessageCircle },
|
||||
{ name: '智能链路', path: '/agents', icon: Bot },
|
||||
{ name: '奥创中心', path: '/agents', icon: Bot },
|
||||
{ name: '技能中心', path: '/skills', icon: Star },
|
||||
{ name: '资料中枢', path: '/knowledge', icon: BookOpen },
|
||||
{ name: '知识大脑', path: '/brain', icon: Network },
|
||||
|
||||
@@ -181,7 +181,7 @@ describe('useKnowledgeView chunk editing', () => {
|
||||
expect(view.documents.value[0].id).toBe('doc-3')
|
||||
})
|
||||
|
||||
it('enters a newly created folder so refresh keeps uploaded documents visible', async () => {
|
||||
it('stays on the current listing after creating a folder and shows the new folder', async () => {
|
||||
const createdFolder = {
|
||||
id: 'folder-new',
|
||||
name: '新文件夹',
|
||||
@@ -190,17 +190,6 @@ describe('useKnowledgeView chunk editing', () => {
|
||||
created_at: '2026-03-22T00:00:00Z',
|
||||
updated_at: '2026-03-22T00:00:00Z',
|
||||
}
|
||||
const uploadedDocument = {
|
||||
id: 'doc-new',
|
||||
title: 'Uploaded after create',
|
||||
filename: 'uploaded.md',
|
||||
file_type: 'md',
|
||||
file_size: 256,
|
||||
chunk_count: 1,
|
||||
is_indexed: true,
|
||||
folder_id: 'folder-new',
|
||||
created_at: '2026-03-22T00:00:00Z',
|
||||
}
|
||||
|
||||
mocks.folderCreate.mockResolvedValue({ data: createdFolder })
|
||||
mocks.folderGetTree.mockResolvedValue({
|
||||
@@ -213,36 +202,18 @@ describe('useKnowledgeView chunk editing', () => {
|
||||
},
|
||||
],
|
||||
})
|
||||
mocks.documentList
|
||||
.mockResolvedValueOnce({ data: [] })
|
||||
.mockResolvedValueOnce({ data: [uploadedDocument] })
|
||||
.mockResolvedValue({ data: [uploadedDocument] })
|
||||
|
||||
mocks.documentUpload.mockResolvedValue({
|
||||
data: {
|
||||
id: 'doc-new',
|
||||
title: 'Uploaded after create',
|
||||
chunk_count: 1,
|
||||
status: '上传成功,正在索引...',
|
||||
ingestion_status: 'ready',
|
||||
},
|
||||
})
|
||||
|
||||
const view = useKnowledgeView()
|
||||
view.showNewFolderDialog.value = true
|
||||
view.newFolderName.value = '新文件夹'
|
||||
await view.createFolder()
|
||||
|
||||
expect(view.currentFolderId.value).toBe('folder-new')
|
||||
expect(routeQuery.folder_id).toBe('folder-new')
|
||||
expect(storage.get('knowledge.currentFolderId')).toBe('folder-new')
|
||||
|
||||
const file = new File(['hello'], 'uploaded.md', { type: 'text/markdown' })
|
||||
const event = { target: { files: [file], value: 'uploaded.md' } } as unknown as Event
|
||||
await view.handleUpload(event)
|
||||
|
||||
expect(mocks.documentUpload).toHaveBeenCalledWith(file, 'folder-new')
|
||||
expect(view.documents.value).toHaveLength(1)
|
||||
expect(view.documents.value[0].folder_id).toBe('folder-new')
|
||||
expect(view.currentFolderId.value).toBe(null)
|
||||
expect(routeQuery.folder_id).toBeUndefined()
|
||||
expect(storage.get('knowledge.currentFolderId')).toBeUndefined()
|
||||
expect(view.showNewFolderDialog.value).toBe(false)
|
||||
expect(view.visibleFolders.value).toHaveLength(1)
|
||||
expect(view.visibleFolders.value[0].id).toBe('folder-new')
|
||||
})
|
||||
|
||||
it('loads documents at the root view instead of clearing the list', async () => {
|
||||
|
||||
@@ -298,13 +298,12 @@ export function useKnowledgeView() {
|
||||
if (!newFolderName.value.trim()) return
|
||||
|
||||
try {
|
||||
const response = await folderApi.create({
|
||||
await folderApi.create({
|
||||
name: newFolderName.value.trim(),
|
||||
parent_id: newFolderParentId.value,
|
||||
})
|
||||
await loadFolders()
|
||||
showNewFolderDialog.value = false
|
||||
await goToFolder(response.data.id)
|
||||
} catch (error) {
|
||||
console.error('创建文件夹失败:', error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user