mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 09:01:49 +00:00
feat(ai): Support HTTP proxy through environment variables
This commit is contained in:
parent
3635e45ffd
commit
1e718e63ea
4 changed files with 314 additions and 13 deletions
|
|
@ -14,6 +14,15 @@ import type {
|
|||
|
||||
export { getEnvApiKey } from "./env-api-keys.js";
|
||||
|
||||
// Set up http proxy according to env variables for `fetch` based SDKs in Node.js.
|
||||
// Bun has builtin support for this.
|
||||
if (typeof process !== "undefined" && process.versions?.node) {
|
||||
import("undici").then((m) => {
|
||||
const { EnvHttpProxyAgent, setGlobalDispatcher } = m;
|
||||
setGlobalDispatcher(new EnvHttpProxyAgent());
|
||||
});
|
||||
}
|
||||
|
||||
function resolveApiProvider(api: Api) {
|
||||
const provider = getApiProvider(api);
|
||||
if (!provider) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue