diff --git a/core/backend/soundgeneration.go b/core/backend/soundgeneration.go index 5780d59cca4b..66674ced556b 100644 --- a/core/backend/soundgeneration.go +++ b/core/backend/soundgeneration.go @@ -19,7 +19,6 @@ func SoundGeneration( doSample *bool, sourceFile *string, sourceDivisor *int32, - displayModelName string, loader *model.ModelLoader, appConfig *config.ApplicationConfig, backendConfig config.BackendConfig, @@ -40,16 +39,12 @@ func SoundGeneration( return "", nil, fmt.Errorf("failed creating audio directory: %s", err) } - if displayModelName == "" { - displayModelName = backendConfig.Model - } - fileName := utils.GenerateUniqueFileName(appConfig.AudioDir, "sound_generation", ".wav") filePath := filepath.Join(appConfig.AudioDir, fileName) res, err := soundGenModel.SoundGeneration(context.Background(), &proto.SoundGenerationRequest{ Text: text, - Model: displayModelName, + Model: backendConfig.Model, Dst: filePath, Sample: doSample, Duration: duration, diff --git a/core/backend/tts.go b/core/backend/tts.go index 1f74ad5c1927..7e4e511c8e29 100644 --- a/core/backend/tts.go +++ b/core/backend/tts.go @@ -7,6 +7,7 @@ import ( "path/filepath" "github.com/mudler/LocalAI/core/config" + "github.com/rs/zerolog/log" "github.com/mudler/LocalAI/pkg/grpc/proto" "github.com/mudler/LocalAI/pkg/model" @@ -17,7 +18,6 @@ func ModelTTS( text, voice, language string, - displayModelName string, loader *model.ModelLoader, appConfig *config.ApplicationConfig, backendConfig config.BackendConfig, @@ -38,16 +38,14 @@ func ModelTTS( return "", nil, fmt.Errorf("failed creating audio directory: %s", err) } - if displayModelName == "" { - displayModelName = backendConfig.Model - } + log.Warn().Str("config.Model", backendConfig.Model).Str("config.Backend", backendConfig.Backend).Msg("ModelTTS before call to backend (ttsModel.TTS)") fileName := utils.GenerateUniqueFileName(appConfig.AudioDir, "tts", ".wav") filePath := filepath.Join(appConfig.AudioDir, fileName) res, err := ttsModel.TTS(context.Background(), &proto.TTSRequest{ Text: text, - Model: displayModelName, + Model: backendConfig.Model, Voice: voice, Dst: filePath, Language: &language, diff --git a/core/cli/soundgeneration.go b/core/cli/soundgeneration.go index 6d0d78dff903..a8acd6baa90e 100644 --- a/core/cli/soundgeneration.go +++ b/core/cli/soundgeneration.go @@ -95,7 +95,7 @@ func (t *SoundGenerationCMD) Run(ctx *cliContext.Context) error { filePath, _, err := backend.SoundGeneration(text, parseToFloat32Ptr(t.Duration), parseToFloat32Ptr(t.Temperature), &t.DoSample, - inputFile, parseToInt32Ptr(t.InputFileSampleDivisor), "", ml, opts, options) + inputFile, parseToInt32Ptr(t.InputFileSampleDivisor), ml, opts, options) if err != nil { return err diff --git a/core/cli/tts.go b/core/cli/tts.go index 18b70b355749..af51ce069643 100644 --- a/core/cli/tts.go +++ b/core/cli/tts.go @@ -55,7 +55,7 @@ func (t *TTSCMD) Run(ctx *cliContext.Context) error { options.Backend = t.Backend options.Model = t.Model - filePath, _, err := backend.ModelTTS(text, t.Voice, t.Language, "", ml, opts, options) + filePath, _, err := backend.ModelTTS(text, t.Voice, t.Language, ml, opts, options) if err != nil { return err } diff --git a/core/http/endpoints/elevenlabs/soundgeneration.go b/core/http/endpoints/elevenlabs/soundgeneration.go index 7b937859babd..548716def741 100644 --- a/core/http/endpoints/elevenlabs/soundgeneration.go +++ b/core/http/endpoints/elevenlabs/soundgeneration.go @@ -31,7 +31,7 @@ func SoundGenerationEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoad log.Debug().Str("modelFile", "modelFile").Str("backend", cfg.Backend).Msg("Sound Generation Request about to be sent to backend") // TODO: Support uploading files? - filePath, _, err := backend.SoundGeneration(input.Text, input.Duration, input.Temperature, input.DoSample, nil, nil, input.ModelID, ml, appConfig, *cfg) + filePath, _, err := backend.SoundGeneration(input.Text, input.Duration, input.Temperature, input.DoSample, nil, nil, ml, appConfig, *cfg) if err != nil { return err } diff --git a/core/http/endpoints/elevenlabs/tts.go b/core/http/endpoints/elevenlabs/tts.go index cb39be09665a..4845887014f9 100644 --- a/core/http/endpoints/elevenlabs/tts.go +++ b/core/http/endpoints/elevenlabs/tts.go @@ -34,7 +34,7 @@ func TTSEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfi log.Debug().Str("modelName", input.ModelID).Msg("elevenlabs TTS request recieved") - filePath, _, err := backend.ModelTTS(input.Text, voiceID, input.LanguageCode, input.ModelID, ml, appConfig, *cfg) + filePath, _, err := backend.ModelTTS(input.Text, voiceID, input.LanguageCode, ml, appConfig, *cfg) if err != nil { return err } diff --git a/core/http/endpoints/localai/tts.go b/core/http/endpoints/localai/tts.go index a65a886680d8..7f8b9aaa854d 100644 --- a/core/http/endpoints/localai/tts.go +++ b/core/http/endpoints/localai/tts.go @@ -51,7 +51,7 @@ func TTSEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfi cfg.Voice = input.Voice } - filePath, _, err := backend.ModelTTS(input.Input, cfg.Voice, cfg.Language, input.Model, ml, appConfig, *cfg) + filePath, _, err := backend.ModelTTS(input.Input, cfg.Voice, cfg.Language, ml, appConfig, *cfg) if err != nil { return err }