feat(ai): Support HTTP proxy through environment variables
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user