Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class QwenTtsRealtimeConfig {
/** instructions for tts, default is null */
@Builder.Default String instructions = null;

/** instructions will optimize on server side, default is null */
@Builder.Default String optimizeInstructions = null;
/** instructions will optimize on server side, default is false */
@Builder.Default boolean optimizeInstructions = false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other optional boolean parameters in this class, like enableTn (line 48), consider using the Boolean wrapper type instead of the primitive boolean. This allows for a null state, making the parameter handling more uniform throughout the class and aligning with the pattern used for enableTn.

Suggested change
@Builder.Default boolean optimizeInstructions = false;
@Builder.Default Boolean optimizeInstructions = false;


/** The extra parameters. */
@Builder.Default Map<String, Object> parameters = null;
Expand Down Expand Up @@ -94,8 +94,8 @@ public JsonObject getConfig() {
config.put(QwenTtsRealtimeConstants.INSTRUCTIONS, instructions);
}

if (optimizeInstructions != null) {
config.put(QwenTtsRealtimeConstants.OPTIMIZE_INSTRUCTIONS, optimizeInstructions);
if (optimizeInstructions) {
config.put(QwenTtsRealtimeConstants.OPTIMIZE_INSTRUCTIONS, true);
}
Comment on lines +97 to 99

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To align with the suggested change of optimizeInstructions to the Boolean wrapper type, this logic should be updated to check for null. This ensures that the parameter is added to the configuration map only when it has been explicitly set (to either true or false), which is consistent with how other optional parameters like enableTn are handled on lines 89-91.

Suggested change
if (optimizeInstructions) {
config.put(QwenTtsRealtimeConstants.OPTIMIZE_INSTRUCTIONS, true);
}
if (optimizeInstructions != null) {
config.put(QwenTtsRealtimeConstants.OPTIMIZE_INSTRUCTIONS, optimizeInstructions);
}


if (parameters != null) {
Expand Down
Loading