@@ -3353,6 +3353,40 @@ describe("createConfiguredOllamaStreamFn", () => {
33533353 ) ;
33543354 } ) ;
33553355
3356+ it ( "acquires the provider service when model baseUrl is whitespace" , async ( ) => {
3357+ await withMockNdjsonFetch (
3358+ [
3359+ '{"model":"m","created_at":"t","message":{"role":"assistant","content":"ok"},"done":false}' ,
3360+ '{"model":"m","created_at":"t","message":{"role":"assistant","content":""},"done":true,"prompt_eval_count":1,"eval_count":1}' ,
3361+ ] ,
3362+ async ( fetchMock ) => {
3363+ const acquire = vi . fn ( async ( ) => ( { release : vi . fn ( ) } ) ) ;
3364+ const streamFn = createConfiguredOllamaStreamFn ( {
3365+ model : { baseUrl : " " } ,
3366+ localService : { providerId : "ollama-gpu" , acquire } ,
3367+ } ) ;
3368+ const stream = await Promise . resolve (
3369+ streamFn (
3370+ {
3371+ id : "qwen3:32b" ,
3372+ api : "ollama" ,
3373+ provider : "ollama-gpu" ,
3374+ contextWindow : 131072 ,
3375+ } as never ,
3376+ { messages : [ { role : "user" , content : "hello" } ] } as never ,
3377+ { } as never ,
3378+ ) ,
3379+ ) ;
3380+
3381+ const events = await collectStreamEvents ( stream ) ;
3382+
3383+ expect ( events . at ( - 1 ) ) . toMatchObject ( { type : "done" } ) ;
3384+ expect ( acquire ) . toHaveBeenCalledOnce ( ) ;
3385+ expect ( getGuardedFetchCall ( fetchMock ) . url ) . toBe ( "http://127.0.0.1:11434/api/chat" ) ;
3386+ } ,
3387+ ) ;
3388+ } ) ;
3389+
33563390 it ( "uses provider-level baseUrl when model baseUrl is absent" , async ( ) => {
33573391 await withMockNdjsonFetch (
33583392 [
0 commit comments