Skip to content

Commit d53c179

Browse files
committed
wip
1 parent 59fc213 commit d53c179

File tree

49 files changed

+386
-595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+386
-595
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/src-tauri/src/ext.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use tauri_plugin_store2::{ScopedStore, StorePluginExt};
77
pub trait AppExt<R: tauri::Runtime> {
88
fn sentry_dsn(&self) -> String;
99
fn desktop_store(&self) -> Result<ScopedStore<R, crate::StoreKey>, String>;
10-
fn setup_local_ai(&self) -> impl Future<Output = Result<(), String>>;
1110
fn setup_db_for_local(&self) -> impl Future<Output = Result<(), String>>;
1211
fn setup_db_for_cloud(&self) -> impl Future<Output = Result<(), String>>;
1312
}
@@ -32,39 +31,6 @@ impl<R: tauri::Runtime, T: tauri::Manager<R>> AppExt<R> for T {
3231
self.scoped_store("desktop").map_err(|e| e.to_string())
3332
}
3433

35-
#[tracing::instrument(skip_all)]
36-
async fn setup_local_ai(&self) -> Result<(), String> {
37-
{
38-
use tauri_plugin_local_stt::LocalSttPluginExt;
39-
40-
let current_model = self
41-
.get_current_model()
42-
.unwrap_or(hypr_whisper_local_model::WhisperModel::QuantizedBaseEn);
43-
44-
if let Ok(true) = self.is_model_downloaded(&current_model).await {
45-
if let Err(e) = self.start_server(None).await {
46-
tracing::error!("start_local_stt_server: {}", e);
47-
}
48-
}
49-
}
50-
51-
{
52-
use tauri_plugin_local_llm::{LocalLlmPluginExt, SupportedModel};
53-
54-
let current_model = self
55-
.get_current_model()
56-
.unwrap_or(SupportedModel::Llama3p2_3bQ4);
57-
58-
if let Ok(true) = self.is_model_downloaded(&current_model).await {
59-
if let Err(e) = self.start_server().await {
60-
tracing::error!("start_local_llm_server: {}", e);
61-
}
62-
}
63-
}
64-
65-
Ok(())
66-
}
67-
6834
#[tracing::instrument(skip_all)]
6935
async fn setup_db_for_local(&self) -> Result<(), String> {
7036
let (db, db_just_created) = {

apps/desktop/src-tauri/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ pub async fn main() {
216216
});
217217
}
218218
}
219-
220-
tokio::spawn(async move {
221-
app_clone.setup_local_ai().await.unwrap();
222-
});
223219
});
224220

225221
Ok(())

