mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 03:28:22 +00:00
fix(agent): populate userId in agent workflow chat task payloads
This commit is contained in:
@@ -907,6 +907,7 @@ describe('AssetService', () => {
|
||||
expect(p1?.agent?.agentId).toBe(agent.id)
|
||||
expect(p1?.agent?.sessionId).toBeUndefined()
|
||||
expect(p1?.agent?.explicitMention).toBe(true)
|
||||
expect(p1?.agent?.userId).toBe(user.id)
|
||||
|
||||
// Rule 2: user mentions agent in reply, and root is not an agent comment
|
||||
const reply1 = await assetService.createComment({
|
||||
@@ -925,6 +926,7 @@ describe('AssetService', () => {
|
||||
expect(p2?.agent?.agentId).toBe(agent.id)
|
||||
expect(p2?.agent?.sessionId).toBeUndefined()
|
||||
expect(p2?.agent?.explicitMention).toBe(true)
|
||||
expect(p2?.agent?.userId).toBe(user.id)
|
||||
|
||||
// Create a root user comment
|
||||
const userRoot = await prisma.assetComment.create({
|
||||
@@ -981,6 +983,7 @@ describe('AssetService', () => {
|
||||
expect(p3a?.agent?.agentId).toBe(botUser.id)
|
||||
expect(p3a?.agent?.sessionId).toBe('test-session-rule3')
|
||||
expect(p3a?.agent?.explicitMention).toBe(false)
|
||||
expect(p3a?.agent?.userId).toBe(user.id)
|
||||
|
||||
// Rule 3b: any user creates a reply directly to the agent comment, explicitly mentions agent
|
||||
const reply3b = await assetService.createComment({
|
||||
@@ -1008,6 +1011,7 @@ describe('AssetService', () => {
|
||||
expect(p3b?.agent?.agentId).toBe(botUser.id)
|
||||
expect(p3b?.agent?.sessionId).toBe('test-session-rule3')
|
||||
expect(p3b?.agent?.explicitMention).toBe(true)
|
||||
expect(p3b?.agent?.userId).toBe(user.id)
|
||||
})
|
||||
|
||||
it('updates asset order correctly', async () => {
|
||||
|
||||
@@ -1280,6 +1280,7 @@ export class AssetService {
|
||||
agentId: rootAgentId,
|
||||
sessionId: rootSessionId || undefined,
|
||||
explicitMention,
|
||||
userId: req.userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1314,6 +1315,7 @@ export class AssetService {
|
||||
userCommentId: comment.id,
|
||||
agentId: agentId,
|
||||
explicitMention: true,
|
||||
userId: req.userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user