mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	wow, this fixed openai too
This commit is contained in:
		| @@ -692,9 +692,9 @@ export class ChatPipeline { | |||||||
|                         log.info(`Sent final response with done=true signal and text content`); |                         log.info(`Sent final response with done=true signal and text content`); | ||||||
|                     } else { |                     } else { | ||||||
|                         // For Anthropic, sometimes text is empty but response is in stream |                         // For Anthropic, sometimes text is empty but response is in stream | ||||||
|                         if (currentResponse.provider === 'Anthropic' && currentResponse.stream) { |                         if ((currentResponse.provider === 'Anthropic' || currentResponse.provider === 'OpenAI') && currentResponse.stream) { | ||||||
|                             log.info(`Detected empty response text for Anthropic provider with stream, sending stream content directly`); |                             log.info(`Detected empty response text for ${currentResponse.provider} provider with stream, sending stream content directly`); | ||||||
|                             // For Anthropic with stream mode, we need to stream the final response |                             // For Anthropic/OpenAI with stream mode, we need to stream the final response | ||||||
|                             if (currentResponse.stream) { |                             if (currentResponse.stream) { | ||||||
|                                 await currentResponse.stream(async (chunk: StreamChunk) => { |                                 await currentResponse.stream(async (chunk: StreamChunk) => { | ||||||
|                                     // Process the chunk |                                     // Process the chunk | ||||||
| @@ -707,7 +707,7 @@ export class ChatPipeline { | |||||||
|                                         chunk |                                         chunk | ||||||
|                                     ); |                                     ); | ||||||
|                                 }); |                                 }); | ||||||
|                                 log.info(`Completed streaming final Anthropic response after tool execution`); |                                 log.info(`Completed streaming final ${currentResponse.provider} response after tool execution`); | ||||||
|                             } |                             } | ||||||
|                         } else { |                         } else { | ||||||
|                             // Empty response with done=true as fallback |                             // Empty response with done=true as fallback | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user