File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ export async function POST(req: NextRequest) {
335335 goRoute : '/api/copilot' ,
336336 autoExecuteTools : true ,
337337 interactive : true ,
338- promptForToolApproval : true ,
338+ promptForToolApproval : false ,
339339 onComplete : async ( result : OrchestratorResult ) => {
340340 if ( ! actualChatId ) return
341341
@@ -415,7 +415,7 @@ export async function POST(req: NextRequest) {
415415 goRoute : '/api/copilot' ,
416416 autoExecuteTools : true ,
417417 interactive : true ,
418- promptForToolApproval : true ,
418+ promptForToolApproval : false ,
419419 } )
420420
421421 const responseData = {
Original file line number Diff line number Diff line change @@ -218,6 +218,15 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
218218 } )
219219 }
220220
221+ const keepaliveInterval = setInterval ( ( ) => {
222+ if ( clientDisconnected ) return
223+ try {
224+ controller . enqueue ( encoder . encode ( ': keepalive\n\n' ) )
225+ } catch {
226+ clientDisconnected = true
227+ }
228+ } , 15_000 )
229+
221230 try {
222231 await orchestrateCopilotStream ( requestPayload , {
223232 ...orchestrateOptions ,
@@ -256,6 +265,7 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
256265 } ,
257266 } )
258267 } finally {
268+ clearInterval ( keepaliveInterval )
259269 activeStreams . delete ( streamId )
260270 if ( chatId ) {
261271 resolvePendingChatStream ( chatId , streamId )
You can’t perform that action at this time.
0 commit comments