File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/lib/server/textGeneration/mcp Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ export async function* runMcpFlow({
248248 route : resolvedRoute ,
249249 candidateModelId,
250250 toolCount : oaTools . length ,
251+ hasUserToken : Boolean ( ( locals as any ) ?. token ) ,
251252 } ,
252253 "[mcp] starting completion with tools"
253254 ) ;
@@ -402,6 +403,7 @@ export async function* runMcpFlow({
402403 headers : {
403404 "ChatUI-Conversation-ID" : conv . _id . toString ( ) ,
404405 "X-use-cache" : "false" ,
406+ ...( locals ?. token ? { Authorization : `Bearer ${ locals . token } ` } : { } ) ,
405407 } ,
406408 }
407409 ) ;
@@ -523,7 +525,14 @@ export async function* runMcpFlow({
523525 console . debug ( { loop } , "[mcp] missing tool_call id in stream; retrying non-stream to recover ids" ) ;
524526 const nonStream = await openai . chat . completions . create (
525527 { ...completionBase , messages : messagesOpenAI , stream : false } ,
526- { signal : abortSignal }
528+ {
529+ signal : abortSignal ,
530+ headers : {
531+ "ChatUI-Conversation-ID" : conv . _id . toString ( ) ,
532+ "X-use-cache" : "false" ,
533+ ...( locals ?. token ? { Authorization : `Bearer ${ locals . token } ` } : { } ) ,
534+ } ,
535+ }
527536 ) ;
528537 const tc = nonStream . choices ?. [ 0 ] ?. message ?. tool_calls ?? [ ] ;
529538 calls = tc . map ( ( t ) => ( {
You can’t perform that action at this time.
0 commit comments