mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-29 17:08:52 +00:00
refactor
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
4f6cfdf7e4
commit
a32f704e4a
@ -137,7 +137,7 @@ func newModel(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *
|
|||||||
// If we don't have Wrapped model definitions, just return a standard model
|
// If we don't have Wrapped model definitions, just return a standard model
|
||||||
opts := backend.ModelOptions(*cfg, appConfig, model.WithBackendString(cfg.Backend),
|
opts := backend.ModelOptions(*cfg, appConfig, model.WithBackendString(cfg.Backend),
|
||||||
model.WithModel(cfg.Model))
|
model.WithModel(cfg.Model))
|
||||||
return ml.BackendLoader(opts...)
|
return ml.Load(opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Msg("Loading a wrapped model")
|
log.Debug().Msg("Loading a wrapped model")
|
||||||
@ -174,19 +174,19 @@ func newModel(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts := backend.ModelOptions(*cfgTTS, appConfig)
|
opts := backend.ModelOptions(*cfgTTS, appConfig)
|
||||||
ttsClient, err := ml.BackendLoader(opts...)
|
ttsClient, err := ml.Load(opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load tts model: %w", err)
|
return nil, fmt.Errorf("failed to load tts model: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = backend.ModelOptions(*cfgSST, appConfig)
|
opts = backend.ModelOptions(*cfgSST, appConfig)
|
||||||
transcriptionClient, err := ml.BackendLoader(opts...)
|
transcriptionClient, err := ml.Load(opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load SST model: %w", err)
|
return nil, fmt.Errorf("failed to load SST model: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = backend.ModelOptions(*cfgLLM, appConfig)
|
opts = backend.ModelOptions(*cfgLLM, appConfig)
|
||||||
llmClient, err := ml.BackendLoader(opts...)
|
llmClient, err := ml.Load(opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load LLM model: %w", err)
|
return nil, fmt.Errorf("failed to load LLM model: %w", err)
|
||||||
}
|
}
|
||||||
@ -571,6 +571,9 @@ func handleVAD(session *Session, conversation *Conversation, c *websocket.Conn,
|
|||||||
|
|
||||||
// Function to generate a response based on the conversation
|
// Function to generate a response based on the conversation
|
||||||
func generateResponse(session *Session, conversation *Conversation, responseCreate ResponseCreate, c *websocket.Conn, mt int) {
|
func generateResponse(session *Session, conversation *Conversation, responseCreate ResponseCreate, c *websocket.Conn, mt int) {
|
||||||
|
|
||||||
|
log.Debug().Msg("Generating realtime response...")
|
||||||
|
|
||||||
// Compile the conversation history
|
// Compile the conversation history
|
||||||
conversation.Lock.Lock()
|
conversation.Lock.Lock()
|
||||||
var conversationHistory []string
|
var conversationHistory []string
|
||||||
|
Loading…
Reference in New Issue
Block a user