Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dashscope/audio/qwen_omni/omni_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _get_websocket_header(self):
)
headers = {
"user-agent": ua,
"Authorization": "bearer " + self.apikey,
"Authorization": "Bearer " + self.apikey,
}
if self.user_headers:
headers = {**self.user_headers, **headers}
Expand Down
12 changes: 11 additions & 1 deletion dashscope/audio/qwen_tts_realtime/qwen_tts_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _get_websocket_header(self):
)
headers = {
"user-agent": ua,
"Authorization": "bearer " + self.apikey,
"Authorization": "Bearer " + self.apikey,
}
if self.user_headers:
headers = {**self.user_headers, **headers}
Expand Down 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: bool = 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: bool
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
self.config.update(kwargs)
self.__send_str(
json.dumps(
Expand Down
2 changes: 1 addition & 1 deletion dashscope/audio/tts_v2/speech_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def getWebsocketHeaders(self, headers, workspace):
)
self.headers = {
"user-agent": ua,
"Authorization": "bearer " + self.apikey,
"Authorization": "Bearer " + self.apikey,
}
if headers:
self.headers = {**self.headers, **headers}
Expand Down
6 changes: 4 additions & 2 deletions dashscope/multimodal/multimodal_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,12 @@ def get_websocket_header(self, api_key):
)
self.ws_headers = {
"User-Agent": ua,
"Authorization": f"bearer {api_key}",
"Authorization": f"Bearer {api_key}",
"Accept": "application/json",
}
logger.info("websocket header: %s", self.ws_headers)
log_headers = self.ws_headers.copy()
log_headers["Authorization"] = "REDACTED"
logger.info("websocket header: %s", log_headers)
return self.ws_headers

def generate_start_request(
Expand Down
6 changes: 4 additions & 2 deletions dashscope/multimodal/tingwu/tingwu_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,12 @@ def get_websocket_header(self, api_key):
)
self.ws_headers = {
"User-Agent": ua,
"Authorization": f"bearer {api_key}",
"Authorization": f"Bearer {api_key}",
"Accept": "application/json",
}
logger.info("websocket header: %s", self.ws_headers)
log_headers = self.ws_headers.copy()
log_headers["Authorization"] = "REDACTED"
logger.info("websocket header: %s", log_headers)
return self.ws_headers

def generate_start_request(
Expand Down