Skip to content

Commit

Permalink
[ Add ] added support for time outs to include stream methods
Browse files Browse the repository at this point in the history
  • Loading branch information
anasfik committed Nov 22, 2023
1 parent f63803d commit 4539d6b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/core/networking/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -362,7 +365,8 @@ abstract class OpenAINetworkingClient {
}

OpenAILogger.logStartRequest(to);
clientForUse.send(request).then(

clientForUse.send(request).timeout(OpenAIConfig.requestsTimeOut).then(
(respond) {
OpenAILogger.startReadStreamResponse();

Expand Down

0 comments on commit 4539d6b

Please sign in to comment.