fix: source kind for file processing (#601)

This commit is contained in:
2025-09-04 13:00:14 +02:00
committed by Mathieu Virbel
parent 457823e1c1
commit dc82f8bb3b
5 changed files with 55 additions and 16 deletions

View File

@@ -96,6 +96,7 @@ class CreateTranscript(BaseModel):
name: str
source_language: str = Field("en")
target_language: str = Field("en")
source_kind: SourceKind | None = None
class UpdateTranscript(BaseModel):
@@ -213,7 +214,7 @@ async def transcripts_create(
user_id = user["sub"] if user else None
return await transcripts_controller.add(
info.name,
source_kind=SourceKind.LIVE,
source_kind=info.source_kind or SourceKind.LIVE,
source_language=info.source_language,
target_language=info.target_language,
user_id=user_id,

View File

@@ -34,7 +34,7 @@ async def transcript_process(
)
if task_is_scheduled_or_active(
"reflector.pipelines.main_live_pipeline.task_pipeline_process",
"reflector.pipelines.main_file_pipeline.task_pipeline_file_process",
transcript_id=transcript_id,
):
return ProcessStatus(status="already running")

View File

@@ -7,6 +7,7 @@ import About from "../../../(aboutAndPrivacy)/about";
import Privacy from "../../../(aboutAndPrivacy)/privacy";
import { useRouter } from "next/navigation";
import useCreateTranscript from "../createTranscript";
import { SourceKind } from "../../../api";
import SelectSearch from "react-select-search";
import { supportedLanguages } from "../../../supportedLanguages";
import useSessionStatus from "../../../lib/useSessionStatus";
@@ -61,13 +62,21 @@ const TranscriptCreate = () => {
const send = () => {
if (loadingRecord || createTranscript.loading || permissionDenied) return;
setLoadingRecord(true);
createTranscript.create({ name, target_language: getTargetLanguage() });
createTranscript.create({
name,
target_language: getTargetLanguage(),
source_kind: "live" as SourceKind,
});
};
const uploadFile = () => {
if (loadingUpload || createTranscript.loading || permissionDenied) return;
setLoadingUpload(true);
createTranscript.create({ name, target_language: getTargetLanguage() });
createTranscript.create({
name,
target_language: getTargetLanguage(),
source_kind: "file" as SourceKind,
});
};
useEffect(() => {

View File

@@ -133,6 +133,16 @@ export const $CreateTranscript = {
title: "Target Language",
default: "en",
},
source_kind: {
anyOf: [
{
$ref: "#/components/schemas/SourceKind",
},
{
type: "null",
},
],
},
},
type: "object",
required: ["name"],
@@ -1031,11 +1041,25 @@ export const $RoomDetails = {
title: "Is Shared",
},
webhook_url: {
type: "string",
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Webhook Url",
},
webhook_secret: {
type: "string",
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Webhook Secret",
},
},
@@ -1091,10 +1115,17 @@ export const $SearchResponse = {
description: "Total number of search results",
},
query: {
type: "string",
minLength: 0,
anyOf: [
{
type: "string",
minLength: 1,
description: "Search query text",
},
{
type: "null",
},
],
title: "Query",
description: "Search query text",
},
limit: {
type: "integer",
@@ -1111,7 +1142,7 @@ export const $SearchResponse = {
},
},
type: "object",
required: ["results", "total", "query", "limit", "offset"],
required: ["results", "total", "limit", "offset"],
title: "SearchResponse",
} as const;

View File

@@ -32,6 +32,7 @@ export type CreateTranscript = {
name: string;
source_language?: string;
target_language?: string;
source_kind?: SourceKind | null;
};
export type DeletionStatus = {
@@ -191,8 +192,8 @@ export type RoomDetails = {
recording_type: string;
recording_trigger: string;
is_shared: boolean;
webhook_url: string;
webhook_secret: string;
webhook_url: string | null;
webhook_secret: string | null;
};
export type RtcOffer = {
@@ -206,10 +207,7 @@ export type SearchResponse = {
* Total number of search results
*/
total: number;
/**
* Search query text
*/
query: string;
query?: string | null;
/**
* Results per page
*/