diff options
Diffstat (limited to 'src/client.rs')
| -rw-r--r-- | src/client.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client.rs b/src/client.rs index 14d65d0..d366509 100644 --- a/src/client.rs +++ b/src/client.rs @@ -153,12 +153,18 @@ impl ChatGptClient { .and_then(|m| m.insert("stream".into(), json!(true))); } - let builder = self + let (api_key, organization_id) = self.config.read().get_api_key(); + + let mut builder = self .build_client()? .post(API_URL) - .bearer_auth(self.config.read().get_api_key()) + .bearer_auth(api_key) .json(&body); + if let Some(organization_id) = organization_id { + builder = builder.header("OpenAI-Organization", organization_id); + } + Ok(builder) } } |
