From 4539d6bc60f5717c9daa9e340f88344320f92a54 Mon Sep 17 00:00:00 2001 From: Anas Fikhi Date: Wed, 22 Nov 2023 04:06:01 +0100 Subject: [PATCH] [ Add ] added support for time outs to include stream methods --- lib/src/core/networking/client.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/core/networking/client.dart b/lib/src/core/networking/client.dart index 70170519..a5ee0c8e 100644 --- a/lib/src/core/networking/client.dart +++ b/lib/src/core/networking/client.dart @@ -159,7 +159,10 @@ abstract class OpenAINetworkingClient { ]); } - clientForUse.send(request).then((streamedResponse) { + clientForUse + .send(request) + .timeout(OpenAIConfig.requestsTimeOut) + .then((streamedResponse) { streamedResponse.stream.listen( (value) { final data = utf8.decode(value); @@ -362,7 +365,8 @@ abstract class OpenAINetworkingClient { } OpenAILogger.logStartRequest(to); - clientForUse.send(request).then( + + clientForUse.send(request).timeout(OpenAIConfig.requestsTimeOut).then( (respond) { OpenAILogger.startReadStreamResponse();