feat(agent): support dynamic annotationId resolution across chat and comments (#375)

* feat(agent): improve timestamp precision and proxy selection for video screenshots

* feat(agent): support dynamic annotationId resolution across chat and comments

* fix(agent): scope annotation resolution to asset and format has_markup consistently
This commit is contained in:
Yiling-J
2026-09-02 15:17:56 +08:00
committed by GitHub
parent 5a754bcb94
commit 35b57cc0ab
19 changed files with 869 additions and 133 deletions
@@ -766,4 +766,44 @@ describe('Agent Chat Workflow', () => {
}),
)
})
it('should include userCommentId as id in comment messageContext', async () => {
mockActivities.getCommentActivity.mockResolvedValue({
id: 'comment-with-id-123',
creatorId: 'user-c1',
message: 'Check this out',
replyToId: null,
second: 5.0,
annotation: [{ type: 'arrow' }],
attachments: [],
})
const task = await prisma.workflowTask.create({
data: {
type: 'chat',
status: 'pending',
assetId: 'a1',
payload: {
projectId: 'p1',
agent: {
agentId: 'b1',
userCommentId: 'comment-with-id-123',
},
},
},
})
await agentChat(task)
expect(mockActivities.agentChatActivity).toHaveBeenCalledWith(
expect.objectContaining({
messageContext: expect.objectContaining({
id: 'comment-with-id-123',
position: { type: 'time', seconds: 5.0 },
annotation: true,
annotations: [{ type: 'arrow' }],
}),
}),
)
})
})
@@ -298,6 +298,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
// Build structured ShumaiMessageContext
const messageContext: ShumaiMessageContext = {
...(userCommentId ? { id: userCommentId } : {}),
...(userInfo
? { user: { id: targetUserId!, name: userInfo.name, role: userInfo.role } }
: {}),