fix(opencode): make models.dev providers cache-independent
This commit is contained in:
@ -22,6 +22,7 @@ use domain::profile::{
|
||||
use crate::error::AppError;
|
||||
|
||||
use super::catalogue::{reference_profile_id, reference_profiles, selectable_reference_profiles};
|
||||
use super::provider_catalogue::catalogue_custom_provider;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DetectProfiles
|
||||
@ -361,6 +362,12 @@ impl SaveOpenCodeProviderProfile {
|
||||
&self,
|
||||
input: SaveOpenCodeProviderProfileInput,
|
||||
) -> Result<SaveOpenCodeProviderProfileOutput, AppError> {
|
||||
let custom = match input.custom {
|
||||
Some(custom) => Some(custom),
|
||||
None => catalogue_custom_provider(&input.provider_id, &input.model)
|
||||
.map_err(AppError::Invalid)?,
|
||||
};
|
||||
|
||||
let secret_ref = input
|
||||
.profile
|
||||
.opencode_provider
|
||||
@ -370,10 +377,9 @@ impl SaveOpenCodeProviderProfile {
|
||||
|
||||
self.secret_store.put(&secret_ref, &input.api_key).await?;
|
||||
|
||||
let mut provider =
|
||||
OpenCodeProviderConfig::new(input.provider_id, input.model, secret_ref)
|
||||
.map_err(|e| AppError::Invalid(e.to_string()))?;
|
||||
if let Some(custom) = input.custom {
|
||||
let mut provider = OpenCodeProviderConfig::new(input.provider_id, input.model, secret_ref)
|
||||
.map_err(|e| AppError::Invalid(e.to_string()))?;
|
||||
if let Some(custom) = custom {
|
||||
provider = provider.with_custom(custom);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user