Skip to content

Commit d055636

Browse files
committed
feat: 요청에서 tts 사용 여부 결정
1 parent d07f011 commit d055636

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

ProjectVG.Api/Models/Chat/Request/ChatRequest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public class ChatRequest
2626
[JsonPropertyName("instruction")]
2727
public string? Instruction { get; set; }
2828

29+
[JsonPropertyName("use_tts")]
30+
public bool UseTTS { get; set; } = true;
31+
2932
public ProcessChatCommand ToProcessChatCommand()
3033
{
3134
return new ProcessChatCommand
@@ -36,7 +39,8 @@ public ProcessChatCommand ToProcessChatCommand()
3639
RequestedAt = this.RequestedAt,
3740
Action = this.Action,
3841
Instruction = this.Instruction,
39-
UserId = this.UserId
42+
UserId = this.UserId,
43+
UseTTS = this.UseTTS
4044
};
4145
}
4246
}

ProjectVG.Application/Models/Chat/ChatProcessContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class ChatProcessContext
1010
public Guid CharacterId { get; private set; }
1111
public string UserMessage { get; private set; } = string.Empty;
1212
public string MemoryStore { get; private set; } = string.Empty;
13+
public bool UseTTS { get; private set; } = true;
1314

1415
public CharacterDto? Character { get; private set; }
1516
public IEnumerable<string>? MemoryContext { get; private set; }
@@ -31,6 +32,7 @@ public ChatProcessContext(ProcessChatCommand command)
3132
CharacterId = command.CharacterId;
3233
UserMessage = command.Message;
3334
MemoryStore = command.UserId.ToString();
35+
UseTTS = command.UseTTS;
3436
}
3537

3638
public ChatProcessContext(
@@ -44,6 +46,7 @@ public ChatProcessContext(
4446
CharacterId = command.CharacterId;
4547
UserMessage = command.Message;
4648
MemoryStore = command.UserId.ToString();
49+
UseTTS = command.UseTTS;
4750

4851
Character = character;
4952
ConversationHistory = conversationHistory;

ProjectVG.Application/Models/Chat/ProcessChatCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public string RequestId
1818
public DateTime RequestedAt { get; set; }
1919
public string? Action { get; set; }
2020
public string? Instruction { get; set; }
21-
21+
public bool UseTTS { get; set; } = true;
2222

2323
public CharacterDto? Character { get; private set; }
2424

ProjectVG.Application/Services/Chat/Processors/ChatTTSProcessor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public ChatTTSProcessor(
1919

2020
public async Task ProcessAsync(ChatProcessContext context)
2121
{
22-
if (string.IsNullOrWhiteSpace(context.Character?.VoiceId) || context.Segments?.Count == 0) {
23-
_logger.LogDebug("TTS 처리 건너뜀: 세션 {SessionId}, 음성ID {VoiceId}, 세그먼트 수 {SegmentCount}",
24-
context.SessionId, context.Character?.VoiceId, context.Segments?.Count ?? 0);
22+
if (!context.UseTTS || string.IsNullOrWhiteSpace(context.Character?.VoiceId) || context.Segments?.Count == 0) {
23+
_logger.LogDebug("TTS 처리 건너뜀: 세션 {SessionId}, TTS사용여부 {UseTTS}, 음성ID {VoiceId}, 세그먼트 수 {SegmentCount}",
24+
context.SessionId, context.UseTTS, context.Character?.VoiceId, context.Segments?.Count ?? 0);
2525
return;
2626
}
2727

0 commit comments

Comments
 (0)