diff --git a/KoeBook.Core/Services/ClaudeAnalyzerService.cs b/KoeBook.Core/Services/ClaudeAnalyzerService.cs index f47aeaf..3d1dd8a 100644 --- a/KoeBook.Core/Services/ClaudeAnalyzerService.cs +++ b/KoeBook.Core/Services/ClaudeAnalyzerService.cs @@ -71,7 +71,7 @@ private Dictionary ExtractCharacterVoiceMapping(string response, .Select(l => { var characterId = l[1..l.IndexOf('.')]; - var voiceTypeSpan = l.AsSpan()[(l.IndexOf(':') + 2)..]; + var voiceTypeSpan = l.AsSpan()[(l.IndexOf(':') + 2)..].Trim(); // ボイス割り当てが複数あたったときに先頭のものを使う(例:群衆 AdultMan, AdultWoman) var separatorIndex = voiceTypeSpan.IndexOfAny(_searchValues); if (separatorIndex > 0) diff --git a/KoeBook.Core/Services/SoundGenerationSelectorService.cs b/KoeBook.Core/Services/SoundGenerationSelectorService.cs index 4304f87..dce8365 100644 --- a/KoeBook.Core/Services/SoundGenerationSelectorService.cs +++ b/KoeBook.Core/Services/SoundGenerationSelectorService.cs @@ -18,7 +18,7 @@ public async ValueTask InitializeAsync(CancellationToken cancellationToken) .GetFromJsonAsync>("/models/info", ExceptionType.InitializeFailed, cancellationToken) .ConfigureAwait(false); - Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk, kvp.Value.Styles)).ToArray(); + Models = models.Select(kvp => new SoundModel(kvp.Key, kvp.Value.FirstSpk.Replace(" ", ""), kvp.Value.Styles)).ToArray(); } catch (EbookException e) when (e.ExceptionType == ExceptionType.UnknownStyleBertVitsRoot) { } } diff --git a/KoeBook.Core/Services/SoundGenerationService.cs b/KoeBook.Core/Services/SoundGenerationService.cs index 79a2d72..350ab6b 100644 --- a/KoeBook.Core/Services/SoundGenerationService.cs +++ b/KoeBook.Core/Services/SoundGenerationService.cs @@ -20,8 +20,8 @@ public async ValueTask GenerateLineSoundAsync(ScriptLine scriptLine, Boo var queryCollection = HttpUtility.ParseQueryString(string.Empty); queryCollection.Add("text", scriptLine.Text); queryCollection.Add("model_id", soundModel.Id); - queryCollection.Add("style", scriptLine.Style); + queryCollection.Add("style", style); return await _styleBertVitsClientService - .GetAsByteArrayAsync($"/voice/{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); + .GetAsByteArrayAsync($"/voice?{queryCollection}", ExceptionType.SoundGenerationFailed, cancellationToken).ConfigureAwait(false); } }