feat(frontend): add SaluteSpeech engine option to TranscriptionModal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import styles from "./TranscriptionModal.module.scss"
|
||||
|
||||
interface ITranscriptionFormData {
|
||||
file_key: string
|
||||
engine: "whisper" | "google"
|
||||
engine: "whisper" | "google" | "salutespeech"
|
||||
language: string
|
||||
model: string
|
||||
}
|
||||
@@ -22,25 +22,32 @@ interface ITranscriptionFormData {
|
||||
const ENGINE_OPTIONS = [
|
||||
{ value: "whisper", label: "Whisper (локальный)" },
|
||||
{ value: "google", label: "Google Speech" },
|
||||
{ value: "salutespeech", label: "SaluteSpeech" },
|
||||
]
|
||||
|
||||
const LANGUAGE_OPTIONS = [
|
||||
{ value: "auto", label: "Авто" },
|
||||
{ value: "ru", label: "Русский" },
|
||||
{ value: "en", label: "English" },
|
||||
{ value: "en", label: "Английский" },
|
||||
]
|
||||
|
||||
const MODEL_OPTIONS = [
|
||||
{ value: "base", label: "Base" },
|
||||
{ value: "small", label: "Small" },
|
||||
{ value: "medium", label: "Medium" },
|
||||
{ value: "large", label: "Large" },
|
||||
const WHISPER_MODEL_OPTIONS = [
|
||||
{ value: "base", label: "Базовая" },
|
||||
{ value: "small", label: "Малая" },
|
||||
{ value: "medium", label: "Средняя" },
|
||||
{ value: "large", label: "Большая" },
|
||||
]
|
||||
|
||||
const SALUTE_MODEL_OPTIONS = [
|
||||
{ value: "general", label: "Общая" },
|
||||
{ value: "finance", label: "Финансы" },
|
||||
{ value: "medicine", label: "Медицина" },
|
||||
]
|
||||
|
||||
export const TranscriptionModal: FunctionComponent<
|
||||
ITranscriptionModalProps
|
||||
> = ({ projectId, open, onOpenChange }): JSX.Element => {
|
||||
const { control, handleSubmit, reset, watch } =
|
||||
const { control, handleSubmit, reset, watch, setValue } =
|
||||
useForm<ITranscriptionFormData>({
|
||||
defaultValues: {
|
||||
file_key: "",
|
||||
@@ -52,6 +59,14 @@ export const TranscriptionModal: FunctionComponent<
|
||||
|
||||
const engine = watch("engine")
|
||||
|
||||
useEffect(() => {
|
||||
if (engine === "salutespeech") {
|
||||
setValue("model", "general")
|
||||
} else if (engine === "whisper") {
|
||||
setValue("model", "base")
|
||||
}
|
||||
}, [engine, setValue])
|
||||
|
||||
const { data: files } = api.useQuery("get", "/api/files/files/", {
|
||||
queryKey: ["files", projectId],
|
||||
})
|
||||
@@ -159,7 +174,7 @@ export const TranscriptionModal: FunctionComponent<
|
||||
/>
|
||||
</div>
|
||||
|
||||
{engine === "whisper" && (
|
||||
{(engine === "whisper" || engine === "salutespeech") && (
|
||||
<div className={styles.selectField}>
|
||||
<div className={styles.selectLabel}>Модель</div>
|
||||
<Controller
|
||||
@@ -171,7 +186,10 @@ export const TranscriptionModal: FunctionComponent<
|
||||
onValueChange={field.onChange}
|
||||
placeholder="Выберите модель"
|
||||
>
|
||||
{MODEL_OPTIONS.map((opt) => (
|
||||
{(engine === "whisper"
|
||||
? WHISPER_MODEL_OPTIONS
|
||||
: SALUTE_MODEL_OPTIONS
|
||||
).map((opt) => (
|
||||
<SelectItem key={opt.value} value={opt.value}>
|
||||
{opt.label}
|
||||
</SelectItem>
|
||||
|
||||
Reference in New Issue
Block a user