fix: raise request body limit to 1GB
This commit is contained in:
+12
-6
@@ -6,7 +6,9 @@ import { copyFile, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
export const DEFAULT_STATE_ROOT = path.join(os.homedir(), ".codex-retry-gateway");
|
||||
export const DEFAULT_STATE_ROOT = path.join(os.homedir(), ".codex-retry-gateway");
|
||||
const DEFAULT_REQUEST_BODY_LIMIT_BYTES = 1024 * 1024 * 1024;
|
||||
const LEGACY_DEFAULT_REQUEST_BODY_LIMIT_BYTES = 10 * 1024 * 1024;
|
||||
export const DEFAULT_CODEX_CONFIG_PATH = path.join(os.homedir(), ".codex", "config.toml");
|
||||
export const DEFAULT_LISTEN_HOST = "127.0.0.1";
|
||||
export const DEFAULT_LISTEN_PORT = 4610;
|
||||
@@ -368,7 +370,7 @@ export async function startGateway({
|
||||
return `Gateway started. PID=${child.pid}. Listen=${getGatewayBaseUrl(gatewayConfig.listen_host, gatewayConfig.listen_port)}`;
|
||||
}
|
||||
|
||||
export async function installForCurrentProvider({
|
||||
export async function installForCurrentProvider({
|
||||
codexConfigPath = DEFAULT_CODEX_CONFIG_PATH,
|
||||
stateRoot = DEFAULT_STATE_ROOT,
|
||||
listenHost = DEFAULT_LISTEN_HOST,
|
||||
@@ -419,10 +421,14 @@ export async function installForCurrentProvider({
|
||||
listen_host: listenHost,
|
||||
listen_port: listenPort,
|
||||
upstream_base_url: originalBaseUrl,
|
||||
request_body_limit_bytes:
|
||||
existingGatewayConfig?.request_body_limit_bytes === undefined || existingGatewayConfig?.request_body_limit_bytes === null
|
||||
? 10485760
|
||||
: Number.parseInt(`${existingGatewayConfig.request_body_limit_bytes}`, 10),
|
||||
request_body_limit_bytes:
|
||||
existingGatewayConfig?.request_body_limit_bytes === undefined || existingGatewayConfig?.request_body_limit_bytes === null
|
||||
? DEFAULT_REQUEST_BODY_LIMIT_BYTES
|
||||
: (
|
||||
Number.parseInt(`${existingGatewayConfig.request_body_limit_bytes}`, 10) === LEGACY_DEFAULT_REQUEST_BODY_LIMIT_BYTES
|
||||
? DEFAULT_REQUEST_BODY_LIMIT_BYTES
|
||||
: Number.parseInt(`${existingGatewayConfig.request_body_limit_bytes}`, 10)
|
||||
),
|
||||
endpoints: mergedEndpoints,
|
||||
reasoning_equals: normalizeIntArray(existingGatewayConfig?.reasoning_equals, [516]),
|
||||
retryable_status_codes: normalizeIntArray(existingGatewayConfig?.retryable_status_codes, [429, 503]),
|
||||
|
||||
Reference in New Issue
Block a user