@@ -50,7 +50,7 @@ import type { ChatContext } from '@/stores/panel'
5050export const maxDuration = 3600
5151
5252const logger = createLogger ( 'UnifiedChatAPI' )
53- const DEFAULT_MODEL = 'claude-opus-4-7 '
53+ const DEFAULT_MODEL = 'claude-opus-4-8 '
5454
5555const FileAttachmentSchema = z . object ( {
5656 id : z . string ( ) ,
@@ -172,6 +172,7 @@ type UnifiedChatBranch =
172172 commands ?: string [ ]
173173 prefetch ?: boolean
174174 implicitFeedback ?: string
175+ workspaceContext ?: string
175176 } ) => Promise < Record < string , unknown > >
176177 buildExecutionContext : ( params : {
177178 userId : string
@@ -556,7 +557,7 @@ async function resolveBranch(params: {
556557 workflowId : resolvedWorkflowId ,
557558 workflowName : resolved . workflowName ,
558559 workspaceId : resolvedWorkspaceId ,
559- effectiveModel : selectedModel ,
560+ effectiveModel : selectedModel ,
560561 selectedModel,
561562 mode : mode ?? 'agent' ,
562563 provider,
@@ -582,6 +583,7 @@ async function resolveBranch(params: {
582583 chatId : payloadParams . chatId ,
583584 prefetch : payloadParams . prefetch ,
584585 implicitFeedback : payloadParams . implicitFeedback ,
586+ workspaceContext : payloadParams . workspaceContext ,
585587 userPermission : payloadParams . userPermission ,
586588 userTimezone : payloadParams . userTimezone ,
587589 } ,
@@ -852,11 +854,11 @@ export async function handleUnifiedChatPost(req: NextRequest) {
852854 // apparent "gap" before the model call. Each promise is its own
853855 // span; they run concurrently under Promise.all below.
854856 const workspaceContextPromise =
855- branch . kind === 'workspace'
857+ workspaceId
856858 ? withCopilotSpan (
857859 TraceSpan . CopilotChatBuildWorkspaceContext ,
858- { [ TraceAttr . WorkspaceId ] : branch . workspaceId } ,
859- ( ) => generateWorkspaceContext ( branch . workspaceId , authenticatedUserId ) ,
860+ { [ TraceAttr . WorkspaceId ] : workspaceId } ,
861+ ( ) => generateWorkspaceContext ( workspaceId , authenticatedUserId ) ,
860862 activeOtelRoot . context
861863 )
862864 : Promise . resolve ( undefined )
@@ -950,6 +952,7 @@ export async function handleUnifiedChatPost(req: NextRequest) {
950952 commands : body . commands ,
951953 prefetch : body . prefetch ,
952954 implicitFeedback : body . implicitFeedback ,
955+ workspaceContext,
953956 } )
954957 : branch . buildPayload ( {
955958 message : body . message ,
0 commit comments