From 773efcd91a826391cd8c6571bf192e38c48b4906 Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:37:22 +0800 Subject: [PATCH] chore: increase chat timeout (#768) --- libs/client-api/src/http_ai.rs | 3 +++ libs/client-api/src/http_chat.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/client-api/src/http_ai.rs b/libs/client-api/src/http_ai.rs index 74da345b..73f913c5 100644 --- a/libs/client-api/src/http_ai.rs +++ b/libs/client-api/src/http_ai.rs @@ -6,6 +6,7 @@ use shared_entity::dto::ai_dto::{ SummarizeRowResponse, TranslateRowParams, TranslateRowResponse, }; use shared_entity::response::{AppResponse, AppResponseError}; +use std::time::Duration; use tracing::instrument; impl Client { @@ -46,6 +47,7 @@ impl Client { .http_client_with_auth(Method::POST, &url) .await? .json(¶ms) + .timeout(Duration::from_secs(30)) .send() .await?; @@ -66,6 +68,7 @@ impl Client { .http_client_with_auth(Method::POST, &url) .await? .json(¶ms) + .timeout(Duration::from_secs(30)) .send() .await?; log_request_id(&resp); diff --git a/libs/client-api/src/http_chat.rs b/libs/client-api/src/http_chat.rs index 8afdfefe..c0a7d713 100644 --- a/libs/client-api/src/http_chat.rs +++ b/libs/client-api/src/http_chat.rs @@ -15,6 +15,7 @@ use shared_entity::dto::ai_dto::{ use shared_entity::response::{AppResponse, AppResponseError}; use std::pin::Pin; use std::task::{Context, Poll}; +use std::time::Duration; use tracing::error; impl Client { @@ -111,6 +112,7 @@ impl Client { let resp = self .http_client_with_auth(Method::GET, &url) .await? + .timeout(Duration::from_secs(30)) .send() .await?; log_request_id(&resp); @@ -130,6 +132,7 @@ impl Client { let resp = self .http_client_with_auth(Method::GET, &url) .await? + .timeout(Duration::from_secs(30)) .send() .await?; log_request_id(&resp);