www: update frontend to support new transcript format in topics

This commit is contained in:
2023-10-19 21:05:49 +02:00
committed by Mathieu Virbel
parent b323254376
commit 6d074ed457
7 changed files with 258 additions and 6 deletions

View File

@@ -103,7 +103,17 @@ export function TopicList({
/>
</div>
{activeTopic?.id == topic.id && (
<div className="p-2">{topic.transcript}</div>
<div className="p-2">
{topic.segments.map((segment, index) => (
<p
key={index}
className="text-left text-slate-500 text-sm md:text-base"
>
[{formatTime(segment.timestamp)}] Speaker{" "}
{segment.speaker}: {segment.text}
</p>
))}
</div>
)}
</button>
))}

View File

@@ -1,9 +1,15 @@
export type SegmentTopic = {
speaker: number;
start: number;
text: string;
};
export type Topic = {
timestamp: number;
title: string;
transcript: string;
summary: string;
id: string;
segments: SegmentTopic[];
};
export type Transcript = {

View File

@@ -8,6 +8,7 @@ models/GetTranscript.ts
models/HTTPValidationError.ts
models/PageGetTranscript.ts
models/RtcOffer.ts
models/TranscriptSegmentTopic.ts
models/TranscriptTopic.ts
models/UpdateTranscript.ts
models/UserInfo.ts

View File

@@ -0,0 +1,88 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from "../runtime";
/**
*
* @export
* @interface TranscriptSegmentTopic
*/
export interface TranscriptSegmentTopic {
/**
*
* @type {any}
* @memberof TranscriptSegmentTopic
*/
speaker: any | null;
/**
*
* @type {any}
* @memberof TranscriptSegmentTopic
*/
text: any | null;
/**
*
* @type {any}
* @memberof TranscriptSegmentTopic
*/
timestamp: any | null;
}
/**
* Check if a given object implements the TranscriptSegmentTopic interface.
*/
export function instanceOfTranscriptSegmentTopic(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "speaker" in value;
isInstance = isInstance && "text" in value;
isInstance = isInstance && "timestamp" in value;
return isInstance;
}
export function TranscriptSegmentTopicFromJSON(
json: any,
): TranscriptSegmentTopic {
return TranscriptSegmentTopicFromJSONTyped(json, false);
}
export function TranscriptSegmentTopicFromJSONTyped(
json: any,
ignoreDiscriminator: boolean,
): TranscriptSegmentTopic {
if (json === undefined || json === null) {
return json;
}
return {
speaker: json["speaker"],
text: json["text"],
timestamp: json["timestamp"],
};
}
export function TranscriptSegmentTopicToJSON(
value?: TranscriptSegmentTopic | null,
): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
speaker: value.speaker,
text: value.text,
timestamp: value.timestamp,
};
}

View File

@@ -42,13 +42,13 @@ export interface TranscriptTopic {
* @type {any}
* @memberof TranscriptTopic
*/
transcript?: any | null;
timestamp: any | null;
/**
*
* @type {any}
* @memberof TranscriptTopic
*/
timestamp: any | null;
segments?: any | null;
}
/**
@@ -78,8 +78,8 @@ export function TranscriptTopicFromJSONTyped(
id: !exists(json, "id") ? undefined : json["id"],
title: json["title"],
summary: json["summary"],
transcript: !exists(json, "transcript") ? undefined : json["transcript"],
timestamp: json["timestamp"],
segments: !exists(json, "segments") ? undefined : json["segments"],
};
}
@@ -94,7 +94,7 @@ export function TranscriptTopicToJSON(value?: TranscriptTopic | null): any {
id: value.id,
title: value.title,
summary: value.summary,
transcript: value.transcript,
timestamp: value.timestamp,
segments: value.segments,
};
}

View File

@@ -7,6 +7,7 @@ export * from "./GetTranscript";
export * from "./HTTPValidationError";
export * from "./PageGetTranscript";
export * from "./RtcOffer";
export * from "./TranscriptSegmentTopic";
export * from "./TranscriptTopic";
export * from "./UpdateTranscript";
export * from "./UserInfo";