Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(attachments): preserve injected model profile when absent

Steven Enamakel661059f0c6e4
diff --git a/crates/openhuman-core/src/attachments/provider.rs b/crates/openhuman-core/src/attachments/provider.rs
index 17149c82dc..0f22a61aef 100644
--- a/crates/openhuman-core/src/attachments/provider.rs
+++ b/crates/openhuman-core/src/attachments/provider.rs
@@ -70,7 +70,7 @@ pub(crate) fn wrap(
}
profile.modalities.image_in |=
crate::inference::model_context::model_vision_enabled(model, &config);
- owner::wrap(ctx, inner, config, profile)
+ owner::wrap(ctx, inner, config, Some(profile))
}
/// Injected models supply their own selected-model facts through ModelProfile.
@@ -80,7 +80,7 @@ pub(crate) fn wrap_injected(
inner: Arc<dyn ChatModel<()>>,
config: Arc<Config>,
) -> Arc<dyn ChatModel<()>> {
- let profile = inner.profile().cloned().unwrap_or_default();
+ let profile = inner.profile().cloned();
owner::wrap(ctx, inner, config, profile)
}
diff --git a/crates/openhuman-core/src/attachments/provider_owner.rs b/crates/openhuman-core/src/attachments/provider_owner.rs
index bf9ceb7218..5cd24d4d85 100644
--- a/crates/openhuman-core/src/attachments/provider_owner.rs
+++ b/crates/openhuman-core/src/attachments/provider_owner.rs
@@ -12,7 +12,7 @@ pub(super) fn wrap(
ctx: &crate::core::runtime::DispatchCtx,
inner: Arc<dyn ChatModel<()>>,
config: Arc<Config>,
- profile: ModelProfile,
+ profile: Option<ModelProfile>,
) -> Arc<dyn ChatModel<()>> {
let host = Arc::new(AttachmentModel {
config: config.clone(),
@@ -49,11 +49,16 @@ pub(super) fn wrap(
|_, request| Ok(super::super::take_request_scope(&mut request.metadata)),
host.clone(),
extractor,
- )
- .with_profile(profile)
- .with_fallback_renderer(host.clone())
- .with_fallback_cache(host.clone())
- .with_history_fallback(host.clone());
+ );
+ let model = if let Some(profile) = profile {
+ model.with_profile(profile)
+ } else {
+ model
+ };
+ let model = model
+ .with_fallback_renderer(host.clone())
+ .with_fallback_cache(host.clone())
+ .with_history_fallback(host.clone());
Arc::new(model)
}