mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-04-25 22:55:18 +00:00
fix: live flow real-time updates during processing (#861)
* fix: live flow real-time updates during processing Three gaps caused transcript pages to require manual refresh after live recording/processing: 1. UserEventsProvider only invalidated list queries on TRANSCRIPT_STATUS, not individual transcript queries. Now parses data.id from the event and calls invalidateTranscript for the specific transcript. 2. useWebSockets had no reconnection logic — a dropped WS silently killed all real-time updates. Added exponential backoff reconnection (1s-30s, max 10 retries) with intentional close detection. 3. No polling fallback — WS was single point of failure. Added conditional refetchInterval to useTranscriptGet that polls every 5s when transcript status is processing/uploaded/recording. * feat: type-safe WebSocket events via OpenAPI stub Define Pydantic models with Literal discriminators for all WS events (9 transcript-level, 5 user-level). Expose via stub GET endpoints so pnpm openapi generates TS discriminated unions with exhaustive switch narrowing on the frontend. - New server/reflector/ws_events.py with TranscriptWsEvent and UserWsEvent - Tighten backend emit signatures with TranscriptEventName literal - Frontend uses generated types, removes Zod schema and manual casts - Fix pre-existing bugs: waveform mapping, FINAL_LONG_SUMMARY field name - STATUS value now typed as TranscriptStatus literal end-to-end - TOPIC handler simplified to query invalidation only (avoids shape mismatch) * fix: restore TOPIC WS handler with immediate state update The setTopics call provides instant topic rendering during live transcription. Query invalidation still follows for full data sync. * fix: align TOPIC WS event data with GetTranscriptTopic shape Convert TranscriptTopic → GetTranscriptTopic in pipeline before emitting, so WS sends segments instead of words. Removes the `as unknown as Topic` cast on the frontend. * fix: use NonEmptyString and TranscriptStatus in user WS event models --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
271
www/app/reflector-api.d.ts
vendored
271
www/app/reflector-api.d.ts
vendored
@@ -568,7 +568,10 @@ export interface paths {
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/** Transcript Get Websocket Events */
|
||||
/**
|
||||
* Transcript WebSocket event schema
|
||||
* @description Stub exposing the discriminated union of all transcript-level WS events for OpenAPI type generation. Real events are delivered over the WebSocket at the same path.
|
||||
*/
|
||||
get: operations["v1_transcript_get_websocket_events"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
@@ -664,6 +667,26 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/v1/events": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* User WebSocket event schema
|
||||
* @description Stub exposing the discriminated union of all user-level WS events for OpenAPI type generation. Real events are delivered over the WebSocket at the same path.
|
||||
*/
|
||||
get: operations["v1_user_get_websocket_events"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/v1/zulip/streams": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -1877,6 +1900,33 @@ export interface components {
|
||||
/** Name */
|
||||
name: string;
|
||||
};
|
||||
/** TranscriptActionItems */
|
||||
TranscriptActionItems: {
|
||||
/** Action Items */
|
||||
action_items: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
/** TranscriptDuration */
|
||||
TranscriptDuration: {
|
||||
/** Duration */
|
||||
duration: number;
|
||||
};
|
||||
/** TranscriptFinalLongSummary */
|
||||
TranscriptFinalLongSummary: {
|
||||
/** Long Summary */
|
||||
long_summary: string;
|
||||
};
|
||||
/** TranscriptFinalShortSummary */
|
||||
TranscriptFinalShortSummary: {
|
||||
/** Short Summary */
|
||||
short_summary: string;
|
||||
};
|
||||
/** TranscriptFinalTitle */
|
||||
TranscriptFinalTitle: {
|
||||
/** Title */
|
||||
title: string;
|
||||
};
|
||||
/** TranscriptParticipant */
|
||||
TranscriptParticipant: {
|
||||
/** Id */
|
||||
@@ -1917,6 +1967,113 @@ export interface components {
|
||||
/** End */
|
||||
end: number;
|
||||
};
|
||||
/** TranscriptText */
|
||||
TranscriptText: {
|
||||
/** Text */
|
||||
text: string;
|
||||
/** Translation */
|
||||
translation: string | null;
|
||||
};
|
||||
/** TranscriptWaveform */
|
||||
TranscriptWaveform: {
|
||||
/** Waveform */
|
||||
waveform: number[];
|
||||
};
|
||||
/** TranscriptWsActionItems */
|
||||
TranscriptWsActionItems: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "ACTION_ITEMS";
|
||||
data: components["schemas"]["TranscriptActionItems"];
|
||||
};
|
||||
/** TranscriptWsDuration */
|
||||
TranscriptWsDuration: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "DURATION";
|
||||
data: components["schemas"]["TranscriptDuration"];
|
||||
};
|
||||
/** TranscriptWsFinalLongSummary */
|
||||
TranscriptWsFinalLongSummary: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "FINAL_LONG_SUMMARY";
|
||||
data: components["schemas"]["TranscriptFinalLongSummary"];
|
||||
};
|
||||
/** TranscriptWsFinalShortSummary */
|
||||
TranscriptWsFinalShortSummary: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "FINAL_SHORT_SUMMARY";
|
||||
data: components["schemas"]["TranscriptFinalShortSummary"];
|
||||
};
|
||||
/** TranscriptWsFinalTitle */
|
||||
TranscriptWsFinalTitle: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "FINAL_TITLE";
|
||||
data: components["schemas"]["TranscriptFinalTitle"];
|
||||
};
|
||||
/** TranscriptWsStatus */
|
||||
TranscriptWsStatus: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "STATUS";
|
||||
data: components["schemas"]["TranscriptWsStatusData"];
|
||||
};
|
||||
/** TranscriptWsStatusData */
|
||||
TranscriptWsStatusData: {
|
||||
/**
|
||||
* Value
|
||||
* @enum {string}
|
||||
*/
|
||||
value:
|
||||
| "idle"
|
||||
| "uploaded"
|
||||
| "recording"
|
||||
| "processing"
|
||||
| "error"
|
||||
| "ended";
|
||||
};
|
||||
/** TranscriptWsTopic */
|
||||
TranscriptWsTopic: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TOPIC";
|
||||
data: components["schemas"]["GetTranscriptTopic"];
|
||||
};
|
||||
/** TranscriptWsTranscript */
|
||||
TranscriptWsTranscript: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT";
|
||||
data: components["schemas"]["TranscriptText"];
|
||||
};
|
||||
/** TranscriptWsWaveform */
|
||||
TranscriptWsWaveform: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "WAVEFORM";
|
||||
data: components["schemas"]["TranscriptWaveform"];
|
||||
};
|
||||
/** UpdateParticipant */
|
||||
UpdateParticipant: {
|
||||
/** Speaker */
|
||||
@@ -1987,6 +2144,82 @@ export interface components {
|
||||
/** Email */
|
||||
email: string | null;
|
||||
};
|
||||
/** UserTranscriptCreatedData */
|
||||
UserTranscriptCreatedData: {
|
||||
/** Id */
|
||||
id: string;
|
||||
};
|
||||
/** UserTranscriptDeletedData */
|
||||
UserTranscriptDeletedData: {
|
||||
/** Id */
|
||||
id: string;
|
||||
};
|
||||
/** UserTranscriptDurationData */
|
||||
UserTranscriptDurationData: {
|
||||
/** Id */
|
||||
id: string;
|
||||
/** Duration */
|
||||
duration: number;
|
||||
};
|
||||
/** UserTranscriptFinalTitleData */
|
||||
UserTranscriptFinalTitleData: {
|
||||
/** Id */
|
||||
id: string;
|
||||
/** Title */
|
||||
title: string;
|
||||
};
|
||||
/** UserTranscriptStatusData */
|
||||
UserTranscriptStatusData: {
|
||||
/** Id */
|
||||
id: string;
|
||||
/** Value */
|
||||
value: string;
|
||||
};
|
||||
/** UserWsTranscriptCreated */
|
||||
UserWsTranscriptCreated: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT_CREATED";
|
||||
data: components["schemas"]["UserTranscriptCreatedData"];
|
||||
};
|
||||
/** UserWsTranscriptDeleted */
|
||||
UserWsTranscriptDeleted: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT_DELETED";
|
||||
data: components["schemas"]["UserTranscriptDeletedData"];
|
||||
};
|
||||
/** UserWsTranscriptDuration */
|
||||
UserWsTranscriptDuration: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT_DURATION";
|
||||
data: components["schemas"]["UserTranscriptDurationData"];
|
||||
};
|
||||
/** UserWsTranscriptFinalTitle */
|
||||
UserWsTranscriptFinalTitle: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT_FINAL_TITLE";
|
||||
data: components["schemas"]["UserTranscriptFinalTitleData"];
|
||||
};
|
||||
/** UserWsTranscriptStatus */
|
||||
UserWsTranscriptStatus: {
|
||||
/**
|
||||
* @description discriminator enum property added by openapi-typescript
|
||||
* @enum {string}
|
||||
*/
|
||||
event: "TRANSCRIPT_STATUS";
|
||||
data: components["schemas"]["UserTranscriptStatusData"];
|
||||
};
|
||||
/** ValidationError */
|
||||
ValidationError: {
|
||||
/** Location */
|
||||
@@ -3423,7 +3656,16 @@ export interface operations {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": unknown;
|
||||
"application/json":
|
||||
| components["schemas"]["TranscriptWsTranscript"]
|
||||
| components["schemas"]["TranscriptWsTopic"]
|
||||
| components["schemas"]["TranscriptWsStatus"]
|
||||
| components["schemas"]["TranscriptWsFinalTitle"]
|
||||
| components["schemas"]["TranscriptWsFinalLongSummary"]
|
||||
| components["schemas"]["TranscriptWsFinalShortSummary"]
|
||||
| components["schemas"]["TranscriptWsActionItems"]
|
||||
| components["schemas"]["TranscriptWsDuration"]
|
||||
| components["schemas"]["TranscriptWsWaveform"];
|
||||
};
|
||||
};
|
||||
/** @description Validation Error */
|
||||
@@ -3607,6 +3849,31 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
v1_user_get_websocket_events: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description Successful Response */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json":
|
||||
| components["schemas"]["UserWsTranscriptCreated"]
|
||||
| components["schemas"]["UserWsTranscriptDeleted"]
|
||||
| components["schemas"]["UserWsTranscriptStatus"]
|
||||
| components["schemas"]["UserWsTranscriptFinalTitle"]
|
||||
| components["schemas"]["UserWsTranscriptDuration"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
v1_zulip_get_streams: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
|
||||
Reference in New Issue
Block a user