Skip to content

Commit 7803f47

Browse files
committed
improvement(mship): add user metadata to mship request
1 parent b27e4c2 commit 7803f47

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

apps/sim/lib/copilot/chat/payload.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ interface BuildPayloadParams {
3737
userTimezone?: string
3838
userMetadata?: {
3939
name?: string
40+
email?: string
4041
timezone?: string
4142
}
4243
includeMothershipTools?: boolean
@@ -367,7 +368,8 @@ export async function buildCopilotRequestPayload(
367368
...(params.workspaceContext ? { workspaceContext: params.workspaceContext } : {}),
368369
...(params.userPermission ? { userPermission: params.userPermission } : {}),
369370
...(params.userTimezone ? { userTimezone: params.userTimezone } : {}),
370-
...(params.userMetadata && (params.userMetadata.name || params.userMetadata.timezone)
371+
...(params.userMetadata &&
372+
(params.userMetadata.name || params.userMetadata.email || params.userMetadata.timezone)
371373
? { userMetadata: params.userMetadata }
372374
: {}),
373375
// Tell the copilot file subagent which document toolchain to write. Emitted

apps/sim/lib/copilot/chat/post.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ type UnifiedChatBranch =
169169
fileAttachments?: UnifiedChatRequest['fileAttachments']
170170
userPermission?: string
171171
userTimezone?: string
172-
userMetadata?: { name?: string; timezone?: string }
172+
userMetadata?: { name?: string; email?: string; timezone?: string }
173173
workflowId: string
174174
workflowName?: string
175175
workspaceId?: string
@@ -204,7 +204,7 @@ type UnifiedChatBranch =
204204
fileAttachments?: UnifiedChatRequest['fileAttachments']
205205
userPermission?: string
206206
userTimezone?: string
207-
userMetadata?: { name?: string; timezone?: string }
207+
userMetadata?: { name?: string; email?: string; timezone?: string }
208208
workspaceContext?: string
209209
}) => Promise<Record<string, unknown>>
210210
buildExecutionContext: (params: {
@@ -722,6 +722,7 @@ export async function handleUnifiedChatPost(req: NextRequest) {
722722
const body = ChatMessageSchema.parse(await req.json())
723723
const userMetadata = {
724724
...(authenticatedUserName ? { name: authenticatedUserName } : {}),
725+
...(authenticatedUserEmail ? { email: authenticatedUserEmail } : {}),
725726
...(body.userTimezone ? { timezone: body.userTimezone } : {}),
726727
}
727728
const normalizedContexts = normalizeContexts(body.contexts) ?? []

0 commit comments

Comments
 (0)