apps/desktop/src/components/editor-area/note-header/listen-button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { TemplateService } from "@/utils/template-service";
2323
import { commands as analyticsCommands } from "@hypr/plugin-analytics";
2424
import { commands as dbCommands } from "@hypr/plugin-db";
2525
import { commands as listenerCommands } from "@hypr/plugin-listener";
26-
import { commands as localSttCommands } from "@hypr/plugin-local-stt";
26+
import { commands as localSttCommands, type SupportedSttModel } from "@hypr/plugin-local-stt";
2727
import { commands as miscCommands } from "@hypr/plugin-misc";
2828
import { Button } from "@hypr/ui/components/ui/button";
2929
import { Form, FormControl, FormField, FormItem, FormLabel } from "@hypr/ui/components/ui/form";
@@ -75,7 +75,7 @@ export default function ListenButton({ sessionId }: { sessionId: string }) {
7575
queryFn: async () => {
7676
const supportedModels = await localSttCommands.listSupportedModels();
7777
const sttDownloadStatuses = await Promise.all(
78-
supportedModels.map((model) => localSttCommands.isModelDownloaded(model)),
78+
supportedModels.map((model) => localSttCommands.isModelDownloaded(model.key as SupportedSttModel)),
7979
);
8080
return sttDownloadStatuses.some(Boolean);
8181
},

apps/desktop/src/components/settings/components/ai/stt-view-local.tsx

Lines changed: 8 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -9,96 +9,6 @@ import { Button } from "@hypr/ui/components/ui/button";
99
import { cn } from "@hypr/ui/lib/utils";
1010
import { SharedSTTProps, STTModel } from "./shared";
1111

12-
export const sttModelMetadata: Record<WhisperModel, {
13-
name: string;
14-
description: string;
15-
intelligence: number;
16-
speed: number;
17-
size: string;
18-
inputType: string[];
19-
outputType: string[];
20-
languageSupport: "multilingual" | "english-only";
21-
huggingface?: string;
22-
}> = {
23-
"QuantizedTiny": {
24-
name: "Tiny",
25-
description: "Fastest, lowest accuracy. Good for offline, low-resource use.",
26-
intelligence: 1,
27-
speed: 3,
28-
size: "44 MB",
29-
inputType: ["audio"],
30-
outputType: ["text"],
31-
languageSupport: "multilingual",
32-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-tiny-q8_0.bin",
33-
},
34-
"QuantizedTinyEn": {
35-
name: "Tiny - English",
36-
description: "Fastest, English-only. Optimized for speed on English audio.",
37-
intelligence: 1,
38-
speed: 3,
39-
size: "44 MB",
40-
inputType: ["audio"],
41-
outputType: ["text"],
42-
languageSupport: "english-only",
43-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-tiny.en-q8_0.bin",
44-
},
45-
"QuantizedBase": {
46-
name: "Base",
47-
description: "Good balance of speed and accuracy for multilingual use.",
48-
intelligence: 2,
49-
speed: 2,
50-
size: "82 MB",
51-
inputType: ["audio"],
52-
outputType: ["text"],
53-
languageSupport: "multilingual",
54-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-base-q8_0.bin",
55-
},
56-
"QuantizedBaseEn": {
57-
name: "Base - English",
58-
description: "Balanced speed and accuracy, optimized for English audio.",
59-
intelligence: 2,
60-
speed: 2,
61-
size: "82 MB",
62-
inputType: ["audio"],
63-
outputType: ["text"],
64-
languageSupport: "english-only",
65-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-base.en-q8_0.bin",
66-
},
67-
"QuantizedSmall": {
68-
name: "Small",
69-
description: "Higher accuracy, moderate speed for multilingual transcription.",
70-
intelligence: 2,
71-
speed: 2,
72-
size: "264 MB",
73-
inputType: ["audio"],
74-
outputType: ["text"],
75-
languageSupport: "multilingual",
76-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-small-q8_0.bin",
77-
},
78-
"QuantizedSmallEn": {
79-
name: "Small - English",
80-
description: "Higher accuracy, moderate speed, optimized for English audio.",
81-
intelligence: 3,
82-
speed: 2,
83-
size: "264 MB",
84-
inputType: ["audio"],
85-
outputType: ["text"],
86-
languageSupport: "english-only",
87-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-small.en-q8_0.bin",
88-
},
89-
"QuantizedLargeTurbo": {
90-
name: "Large",
91-
description: "Highest accuracy, resource intensive. Only for Mac Pro M4 and above.",
92-
intelligence: 3,
93-
speed: 1,
94-
size: "874 MB",
95-
inputType: ["audio"],
96-
outputType: ["text"],
97-
languageSupport: "multilingual",
98-
huggingface: "https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-large-v3-turbo-q8_0.bin",
99-
},
100-
};
101-
10212
interface STTViewProps extends SharedSTTProps {
10313
isWerModalOpen: boolean;
10414
setIsWerModalOpen: (open: boolean) => void;
@@ -257,7 +167,12 @@ function BasicModelsManagement({
257167
function ProModelsManagement({ on }: { on: boolean }) {
258168
const proModels = useQuery({
259169
queryKey: ["pro-models"],
260-
queryFn: () => localSttCommands.listProModels(),
170+
queryFn: async () => {
171+
const models = await localSttCommands.listSupportedModels();
172+
return models.filter((model) =>
173+
model.key === "am-whisper-small-en" || model.key === "am-whisper-large-v3" || model.key === "am-parakeet-v2"
174+
);
175+
},
261176
});
262177

263178
return (
@@ -269,7 +184,7 @@ function ProModelsManagement({ on }: { on: boolean }) {
269184
<span className={cn(["w-2 h-2 rounded-full", on ? "bg-blue-300 animate-pulse" : "bg-red-300"])} />
270185
</div>
271186
<p className="text-xs text-gray-500">
272-
Only for pro plan users. Latency and resource optimized. (will be shipped in next few days)
187+
Latency and resource optimized. Only for pro plan users.
273188
</p>
274189
</div>
275190

@@ -279,7 +194,7 @@ function ProModelsManagement({ on }: { on: boolean }) {
279194
key={model.key}
280195
disabled={true}
281196
model={{
282-
name: model.name,
197+
name: model.display_name,
283198
key: model.key,
284199
downloaded: false,
285200
size: `${(model.size_bytes / 1024 / 1024).toFixed(0)} MB`,

apps/desktop/src/components/toast/model-select.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { LinkProps } from "@tanstack/react-router";
22

3-
import { commands as localSttCommands, type WhisperModel } from "@hypr/plugin-local-stt";
3+
import { commands as localSttCommands, type SupportedSttModel } from "@hypr/plugin-local-stt";
44
import { commands as windowsCommands } from "@hypr/plugin-windows";
55
import { Button } from "@hypr/ui/components/ui/button";
66
import { sonnerToast, toast } from "@hypr/ui/components/ui/toast";
77

88
export async function showModelSelectToast(language: string) {
99
const currentModel = await localSttCommands.getCurrentModel();
10-
const englishModels: WhisperModel[] = ["QuantizedTinyEn", "QuantizedBaseEn", "QuantizedSmallEn"];
10+
const englishModels: SupportedSttModel[] = ["QuantizedTinyEn", "QuantizedBaseEn", "QuantizedSmallEn"];
1111

1212
if (language === "en" || !englishModels.includes(currentModel)) {
1313
return;

apps/desktop/src/components/toast/shared.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Channel } from "@tauri-apps/api/core";
33
import { useEffect, useState } from "react";
44

55
import { commands as localLlmCommands, SupportedModel as SupportedModelLLM } from "@hypr/plugin-local-llm";
6-
import { commands as localSttCommands, type WhisperModel } from "@hypr/plugin-local-stt";
6+
import { commands as localSttCommands, type SupportedSttModel } from "@hypr/plugin-local-stt";
77
import { commands as windowsCommands } from "@hypr/plugin-windows";
88
import { Button } from "@hypr/ui/components/ui/button";
99
import { Progress } from "@hypr/ui/components/ui/progress";
@@ -52,7 +52,11 @@ export const DownloadProgress = ({
5252
);
5353
};
5454

55-
export function showSttModelDownloadToast(model: WhisperModel, onComplete?: () => void, queryClient?: QueryClient) {
55+
export function showSttModelDownloadToast(
56+
model: SupportedSttModel,
57+
onComplete?: () => void,
58+
queryClient?: QueryClient,
59+
) {
5660
const sttChannel = new Channel();
5761

5862
localSttCommands.downloadModel(model, sttChannel);

apps/desktop/src/components/welcome-modal/download-progress-view.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { commands as localSttCommands, type WhisperModel } from "@hypr/plugin-lo
88
import { Progress } from "@hypr/ui/components/ui/progress";
99
import PushableButton from "@hypr/ui/components/ui/pushable-button";
1010
import { cn } from "@hypr/ui/lib/utils";
11-
import { sttModelMetadata } from "../settings/components/ai/stt-view-local";
1211

1312
interface ModelDownloadProgress {
1413
channel: Channel<number>;
@@ -196,8 +195,6 @@ export const DownloadProgressView = ({
196195
handleLlmCompletion();
197196
}, [sttDownload.completed, llmDownload.completed, selectedSttModel, llmSelection]);
198197

199-
const sttMetadata = sttModelMetadata[selectedSttModel];
200-
201198
return (
202199
<div className="flex flex-col items-center min-w-[30rem] w-full max-w-lg mx-auto">
203200
<h2 className="text-xl font-semibold mb-4">
@@ -238,7 +235,7 @@ export const DownloadProgressView = ({
238235
title="Speech Recognition"
239236
icon={MicIcon}
240237
download={sttDownload}
241-
size={sttMetadata?.size || "250MB"}
238+
size={"??? MB"}
242239
/>
243240

244241
{llmSelection === "hyprllm" && (

0 commit comments

Comments
 (0)