feat: update NewConversationParams to take an optional model_provider (#5793)
An AppServer client should be able to use any (`model_provider`, `model`) in the user's config. `NewConversationParams` already supported specifying the `model`, but this PR expands it to support `model_provider`, as well. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/5793). * #5803 * __->__ #5793
This commit is contained in:
@@ -266,6 +266,10 @@ pub struct NewConversationParams {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub model: Option<String>,
|
pub model: Option<String>,
|
||||||
|
|
||||||
|
/// Override the model provider to use for this session.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub model_provider: Option<String>,
|
||||||
|
|
||||||
/// Configuration profile from config.toml to specify default options.
|
/// Configuration profile from config.toml to specify default options.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub profile: Option<String>,
|
pub profile: Option<String>,
|
||||||
@@ -1032,6 +1036,7 @@ mod tests {
|
|||||||
request_id: RequestId::Integer(42),
|
request_id: RequestId::Integer(42),
|
||||||
params: NewConversationParams {
|
params: NewConversationParams {
|
||||||
model: Some("gpt-5-codex".to_string()),
|
model: Some("gpt-5-codex".to_string()),
|
||||||
|
model_provider: None,
|
||||||
profile: None,
|
profile: None,
|
||||||
cwd: None,
|
cwd: None,
|
||||||
approval_policy: Some(AskForApproval::OnRequest),
|
approval_policy: Some(AskForApproval::OnRequest),
|
||||||
|
|||||||
@@ -1610,6 +1610,7 @@ async fn derive_config_from_params(
|
|||||||
) -> std::io::Result<Config> {
|
) -> std::io::Result<Config> {
|
||||||
let NewConversationParams {
|
let NewConversationParams {
|
||||||
model,
|
model,
|
||||||
|
model_provider,
|
||||||
profile,
|
profile,
|
||||||
cwd,
|
cwd,
|
||||||
approval_policy,
|
approval_policy,
|
||||||
@@ -1625,7 +1626,7 @@ async fn derive_config_from_params(
|
|||||||
cwd: cwd.map(PathBuf::from),
|
cwd: cwd.map(PathBuf::from),
|
||||||
approval_policy,
|
approval_policy,
|
||||||
sandbox_mode,
|
sandbox_mode,
|
||||||
model_provider: None,
|
model_provider,
|
||||||
codex_linux_sandbox_exe,
|
codex_linux_sandbox_exe,
|
||||||
base_instructions,
|
base_instructions,
|
||||||
include_apply_patch_tool,
|
include_apply_patch_tool,
|
||||||
|
|||||||
Reference in New Issue
Block a user