mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 21:44:27 +00:00
feat(comments): add internal comments and author comment editing (#552)
* feat(comments): add internal comments and author comment editing * chore(i18n): add Korean comment translations and update AGENTS.md i18n rule * style(comments): refine visibility selector corner radius and align send button height * fix(webui): avoid ResizeObserver loop when resizing file browser
This commit is contained in:
@@ -601,6 +601,7 @@ export const createCommentActivity = defineStep(
|
||||
sessionId?: string | null
|
||||
agentId?: string | null
|
||||
replyToId?: string | null
|
||||
isInternal?: boolean
|
||||
}) {
|
||||
if (params.sessionId) {
|
||||
const agentId = params.agentId && params.agentId !== 'default' ? params.agentId : 'default'
|
||||
@@ -669,6 +670,7 @@ export const createCommentActivity = defineStep(
|
||||
sessionId: params.sessionId ?? null,
|
||||
creatorId: params.agentId && params.agentId !== 'default' ? params.agentId : null,
|
||||
replyToId: params.replyToId,
|
||||
isInternal: params.isInternal ?? false,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
@@ -205,6 +205,43 @@ describe('Agent Chat Workflow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('marks agent placeholder reply as internal when user comment is internal', async () => {
|
||||
mockActivities.getCommentActivity.mockResolvedValue({
|
||||
id: 'c-internal',
|
||||
message: 'hello agent privately',
|
||||
assetId: 'a1',
|
||||
creatorId: 'user-c1',
|
||||
second: null,
|
||||
annotation: null,
|
||||
replyToId: null,
|
||||
isInternal: true,
|
||||
attachments: [],
|
||||
})
|
||||
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
type: 'chat',
|
||||
status: 'pending',
|
||||
assetId: 'a1',
|
||||
payload: {
|
||||
projectId: 'p1',
|
||||
agent: { userCommentId: 'c-internal', agentId: 'b1' },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await agentChat(task)
|
||||
|
||||
expect(mockActivities.createCommentActivity).toHaveBeenCalledWith({
|
||||
assetId: 'a1',
|
||||
message: '__CHAT__',
|
||||
sessionId: 'pending',
|
||||
agentId: 'b1',
|
||||
replyToId: 'c-internal',
|
||||
isInternal: true,
|
||||
})
|
||||
})
|
||||
|
||||
it('should skip session initialization if sessionId is already provided', async () => {
|
||||
const task = await prisma.workflowTask.create({
|
||||
data: {
|
||||
|
||||
@@ -85,6 +85,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
sessionId: sessionId || 'pending',
|
||||
agentId: agentId,
|
||||
replyToId: userComment.replyToId ?? userComment.id,
|
||||
...(userComment.isInternal ? { isInternal: true } : {}),
|
||||
})
|
||||
placeholderCommentId = placeholder.id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user