mirror of
https://github.com/openai/codex.git
synced 2026-09-16 12:13:30 +00:00
This introduces a much-needed "profile" concept where users can specify a collection of options under one name and then pass that via `--profile` to the CLI. This PR introduces the `ConfigProfile` struct and makes it a field of `CargoToml`. It further updates `Config::load_from_base_config_with_overrides()` to respect `ConfigProfile`, overriding default values where appropriate. A detailed unit test is added at the end of `config.rs` to verify this behavior. Details on how to use this feature have also been added to `codex-rs/README.md`.
26 lines
913 B
Rust
26 lines
913 B
Rust
use std::time::Duration;
|
|
|
|
use env_flags::env_flags;
|
|
|
|
env_flags! {
|
|
pub OPENAI_DEFAULT_MODEL: &str = "o4-mini";
|
|
pub OPENAI_API_BASE: &str = "https://api.openai.com/v1";
|
|
|
|
/// Fallback when the provider-specific key is not set.
|
|
pub OPENAI_API_KEY: Option<&str> = None;
|
|
pub OPENAI_TIMEOUT_MS: Duration = Duration::from_millis(300_000), |value| {
|
|
value.parse().map(Duration::from_millis)
|
|
};
|
|
pub OPENAI_REQUEST_MAX_RETRIES: u64 = 4;
|
|
pub OPENAI_STREAM_MAX_RETRIES: u64 = 10;
|
|
|
|
// We generally don't want to disconnect; this updates the timeout to be five minutes
|
|
// which matches the upstream typescript codex impl.
|
|
pub OPENAI_STREAM_IDLE_TIMEOUT_MS: Duration = Duration::from_millis(300_000), |value| {
|
|
value.parse().map(Duration::from_millis)
|
|
};
|
|
|
|
/// Fixture path for offline tests (see client.rs).
|
|
pub CODEX_RS_SSE_FIXTURE: Option<&str> = None;
|
|
}
|