feat: make it possible to set disable_response_storage = true in config.toml (#714)
https://github.com/openai/codex/pull/642 introduced support for the `--disable-response-storage` flag, but if you are a ZDR customer, it is tedious to set this every time, so this PR makes it possible to set this once in `config.toml` and be done with it. Incidentally, this tidies things up such that now `init_codex()` takes only one parameter: `Config`.
This commit is contained in:
@@ -21,6 +21,13 @@ pub struct Config {
|
||||
pub approval_policy: AskForApproval,
|
||||
#[serde(default)]
|
||||
pub sandbox_policy: SandboxPolicy,
|
||||
|
||||
/// Disable server-side response storage (sends the full conversation
|
||||
/// context with every request). Currently necessary for OpenAI customers
|
||||
/// who have opted into Zero Data Retention (ZDR).
|
||||
#[serde(default)]
|
||||
pub disable_response_storage: bool,
|
||||
|
||||
/// System instructions.
|
||||
pub instructions: Option<String>,
|
||||
}
|
||||
@@ -31,6 +38,7 @@ pub struct ConfigOverrides {
|
||||
pub model: Option<String>,
|
||||
pub approval_policy: Option<AskForApproval>,
|
||||
pub sandbox_policy: Option<SandboxPolicy>,
|
||||
pub disable_response_storage: Option<bool>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -50,6 +58,7 @@ impl Config {
|
||||
model,
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
disable_response_storage,
|
||||
} = overrides;
|
||||
|
||||
if let Some(model) = model {
|
||||
@@ -61,6 +70,9 @@ impl Config {
|
||||
if let Some(sandbox_policy) = sandbox_policy {
|
||||
cfg.sandbox_policy = sandbox_policy;
|
||||
}
|
||||
if let Some(disable_response_storage) = disable_response_storage {
|
||||
cfg.disable_response_storage = disable_response_storage;
|
||||
}
|
||||
Ok(cfg)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user