Skip to content

Conversation

@smian1
Copy link
Collaborator

@smian1 smian1 commented Dec 31, 2025

Summary

  • Fixes missing speaker_name field in developer API responses
  • The field was being added by _add_speaker_names_to_segments() but stripped by Pydantic because it wasn't in the model

Problem

PR #3962 added speaker_name to transcript segments, but the field only appeared in webhooks, not in the developer API (/v1/dev/user/conversations). This was because SimpleTranscriptSegment Pydantic model didn't include the field.

Fix

Added speaker_name: Optional[str] = None to SimpleTranscriptSegment model.

The speaker_name field was being added by _add_speaker_names_to_segments()
but was stripped from the API response because it wasn't defined in the
Pydantic model. This fixes BasedHardware#3962 where webhook showed speaker_name but
the developer API did not.
Copilot AI review requested due to automatic review settings December 31, 2025 04:30
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 correctly fixes a bug where the speaker_name field was missing from the developer API response for transcript segments. The change adds the missing field to the SimpleTranscriptSegment Pydantic model, which is the right solution. The suggestion to make the API contract even more precise by defining the new field as non-optional, since the backend logic ensures it's always provided, is valid and kept.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the speaker_name field was being stripped from developer API responses despite being populated by the backend. The issue occurred because the Pydantic SimpleTranscriptSegment model didn't include the field that was being added dynamically.

  • Added speaker_name: Optional[str] = None to the SimpleTranscriptSegment response model
  • Ensures speaker names appear in developer API responses (/v1/dev/user/conversations), matching webhook behavior
  • Fixes the Pydantic validation issue where dynamically added fields were being filtered out

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@smian1 smian1 requested a review from mdmohsin7 December 31, 2025 04:41
@mdmohsin7 mdmohsin7 merged commit 2c6ea20 into BasedHardware:main Dec 31, 2025
6 checks passed
@smian1 smian1 deleted the fix/speaker-name-response-model branch January 2, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants