Skip to content

Commit

Permalink
#25 ステータスを変化させる
Browse files Browse the repository at this point in the history
  • Loading branch information
aiueo-1234 committed Apr 28, 2024
1 parent a47d535 commit 98f50b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion KoeBook.Core/Services/ClaudeAnalyzerService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Buffers;
using System.Text;
using KoeBook.Core.Contracts.Services;
using KoeBook.Core.Helpers;
using KoeBook.Core.Models;

namespace KoeBook.Core.Services;
Expand All @@ -14,6 +15,7 @@ public partial class ClaudeAnalyzerService(IClaudeService claudeService, IDispla

public async ValueTask<BookScripts> LlmAnalyzeScriptLinesAsync(BookProperties bookProperties, List<ScriptLine> scriptLines, CancellationToken cancellationToken)
{
var progress = _displayStateChangeService.ResetProgress(bookProperties, GenerationState.Analyzing, 2);
var lineNumberingText = LineNumbering(scriptLines);
if (_claudeService.Messages is null)
{
Expand All @@ -34,6 +36,7 @@ public async ValueTask<BookScripts> LlmAnalyzeScriptLinesAsync(BookProperties bo
cancellationToken: cancellationToken
);
(var characterList, var characterIdNameDic) = ExtractCharacterList(message1.ToString(), scriptLines);
progress.IncrementProgress();

var message2 = await _claudeService.Messages.CreateAsync(new()
{
Expand All @@ -47,8 +50,8 @@ public async ValueTask<BookScripts> LlmAnalyzeScriptLinesAsync(BookProperties bo
},
cancellationToken: cancellationToken
);

var characterVoiceMapping = ExtractCharacterVoiceMapping(message2.ToString(), characterIdNameDic);
progress.Finish();

return new(bookProperties, new(characterVoiceMapping)) { ScriptLines = scriptLines };
}
Expand Down

0 comments on commit 98f50b4

Please sign in to comment.