diff options
| author | sigoden <sigoden@gmail.com> | 2024-11-06 06:46:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-06 06:46:29 +0800 |
| commit | 35ee277a234a92add2f6244ad6f7ff3616b17ebe (patch) | |
| tree | b52de0378cb6427717027e7a4a5d74710088fb28 /src/client/common.rs | |
| parent | 640eb00d74d42d98ab117e48bf4f181350bae221 (diff) | |
| download | aichat-35ee277a234a92add2f6244ad6f7ff3616b17ebe.tar.gz | |
feat: add config `user_agent` (#971)
Diffstat (limited to 'src/client/common.rs')
| -rw-r--r-- | src/client/common.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/common.rs b/src/client/common.rs index 1275d0b..9c516c8 100644 --- a/src/client/common.rs +++ b/src/client/common.rs @@ -43,6 +43,9 @@ pub trait Client: Sync + Send { let timeout = extra.and_then(|v| v.connect_timeout).unwrap_or(10); let proxy = extra.and_then(|v| v.proxy.clone()); builder = set_proxy(builder, proxy.as_ref())?; + if let Some(user_agent) = self.global_config().read().user_agent.as_ref() { + builder = builder.user_agent(user_agent); + } let client = builder .connect_timeout(Duration::from_secs(timeout)) .build() |
