feat(chat): append and display context_display_info custom entry for attached assets

This commit is contained in:
yiling
2026-07-11 16:58:09 +08:00
parent cc9b32716d
commit 482df3315c
12 changed files with 128 additions and 2 deletions
@@ -488,6 +488,10 @@ describe('Agent Chat Workflow', () => {
userCommentId: undefined,
explicitMention: true,
context: { agent: { id: 'b1' } },
attachedAssets: [
{ id: 'file-attachment-1', name: 'attachment.png', type: 'file' },
{ id: 'referenced-asset-1', name: 'ref-folder', type: 'folder' },
],
})
})
})
@@ -126,6 +126,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
// Resolve Attached Files Details
const attachedFileDetailsList: string[] = []
const attachedAssets: Array<{ id: string; name: string; type: string }> = []
if (payload.agent?.attachedFiles) {
for (const fileId of payload.agent.attachedFiles) {
const file = await executeActivity(agentWorkerQueue, getAssetActivity, fileId)
@@ -134,6 +135,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
attachedFileDetailsList.push(
`- Name: ${file.name} (ID: ${file.id}, Type: ${file.type}, Media Type: ${file.mediaType || 'unknown'}, Project ID: ${file.projectId || 'unknown'}, Path: ${path})`,
)
attachedAssets.push({ id: file.id, name: file.name, type: file.type })
}
}
}
@@ -148,6 +150,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
referencedAssetDetailsList.push(
`- Name: ${referencedAsset.name} (ID: ${referencedAsset.id}, Type: ${referencedAsset.type}, Media Type: ${referencedAsset.mediaType || 'unknown'}, Project ID: ${referencedAsset.projectId || 'unknown'}, Path: ${path})`,
)
attachedAssets.push({ id: referencedAsset.id, name: referencedAsset.name, type: referencedAsset.type })
}
}
}
@@ -183,6 +186,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
userCommentId: userCommentId || undefined,
explicitMention: payload.agent?.explicitMention,
context,
attachedAssets,
})
// 7. Update Placeholder Comment