Skip to content

Conversation

@iceljc
Copy link
Collaborator

@iceljc iceljc commented Sep 26, 2025

PR Type

Enhancement


Description

  • Add realtime audio format configuration options

  • Configure PCM16 format for input and output audio


Diagram Walkthrough

flowchart LR
  A["WebSocket Connection"] --> B["Start Event Payload"]
  B --> C["Conversation States"]
  B --> D["Realtime Options"]
  D --> E["PCM16 Audio Format"]
Loading

File Walkthrough

Relevant files
Enhancement
realtime-chat-service.js
Add realtime audio format configuration                                   

src/lib/services/realtime-chat-service.js

  • Add realtime_options object to WebSocket start event payload
  • Configure input_audio_format and output_audio_format as "pcm16"
+5/-1     

@qodo-merge-pro
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Payload schema compatibility

Verify the server expects realtime_options nested inside the JSON-stringified payload and that input_audio_format/output_audio_format values "pcm16" match allowed enumerations and casing.

states: buildConversationUserStates(conversationId),
realtime_options: {
    input_audio_format: "pcm16",
    output_audio_format: "pcm16"
}
States build timing

Check that buildConversationUserStates(conversationId) is safe to call at socket open and that conversationId is defined; otherwise the start message may include invalid or empty states.

states: buildConversationUserStates(conversationId),
realtime_options: {

@iceljc iceljc merged commit 092cab0 into SciSharp:main Sep 26, 2025
1 of 2 checks passed
@qodo-merge-pro
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Avoid unnecessary double JSON stringification

Remove the inner JSON.stringify call for the payload object to avoid
double-stringifying the data before sending it through the WebSocket.

src/lib/services/realtime-chat-service.js [48-54]

-payload: JSON.stringify({
+payload: {
     states: buildConversationUserStates(conversationId),
     realtime_options: {
         input_audio_format: "pcm16",
         output_audio_format: "pcm16"
     }
-})
+}
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the payload is being double-stringified, which is a common serialization error and would likely cause issues on the server side.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant