Add TTS and ASR speech functionality from cursor/fixing-code-issues-5…#2
Add TTS and ASR speech functionality from cursor/fixing-code-issues-5…#2AnshumanAI wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Bugbot free trial expires on August 10, 2025
Learn more in the Cursor dashboard.
| "Authorization" -> s"Bearer ${config.apiKey}", | ||
| "Content-Type" -> "application/json" | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Bug: Incorrect API Request Format and Type Mismatch
The OpenAI transcription API expects multipart/form-data with a binary audio file, but the current implementation sends application/json with base64-encoded audio in a "file" field, causing API requests to fail (e.g., 400 Bad Request). Additionally, the requestBody for the transcription API call is incorrectly constructed as a mutable.Map instead of a ujson.Obj before attempting to call .render(), resulting in a type mismatch.
| def getTTSClient(provider: SpeechProvider, config: SpeechProviderConfig): TTSClient = | ||
| provider match { | ||
| case SpeechProvider.OpenAI => | ||
| new OpenAISpeechClient(config.asInstanceOf[OpenAISpeechConfig]) |
There was a problem hiding this comment.
Bug: Type Safety Violation in Speech Client Retrieval
Unsafe type casting using asInstanceOf without validation in getTTSClient and getASRClient methods. If an incorrect SpeechProviderConfig type is passed for a given SpeechProvider, it will result in a ClassCastException at runtime instead of being caught at compile time.
Locations (2)
Co-authored-by: mcs23026 <mcs23026@iiitl.ac.in>
Co-authored-by: mcs23026 <mcs23026@iiitl.ac.in>
No description provided.