mirror of
https://github.com/katanemo/plano.git
synced 2026-05-11 00:32:42 +02:00
Add first-class ChatGPT subscription provider support (#881)
* Add first-class ChatGPT subscription provider support * Address PR feedback: move uuid import to top, reuse parsed config in up() * Add ChatGPT token watchdog for seamless long-lived sessions * Address PR feedback: error on stream=false for ChatGPT, fix auth file permissions * Replace ChatGPT watchdog/restart with passthrough_auth --------- Co-authored-by: Musa Malik <musam@uw.edu>
This commit is contained in:
parent
aa726b1bba
commit
78dc4edad9
18 changed files with 693 additions and 20 deletions
|
|
@ -241,6 +241,14 @@ impl StreamContext {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply any extra headers configured on the provider (e.g., ChatGPT-Account-Id, originator)
|
||||
let headers = self.llm_provider().headers.clone();
|
||||
if let Some(headers) = headers {
|
||||
for (key, value) in &headers {
|
||||
self.set_http_request_header(key, Some(value));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -1060,7 +1068,20 @@ impl HttpContext for StreamContext {
|
|||
|
||||
match ProviderRequestType::try_from((deserialized_client_request, upstream)) {
|
||||
Ok(mut request) => {
|
||||
request.normalize_for_upstream(self.get_provider_id(), upstream);
|
||||
if let Err(e) =
|
||||
request.normalize_for_upstream(self.get_provider_id(), upstream)
|
||||
{
|
||||
warn!(
|
||||
"request_id={}: normalize_for_upstream failed: {}",
|
||||
self.request_identifier(),
|
||||
e
|
||||
);
|
||||
self.send_server_error(
|
||||
ServerError::LogicError(e.message),
|
||||
Some(StatusCode::BAD_REQUEST),
|
||||
);
|
||||
return Action::Pause;
|
||||
}
|
||||
debug!(
|
||||
"request_id={}: upstream request payload: {}",
|
||||
self.request_identifier(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue