Skip to content

Commit 285410a

Browse files
committed
Adjust commands for now combined persona/voice
1 parent a2737aa commit 285410a

File tree

5 files changed

+6
-43
lines changed

5 files changed

+6
-43
lines changed

src/main/kotlin/com/embabel/guide/chat/model/CommandRequest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ data class CommandRequest(
44
val correlationId: String,
55
val type: String,
66
val value: String,
7-
val clearPrevious: Boolean = false,
87
)
98

109
data class CommandResponse(

src/main/kotlin/com/embabel/guide/command/CommandExecutor.kt

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.util.concurrent.TimeoutException
1313

1414
/**
1515
* Handles frontend websocket round-trips for commands that need the browser to execute
16-
* (voice changes, audio effects, etc.).
16+
* (e.g. persona changes).
1717
*/
1818
@Service
1919
class CommandExecutor(
@@ -24,31 +24,12 @@ class CommandExecutor(
2424

2525
private val pendingCommands = ConcurrentHashMap<String, CompletableFuture<CommandResponse>>()
2626

27-
fun executePersonaChange(persona: String, webUserId: String?): String {
27+
fun executePersonaChange(personaId: String, webUserId: String?): String {
2828
if (webUserId == null) return "Persona change is only available for web users."
2929
return sendAndWait(webUserId, CommandRequest(
3030
correlationId = UUID.randomUUID().toString(),
3131
type = "change_persona",
32-
value = persona,
33-
))
34-
}
35-
36-
fun executeVoiceChange(voice: String, webUserId: String?): String {
37-
if (webUserId == null) return "Voice change is only available for web users."
38-
return sendAndWait(webUserId, CommandRequest(
39-
correlationId = UUID.randomUUID().toString(),
40-
type = "change_voice",
41-
value = voice,
42-
))
43-
}
44-
45-
fun executeEffects(effects: String, clearPrevious: Boolean, webUserId: String?): String {
46-
if (webUserId == null) return "Audio effects are only available for web users."
47-
return sendAndWait(webUserId, CommandRequest(
48-
correlationId = UUID.randomUUID().toString(),
49-
type = "apply_effects",
50-
value = effects,
51-
clearPrevious = clearPrevious,
32+
value = personaId,
5233
))
5334
}
5435

src/main/kotlin/com/embabel/guide/command/CommandTools.kt

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,6 @@ class CommandTools(
2626
val match = personas.find { it.name.equals(name, ignoreCase = true) }
2727
?: return "Unknown persona '$name'. Available personas: ${personas.joinToString { it.name }}"
2828

29-
return commandExecutor.executePersonaChange(match.name, webUserId)
30-
}
31-
32-
@Tool(description = "Change the user's text-to-speech voice. Use this when the user wants a different voice for narration.")
33-
fun changeVoice(
34-
@ToolParam(description = "Name of the voice to use") voice: String,
35-
): String {
36-
return commandExecutor.executeVoiceChange(voice, webUserId)
37-
}
38-
39-
@Tool(description = "Apply audio effects to the user's narration. Use this when the user wants to add or change audio effects like echo, reverb, etc.")
40-
fun applyEffects(
41-
@ToolParam(description = "Comma-separated list of effects to apply") effects: String,
42-
@ToolParam(description = "Whether to clear all previous effects before applying new ones") clearPrevious: Boolean,
43-
): String {
44-
return commandExecutor.executeEffects(effects, clearPrevious, webUserId)
29+
return commandExecutor.executePersonaChange(match.id, webUserId)
4530
}
4631
}

src/main/resources/prompts/classifier.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Examples: "thanks!", "nice", "hello", "haha", "goodbye"
1313

1414
category = COMMAND:
1515
The message is asking to change a setting or control the experience.
16-
This includes changing persona/character, voice, or audio effects.
16+
This includes changing persona/character.
1717
Available personas:
1818
{{ personaList }}
19-
Examples: "switch to shakespeare", "give me something old fashioned", "change my voice to jupiter", "add echo effect"
19+
Examples: "switch to shakespeare", "give me something old fashioned"
2020

2121
category = INFORMATIONAL:
2222
The message needs information lookup, code generation, or the assistant to DO something substantive.

src/main/resources/prompts/command_executor.jinja

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ pick the best match from the list above based on the descriptions.
1010

1111
Execute the appropriate commands using the available tools:
1212
- changePersona: to switch the user's persona/character
13-
- changeVoice: to change the text-to-speech voice
14-
- applyEffects: to add or change audio effects
1513

1614
Call the relevant tools now. After you receive the tool results, compose your response:
1715

0 commit comments

Comments
 (0)