@@ -26,6 +26,7 @@ func RegisterUIRoutes(app *fiber.App,
2626 appConfig * config.ApplicationConfig ,
2727 galleryService * services.GalleryService ,
2828 auth func (* fiber.Ctx ) error ) {
29+ tmpLMS := services .NewListModelsService (ml , cl , appConfig ) // TODO: once createApplication() is fully in use, reference the central instance.
2930
3031 // keeps the state of models that are being installed from the UI
3132 var processingModels = xsync .NewSyncedMap [string , string ]()
@@ -235,7 +236,7 @@ func RegisterUIRoutes(app *fiber.App,
235236
236237 // Show the Chat page
237238 app .Get ("/chat/:model" , auth , func (c * fiber.Ctx ) error {
238- backendConfigs := cl . GetAllBackendConfigs ( )
239+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
239240
240241 summary := fiber.Map {
241242 "Title" : "LocalAI - Chat with " + c .Params ("model" ),
@@ -249,7 +250,7 @@ func RegisterUIRoutes(app *fiber.App,
249250 })
250251
251252 app .Get ("/talk/" , auth , func (c * fiber.Ctx ) error {
252- backendConfigs := cl . GetAllBackendConfigs ( )
253+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
253254
254255 if len (backendConfigs ) == 0 {
255256 // If no model is available redirect to the index which suggests how to install models
@@ -259,7 +260,7 @@ func RegisterUIRoutes(app *fiber.App,
259260 summary := fiber.Map {
260261 "Title" : "LocalAI - Talk" ,
261262 "ModelsConfig" : backendConfigs ,
262- "Model" : backendConfigs [0 ].Name ,
263+ "Model" : backendConfigs [0 ].ID ,
263264 "Version" : internal .PrintableVersion (),
264265 }
265266
@@ -269,17 +270,17 @@ func RegisterUIRoutes(app *fiber.App,
269270
270271 app .Get ("/chat/" , auth , func (c * fiber.Ctx ) error {
271272
272- backendConfigs := cl . GetAllBackendConfigs ( )
273+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
273274
274275 if len (backendConfigs ) == 0 {
275276 // If no model is available redirect to the index which suggests how to install models
276277 return c .Redirect ("/" )
277278 }
278279
279280 summary := fiber.Map {
280- "Title" : "LocalAI - Chat with " + backendConfigs [0 ].Name ,
281+ "Title" : "LocalAI - Chat with " + backendConfigs [0 ].ID ,
281282 "ModelsConfig" : backendConfigs ,
282- "Model" : backendConfigs [0 ].Name ,
283+ "Model" : backendConfigs [0 ].ID ,
283284 "Version" : internal .PrintableVersion (),
284285 }
285286
0 commit comments