-
Notifications
You must be signed in to change notification settings - Fork 17
feat(model/qwen3-tts-realtime):support instruct param, update audio w… #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s connection auth config bear -> Bear
Summary of ChangesHello @songguocola, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Qwen TTS realtime model by introducing new parameters that allow for more precise control over text-to-speech generation. Concurrently, it refines the handling of authentication headers across various modules, ensuring that the 'Bearer' scheme is consistently capitalized. These changes improve both the functionality and the robustness of the API interactions. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request standardizes the WebSocket Authorization header value to use the capitalized Bearer scheme across several audio and multimodal modules and adds support for instructions and optimize_instructions parameters to the qwen-tts-realtime model. However, a high-severity vulnerability was identified: the entire WebSocket header dictionary, which contains sensitive API keys, is logged at the INFO level in multimodal_dialog.py and tingwu_realtime.py. This exposes credentials in application logs and requires immediate remediation by redacting the Authorization header before logging. Additionally, I've suggested improving the docstrings for the new parameters to make them more descriptive.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The api_key is included in the self.ws_headers dictionary, which is subsequently logged at the INFO level on line 451. This leads to the exposure of sensitive API keys in application logs. It is highly recommended to redact sensitive information before logging or to avoid logging the entire headers dictionary at the INFO level.
| 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) | |
| self.ws_headers = { | |
| "User-Agent": ua, | |
| "Authorization": f"Bearer {api_key}", | |
| "Accept": "application/json", | |
| } | |
| log_headers = self.ws_headers.copy() | |
| log_headers["Authorization"] = "REDACTED" | |
| logger.info("websocket header: %s", log_headers) |
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The api_key is included in the self.ws_headers dictionary, which is subsequently logged at the INFO level on line 351. This leads to the exposure of sensitive API keys in application logs. It is highly recommended to redact sensitive information before logging or to avoid logging the entire headers dictionary at the INFO level.
| 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) | |
| self.ws_headers = { | |
| "User-Agent": ua, | |
| "Authorization": f"Bearer {api_key}", | |
| "Accept": "application/json", | |
| } | |
| log_headers = self.ws_headers.copy() | |
| log_headers["Authorization"] = "REDACTED" | |
| logger.info("websocket header: %s", log_headers) |
| instructions: str | ||
| instructions for tts, default is None | ||
| optimize_instructions: bool | ||
| optimize_instructions for tts, default is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstrings for the new parameters instructions and optimize_instructions are a bit brief. To improve clarity for future users and maintainers, could you please expand on what these parameters do? For example:
- For
instructions: What kind of instructions are expected? Do they control tone, emotion, or style? An example would be very helpful. - For
optimize_instructions: What does enabling this option do? Does it modify the instructions for better performance or quality? A brief explanation of the optimization process would be valuable.
No description provided.