mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 20:48:04 +00:00
feat(chat): append and display context_display_info custom entry for attached assets
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user