fix(agent): set empty details in asset tool results to avoid data duplication (#370)

This commit is contained in:
Yiling-J
2026-08-31 20:43:05 +08:00
committed by GitHub
parent e06478df88
commit 134eb8b7fa
9 changed files with 36 additions and 10 deletions
+14 -2
View File
@@ -86,7 +86,13 @@ describe('createCreateFileTool', () => {
metadata: undefined,
})
expect(result.details).toEqual({ id: 'file-1', name: 'test', type: 'file', size: 100 })
expect(result.details).toEqual({})
expect(JSON.parse((result.content[0] as { text: string }).text)).toEqual({
id: 'file-1',
name: 'test',
type: 'file',
size: 100,
})
})
it('should forward the metadata to assetService.createFile when provided', async () => {
@@ -209,7 +215,13 @@ describe('createCreateFileTool', () => {
metadata: undefined,
})
expect(result.details).toEqual({ id: 'file-1', name: 'test', type: 'file', size: 100 })
expect(result.details).toEqual({})
expect(JSON.parse((result.content[0] as { text: string }).text)).toEqual({
id: 'file-1',
name: 'test',
type: 'file',
size: 100,
})
})
it('should default unknown extensions to text/plain when creating from content', async () => {