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
10 changes: 10 additions & 0 deletions dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def update_session(
bit_rate: int = None,
language_type: str = None,
enable_tn: bool = None,
instructions: str = None,
optimize_instructions: str = None,
**kwargs,
) -> None:
"""
Expand Down Expand Up @@ -206,6 +208,10 @@ def update_session(
bit_rate for tts, support 6~510,default is 128kbps. only work on format: opus/mp3 # noqa: E501 # pylint: disable=line-too-long
enable_tn: bool
enable text normalization for tts, default is None
instructions: str
instructions for tts, default is None
optimize_instructions: str
optimize_instructions for tts, default is None
"""
self.config = {
"voice": voice,
Expand All @@ -230,6 +236,10 @@ def update_session(

if language_type is not None:
self.config["language_type"] = language_type
if instructions is not None:
self.config['instructions'] = instructions
if optimize_instructions is not None:
self.config['optimize_instructions'] = optimize_instructions
Comment on lines +239 to +242

Choose a reason for hiding this comment

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

medium

For consistency with the surrounding code, please use double quotes for dictionary keys instead of single quotes. The rest of the file uses double quotes for dictionary keys (e.g., line 238), and maintaining a consistent style improves readability. PEP 8 advises picking a quote style and sticking to it.

Suggested change
if instructions is not None:
self.config['instructions'] = instructions
if optimize_instructions is not None:
self.config['optimize_instructions'] = optimize_instructions
if instructions is not None:
self.config["instructions"] = instructions
if optimize_instructions is not None:
self.config["optimize_instructions"] = optimize_instructions

self.config.update(kwargs)
self.__send_str(
json.dumps(
Expand Down
Loading