File tree Expand file tree Collapse file tree
apps/sim/lib/copilot/chat Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ) ?? [ ]
You can’t perform that action at this time.
0 commit comments