mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Restart processing
This commit is contained in:
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
|
||||
import { GetTranscript } from "../../api";
|
||||
import Pagination from "./pagination";
|
||||
import NextLink from "next/link";
|
||||
import { FaGear } from "react-icons/fa6";
|
||||
import { FaArrowRotateRight, FaGear } from "react-icons/fa6";
|
||||
import { FaCheck, FaTrash, FaStar, FaMicrophone } from "react-icons/fa";
|
||||
import { MdError } from "react-icons/md";
|
||||
import useTranscriptList from "../transcripts/useTranscriptList";
|
||||
@@ -20,20 +20,10 @@ import {
|
||||
Card,
|
||||
Link,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
Stack,
|
||||
Text,
|
||||
Icon,
|
||||
Grid,
|
||||
Divider,
|
||||
Popover,
|
||||
PopoverTrigger,
|
||||
PopoverContent,
|
||||
PopoverArrow,
|
||||
PopoverCloseButton,
|
||||
PopoverHeader,
|
||||
PopoverBody,
|
||||
PopoverFooter,
|
||||
IconButton,
|
||||
Spacer,
|
||||
Menu,
|
||||
@@ -46,7 +36,6 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogBody,
|
||||
AlertDialogFooter,
|
||||
keyframes,
|
||||
Tooltip,
|
||||
} from "@chakra-ui/react";
|
||||
import { PlusSquareIcon } from "@chakra-ui/icons";
|
||||
@@ -93,12 +82,12 @@ export default function TranscriptBrowser() {
|
||||
);
|
||||
const onCloseDeletion = () => setTranscriptToDeleteId(undefined);
|
||||
|
||||
const handleDeleteTranscript = (transcriptToDeleteId) => (e) => {
|
||||
const handleDeleteTranscript = (transcriptId) => (e) => {
|
||||
e.stopPropagation();
|
||||
if (api && !deletionLoading) {
|
||||
setDeletionLoading(true);
|
||||
api
|
||||
.v1TranscriptDelete(transcriptToDeleteId)
|
||||
.v1TranscriptDelete({ transcriptId })
|
||||
.then(() => {
|
||||
refetch();
|
||||
setDeletionLoading(false);
|
||||
@@ -106,7 +95,7 @@ export default function TranscriptBrowser() {
|
||||
onCloseDeletion();
|
||||
setDeletedItemIds((deletedItemIds) => [
|
||||
deletedItemIds,
|
||||
...transcriptToDeleteId,
|
||||
...transcriptId,
|
||||
]);
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -116,6 +105,24 @@ export default function TranscriptBrowser() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleProcessTranscript = (transcriptId) => (e) => {
|
||||
if (api) {
|
||||
api
|
||||
.v1TranscriptProcess({ transcriptId })
|
||||
.then((result) => {
|
||||
const status = (result as any).status;
|
||||
if (status === "already running") {
|
||||
setError(
|
||||
new Error("Processing is already running, please wait"),
|
||||
"Processing is already running, please wait",
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
setError(err, "There was an error processing the transcript");
|
||||
});
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Flex
|
||||
maxW="container.xl"
|
||||
@@ -221,7 +228,7 @@ export default function TranscriptBrowser() {
|
||||
</Heading>
|
||||
|
||||
<Spacer />
|
||||
<Menu closeOnSelect={false}>
|
||||
<Menu closeOnSelect={true}>
|
||||
<MenuButton
|
||||
as={IconButton}
|
||||
icon={<FaEllipsisVertical />}
|
||||
@@ -235,6 +242,12 @@ export default function TranscriptBrowser() {
|
||||
>
|
||||
Delete
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={handleProcessTranscript(item.id)}
|
||||
icon={<FaArrowRotateRight />}
|
||||
>
|
||||
Process
|
||||
</MenuItem>
|
||||
<AlertDialog
|
||||
isOpen={transcriptToDeleteId === item.id}
|
||||
leastDestructiveRef={cancelRef}
|
||||
|
||||
@@ -46,6 +46,8 @@ import type {
|
||||
V1TranscriptGetWebsocketEventsResponse,
|
||||
V1TranscriptRecordWebrtcData,
|
||||
V1TranscriptRecordWebrtcResponse,
|
||||
V1TranscriptProcessData,
|
||||
V1TranscriptProcessResponse,
|
||||
V1UserMeResponse,
|
||||
} from "./types.gen";
|
||||
|
||||
@@ -565,6 +567,28 @@ export class DefaultService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Transcript Process
|
||||
* @param data The data for the request.
|
||||
* @param data.transcriptId
|
||||
* @returns unknown Successful Response
|
||||
* @throws ApiError
|
||||
*/
|
||||
public v1TranscriptProcess(
|
||||
data: V1TranscriptProcessData,
|
||||
): CancelablePromise<V1TranscriptProcessResponse> {
|
||||
return this.httpRequest.request({
|
||||
method: "POST",
|
||||
url: "/v1/transcripts/{transcript_id}/process",
|
||||
path: {
|
||||
transcript_id: data.transcriptId,
|
||||
},
|
||||
errors: {
|
||||
422: "Validation Error",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* User Me
|
||||
* @returns unknown Successful Response
|
||||
|
||||
@@ -315,6 +315,12 @@ export type V1TranscriptRecordWebrtcData = {
|
||||
|
||||
export type V1TranscriptRecordWebrtcResponse = unknown;
|
||||
|
||||
export type V1TranscriptProcessData = {
|
||||
transcriptId: string;
|
||||
};
|
||||
|
||||
export type V1TranscriptProcessResponse = unknown;
|
||||
|
||||
export type V1UserMeResponse = UserInfo | null;
|
||||
|
||||
export type $OpenApiTs = {
|
||||
@@ -629,6 +635,21 @@ export type $OpenApiTs = {
|
||||
};
|
||||
};
|
||||
};
|
||||
"/v1/transcripts/{transcript_id}/process": {
|
||||
post: {
|
||||
req: V1TranscriptProcessData;
|
||||
res: {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HTTPValidationError;
|
||||
};
|
||||
};
|
||||
};
|
||||
"/v1/me": {
|
||||
get: {
|
||||
res: {
|
||||
|
||||
Reference in New Issue
Block a user