-
Notifications
You must be signed in to change notification settings - Fork 415
Deepgram compat v2 #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deepgram compat v2 #1307
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import React, { useState } from "react"; | |
|
|
||
| import { Card, CardContent } from "@hypr/ui/components/ui/card"; | ||
|
|
||
| import { SupportedModel } from "@hypr/plugin-local-stt"; | ||
| import { type WhisperModel } from "@hypr/plugin-local-stt"; | ||
| import { commands as localSttCommands } from "@hypr/plugin-local-stt"; | ||
| import PushableButton from "@hypr/ui/components/ui/pushable-button"; | ||
| import { cn } from "@hypr/ui/lib/utils"; | ||
|
|
@@ -45,9 +45,9 @@ const RatingDisplay = ( | |
| export const ModelSelectionView = ({ | ||
| onContinue, | ||
| }: { | ||
| onContinue: (model: SupportedModel) => void; | ||
| onContinue: (model: WhisperModel) => void; | ||
| }) => { | ||
| const [selectedModel, setSelectedModel] = useState<SupportedModel>("QuantizedSmall"); | ||
| const [selectedModel, setSelectedModel] = useState<WhisperModel>("QuantizedSmall"); | ||
|
|
||
| const supportedSTTModels = useQuery<ModelInfo[]>({ | ||
| queryKey: ["local-stt", "supported-models"], | ||
|
|
@@ -82,7 +82,7 @@ export const ModelSelectionView = ({ | |
| }) | ||
| ?.map(modelInfo => { | ||
| const model = modelInfo.model; | ||
| const metadata = sttModelMetadata[model as SupportedModel]; | ||
| const metadata = sttModelMetadata[model as WhisperModel]; | ||
| if (!metadata) { | ||
|
Comment on lines
+85
to
86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove casts by typing ModelInfo.model as WhisperModel Typing ModelInfo.model eliminates the need for casts at usage sites. -interface ModelInfo {
- model: string;
- is_downloaded: boolean;
-}
+interface ModelInfo {
+ model: WhisperModel;
+ is_downloaded: boolean;
+}
@@
- const metadata = sttModelMetadata[model as WhisperModel];
+ const metadata = sttModelMetadata[model];
@@
- onClick={() => setSelectedModel(model as WhisperModel)}
+ onClick={() => setSelectedModel(model)}Also applies to: 102-103 🤖 Prompt for AI Agents |
||
| return null; | ||
| } | ||
|
|
@@ -99,7 +99,7 @@ export const ModelSelectionView = ({ | |
| ? "ring-2 ring-blue-500 border-blue-500 bg-blue-50" | ||
| : "hover:border-gray-400", | ||
| )} | ||
| onClick={() => setSelectedModel(model as SupportedModel)} | ||
| onClick={() => setSelectedModel(model as WhisperModel)} | ||
| > | ||
| <CardContent className="flex flex-col gap-2 sm:gap-4 justify-between p-3 sm:p-5 h-48 sm:h-56"> | ||
| <div className="flex-1 text-center"> | ||
|
|
||
Check warning
Code scanning / zizmor
code injection via template expansion Warning