@@ -305,23 +305,6 @@ func RegisterUIRoutes(app *fiber.App,
305305		})
306306	}
307307
308- 	// Show the Chat page 
309- 	app .Get ("/chat/:model" , func (c  * fiber.Ctx ) error  {
310- 		backendConfigs , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .SKIP_IF_CONFIGURED )
311- 
312- 		summary  :=  fiber.Map {
313- 			"Title" :        "LocalAI - Chat with "  +  c .Params ("model" ),
314- 			"BaseURL" :      utils .BaseURL (c ),
315- 			"ModelsConfig" : backendConfigs ,
316- 			"Model" :        c .Params ("model" ),
317- 			"Version" :      internal .PrintableVersion (),
318- 			"IsP2PEnabled" : p2p .IsP2PEnabled (),
319- 		}
320- 
321- 		// Render index 
322- 		return  c .Render ("views/chat" , summary )
323- 	})
324- 
325308	app .Get ("/talk/" , func (c  * fiber.Ctx ) error  {
326309		backendConfigs , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .SKIP_IF_CONFIGURED )
327310
@@ -345,20 +328,45 @@ func RegisterUIRoutes(app *fiber.App,
345328
346329	app .Get ("/chat/" , func (c  * fiber.Ctx ) error  {
347330
348- 		backendConfigs , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .SKIP_IF_CONFIGURED )
331+ 		allModels , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .SKIP_IF_CONFIGURED )
332+ 		backendConfigs  :=  cl .GetAllBackendConfigs ()
333+ 		modelsWithoutConfig , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .LOOSE_ONLY )
349334
350- 		if  len (backendConfigs ) ==  0  {
335+ 		if  len (allModels ) ==  0  {
351336			// If no model is available redirect to the index which suggests how to install models 
352337			return  c .Redirect (utils .BaseURL (c ))
353338		}
354339
355340		summary  :=  fiber.Map {
356- 			"Title" :        "LocalAI - Chat with "  +  backendConfigs [0 ],
357- 			"BaseURL" :      utils .BaseURL (c ),
358- 			"ModelsConfig" : backendConfigs ,
359- 			"Model" :        backendConfigs [0 ],
360- 			"Version" :      internal .PrintableVersion (),
361- 			"IsP2PEnabled" : p2p .IsP2PEnabled (),
341+ 			"Title" :               "LocalAI - Chat with "  +  allModels [0 ],
342+ 			"BaseURL" :             utils .BaseURL (c ),
343+ 			"AllModels" :           allModels ,
344+ 			"ModelsWithoutConfig" : modelsWithoutConfig ,
345+ 			"ModelsConfig" :        backendConfigs ,
346+ 			"Model" :               allModels [0 ],
347+ 			"Version" :             internal .PrintableVersion (),
348+ 			"IsP2PEnabled" :        p2p .IsP2PEnabled (),
349+ 		}
350+ 
351+ 		// Render index 
352+ 		return  c .Render ("views/chat" , summary )
353+ 	})
354+ 
355+ 	// Show the Chat page 
356+ 	app .Get ("/chat/:model" , func (c  * fiber.Ctx ) error  {
357+ 		allModels , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .SKIP_IF_CONFIGURED )
358+ 		backendConfigs  :=  cl .GetAllBackendConfigs ()
359+ 		modelsWithoutConfig , _  :=  services .ListModels (cl , ml , config .NoFilterFn , services .LOOSE_ONLY )
360+ 
361+ 		summary  :=  fiber.Map {
362+ 			"Title" :               "LocalAI - Chat with "  +  c .Params ("model" ),
363+ 			"BaseURL" :             utils .BaseURL (c ),
364+ 			"ModelsConfig" :        backendConfigs ,
365+ 			"ModelsWithoutConfig" : modelsWithoutConfig ,
366+ 			"AllModels" :           allModels ,
367+ 			"Model" :               c .Params ("model" ),
368+ 			"Version" :             internal .PrintableVersion (),
369+ 			"IsP2PEnabled" :        p2p .IsP2PEnabled (),
362370		}
363371
364372		// Render index 
0 commit comments