diff --git a/packages/data-provider/src/resolve-llm-delivery-path.spec.ts b/packages/data-provider/src/resolve-llm-delivery-path.spec.ts index 5d316578f5..09999f8bf0 100644 --- a/packages/data-provider/src/resolve-llm-delivery-path.spec.ts +++ b/packages/data-provider/src/resolve-llm-delivery-path.spec.ts @@ -189,6 +189,15 @@ describe('resolveDefaultLLMDeliveryPath', () => { ); }); + it('keeps the system default when the provider is unresolved (agents container)', () => { + expect(resolveDefaultLLMDeliveryPath('audio/mpeg', undefined, undefined, 'agents')).toBe( + 'provider', + ); + expect(resolveDefaultLLMDeliveryPath('application/pdf', undefined, undefined, 'agents')).toBe( + 'provider', + ); + }); + it('should export SYSTEM_LLM_DELIVERY_DEFAULTS with correct shape', () => { expect(SYSTEM_LLM_DELIVERY_DEFAULTS.fallback).toBe('text'); expect(SYSTEM_LLM_DELIVERY_DEFAULTS.overrides).toEqual({ diff --git a/packages/data-provider/src/resolve-llm-delivery-path.ts b/packages/data-provider/src/resolve-llm-delivery-path.ts index f6e9ebb597..02392182d6 100644 --- a/packages/data-provider/src/resolve-llm-delivery-path.ts +++ b/packages/data-provider/src/resolve-llm-delivery-path.ts @@ -70,7 +70,12 @@ export function resolveDefaultLLMDeliveryPath( /** Only the system default is capability-gated: an explicit config above is the * admin's decision. A known endpoint that cannot encode documents or media would * otherwise accept the upload and hand the model nothing at all. */ - if (systemDefault === 'provider' && endpoint != null && !isProviderCapable(mimeType, endpoint)) { + /** `agents` is a container, not a provider: it is what an upload reports when the + * agent's real provider could not be resolved, as for ephemeral agents. Judging + * capability from it would downgrade media the actual provider can deliver, so an + * unresolved provider keeps the system default. */ + const providerKnown = endpoint != null && endpoint !== EModelEndpoint.agents; + if (systemDefault === 'provider' && providerKnown && !isProviderCapable(mimeType, endpoint)) { return 'text'; }