@@ -26,6 +26,7 @@ func RegisterUIRoutes(app *fiber.App,
26
26
appConfig * config.ApplicationConfig ,
27
27
galleryService * services.GalleryService ,
28
28
auth func (* fiber.Ctx ) error ) {
29
+ tmpLMS := services .NewListModelsService (ml , cl , appConfig ) // TODO: once createApplication() is fully in use, reference the central instance.
29
30
30
31
// keeps the state of models that are being installed from the UI
31
32
var processingModels = xsync .NewSyncedMap [string , string ]()
@@ -235,7 +236,7 @@ func RegisterUIRoutes(app *fiber.App,
235
236
236
237
// Show the Chat page
237
238
app .Get ("/chat/:model" , auth , func (c * fiber.Ctx ) error {
238
- backendConfigs := cl . GetAllBackendConfigs ( )
239
+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
239
240
240
241
summary := fiber.Map {
241
242
"Title" : "LocalAI - Chat with " + c .Params ("model" ),
@@ -249,7 +250,7 @@ func RegisterUIRoutes(app *fiber.App,
249
250
})
250
251
251
252
app .Get ("/talk/" , auth , func (c * fiber.Ctx ) error {
252
- backendConfigs := cl . GetAllBackendConfigs ( )
253
+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
253
254
254
255
if len (backendConfigs ) == 0 {
255
256
// If no model is available redirect to the index which suggests how to install models
@@ -259,7 +260,7 @@ func RegisterUIRoutes(app *fiber.App,
259
260
summary := fiber.Map {
260
261
"Title" : "LocalAI - Talk" ,
261
262
"ModelsConfig" : backendConfigs ,
262
- "Model" : backendConfigs [0 ].Name ,
263
+ "Model" : backendConfigs [0 ].ID ,
263
264
"Version" : internal .PrintableVersion (),
264
265
}
265
266
@@ -269,17 +270,17 @@ func RegisterUIRoutes(app *fiber.App,
269
270
270
271
app .Get ("/chat/" , auth , func (c * fiber.Ctx ) error {
271
272
272
- backendConfigs := cl . GetAllBackendConfigs ( )
273
+ backendConfigs , _ := tmpLMS . ListModels ( "" , true )
273
274
274
275
if len (backendConfigs ) == 0 {
275
276
// If no model is available redirect to the index which suggests how to install models
276
277
return c .Redirect ("/" )
277
278
}
278
279
279
280
summary := fiber.Map {
280
- "Title" : "LocalAI - Chat with " + backendConfigs [0 ].Name ,
281
+ "Title" : "LocalAI - Chat with " + backendConfigs [0 ].ID ,
281
282
"ModelsConfig" : backendConfigs ,
282
- "Model" : backendConfigs [0 ].Name ,
283
+ "Model" : backendConfigs [0 ].ID ,
283
284
"Version" : internal .PrintableVersion (),
284
285
}
285
286
0 commit comments