2026-07-11 18:23:01 +07:00
|
|
|
use crate::model::settings::Settings;
|
|
|
|
|
|
|
|
|
|
pub const PROVIDERS: &[&str] = &["OpenRouter", "Anthropic", "OpenAI"];
|
|
|
|
|
|
|
|
|
|
pub fn set_provider(settings: &mut Settings, provider: &str) {
|
|
|
|
|
settings.provider = match provider {
|
|
|
|
|
"OpenRouter" => "openrouter".to_string(),
|
|
|
|
|
"Anthropic" => "anthropic".to_string(),
|
|
|
|
|
"OpenAI" => "openai".to_string(),
|
|
|
|
|
_ => "openrouter".to_string(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn set_api_key(settings: &mut Settings, key: String) {
|
|
|
|
|
settings.api_key = Some(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn set_model(settings: &mut Settings, model: String) {
|
|
|
|
|
settings.model = model;
|
|
|
|
|
}
|