Handy/src/components/settings/general/ModelSettingsCard.tsx
Ivan Zhuravlev f8bbcd791c
Migrate to transcribe-rs-0.3.1 and add Canary support (#1023)
* refactor: migrate transcribe-rs from v0.2.8 to v0.3.0

Breaking API migration:
- engines::* → onnx::* module paths, whisper_cpp::* for Whisper
- TranscriptionEngine trait → SpeechModel trait
- Two-step new()+load_model() → one-step Model::load()
- transcribe_samples(Vec<f32>) → transcribe(&[f32])
- Explicit unload_model() → RAII drop
- Canary engine now from transcribe-rs instead of local crate

Removes canary-engine local crate dependency.
Uses path dependency to local transcribe-rs clone (temporary).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: upgrade transcribe-rs to v0.3.1, add Canary models

Update transcribe-rs dependency from v0.2.8 to v0.3.1 with
restructured features (whisper + onnx). Add Canary 180M Flash
(4 languages, 146MB) and Canary 1B v2 (25 EU languages, 692MB)
with translation support. Add i18n translations for all 17 locales.

Languages verified against HuggingFace model cards:
- Canary 180M Flash: en, de, es, fr
- Canary 1B v2: bg, hr, cs, da, nl, en, et, fi, fr, de, el, hu,
  it, lv, lt, mt, pl, pt, ro, sk, sl, es, sv, ru, uk

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* make sure when changing models the language changes with it

* format

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: CJ Pais <cj@cjpais.com>
2026-03-16 16:31:44 +08:00

43 lines
1.4 KiB
TypeScript

import React from "react";
import { useTranslation } from "react-i18next";
import { SettingsGroup } from "../../ui/SettingsGroup";
import { LanguageSelector } from "../LanguageSelector";
import { TranslateToEnglish } from "../TranslateToEnglish";
import { useModelStore } from "../../../stores/modelStore";
import type { ModelInfo } from "@/bindings";
export const ModelSettingsCard: React.FC = () => {
const { t } = useTranslation();
const { currentModel, models } = useModelStore();
const currentModelInfo = models.find((m: ModelInfo) => m.id === currentModel);
const supportsLanguageSelection =
currentModelInfo?.supports_language_selection ?? false;
const supportsTranslation = currentModelInfo?.supports_translation ?? false;
const hasAnySettings = supportsLanguageSelection || supportsTranslation;
// Don't render anything if no model is selected or no settings available
if (!currentModel || !currentModelInfo || !hasAnySettings) {
return null;
}
return (
<SettingsGroup
title={t("settings.modelSettings.title", {
model: currentModelInfo.name,
})}
>
{supportsLanguageSelection && (
<LanguageSelector
descriptionMode="tooltip"
grouped={true}
supportedLanguages={currentModelInfo.supported_languages}
/>
)}
{supportsTranslation && (
<TranslateToEnglish descriptionMode="tooltip" grouped={true} />
)}
</SettingsGroup>
);
};