-
Notifications
You must be signed in to change notification settings - Fork 537
Data binding for most of settings ops #1562
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
28fc480
layout wip
yujonglee ddf7a10
more styling
yujonglee 1e20e7d
ai wip
yujonglee 49305fa
extract components
yujonglee eac636d
move config from persisted to internal
yujonglee ecc7840
update utils
yujonglee 7446f30
template editor
yujonglee 992040a
done
yujonglee 22be462
ai
yujonglee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| import { useState } from "react"; | ||
|
|
||
| import { Button } from "@hypr/ui/components/ui/button"; | ||
| import { Input } from "@hypr/ui/components/ui/input"; | ||
| import { Tabs, TabsContent, TabsList, TabsTrigger } from "@hypr/ui/components/ui/tabs"; | ||
| import { cn } from "@hypr/ui/lib/utils"; | ||
|
|
||
| export function SettingsAI() { | ||
| const [activeTab, setActiveTab] = useState<"transcription" | "intelligence">("transcription"); | ||
|
|
||
| return ( | ||
| <Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as typeof activeTab)} className="w-full"> | ||
| <TabsList className="mb-6 w-full grid grid-cols-2"> | ||
| <TabsTrigger value="transcription">Transcription</TabsTrigger> | ||
| <TabsTrigger value="intelligence">Intelligence</TabsTrigger> | ||
| </TabsList> | ||
| <TabsContent value="transcription" className="w-full"> | ||
| <TranscriptionSettings /> | ||
| </TabsContent> | ||
| <TabsContent value="intelligence" className="w-full"> | ||
| <IntelligenceSettings /> | ||
| </TabsContent> | ||
| </Tabs> | ||
| ); | ||
| } | ||
|
|
||
| function TranscriptionSettings() { | ||
| return ( | ||
| <div className="space-y-8"> | ||
| <Section title="On-device models" description="Local transcription models"> | ||
| <ModelCard | ||
| name="Parakeet-2" | ||
| description="For English-only conversations" | ||
| status="downloaded" | ||
| /> | ||
| <ModelCard | ||
| name="Parakeet-3" | ||
| description="For European languages" | ||
| status="available" | ||
| /> | ||
| </Section> | ||
|
|
||
| <Section title="Speech-to-text providers" description="Cloud-based transcription services"> | ||
| <ProviderCard name="Deepgram" /> | ||
| <ProviderCard name="Assembly AI" configured /> | ||
| </Section> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function IntelligenceSettings() { | ||
| return ( | ||
| <Section title="LLM providers" description="Large language model services"> | ||
| <ProviderCard name="Anthropic" /> | ||
| <ProviderCard name="OpenAI" configured modelInUse="chatgpt-4o-latest" /> | ||
| <ProviderCard name="Ollama" /> | ||
| <ProviderCard name="LM Studio" /> | ||
| </Section> | ||
| ); | ||
| } | ||
|
|
||
| function Section({ | ||
| title, | ||
| description, | ||
| children, | ||
| }: { | ||
| title: string; | ||
| description: string; | ||
| children: React.ReactNode; | ||
| }) { | ||
| return ( | ||
| <div> | ||
| <div className="mb-3"> | ||
| <h3 className="text-sm font-semibold text-gray-900">{title}</h3> | ||
| <p className="text-xs text-gray-500">{description}</p> | ||
| </div> | ||
| <div className="space-y-2">{children}</div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function ModelCard({ | ||
| name, | ||
| description, | ||
| status, | ||
| }: { | ||
| name: string; | ||
| description: string; | ||
| status: "available" | "downloaded"; | ||
| }) { | ||
| return ( | ||
| <div | ||
| className={cn([ | ||
| "p-4 rounded-lg border-2 transition-all cursor-pointer", | ||
| status === "downloaded" | ||
| ? "border-blue-500 bg-blue-50/50" | ||
| : "border-dashed border-gray-200 bg-white hover:border-gray-300", | ||
| ])} | ||
| > | ||
| <div className="flex items-center justify-between gap-4"> | ||
| <div className="flex-1 min-w-0"> | ||
| <h3 className="text-base font-semibold text-gray-900">{name}</h3> | ||
| <p className="text-sm text-gray-500 mt-0.5">{description}</p> | ||
| </div> | ||
| <div className="flex-shrink-0"> | ||
| {status === "downloaded" | ||
| ? ( | ||
| <span className="text-xs font-medium text-blue-600 bg-blue-100 px-3 py-1.5 rounded"> | ||
| Model Downloaded | ||
| </span> | ||
| ) | ||
| : ( | ||
| <Button size="sm" variant="outline" className="text-xs"> | ||
| Download Model | ||
| </Button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function ProviderCard({ | ||
| name, | ||
| configured, | ||
| modelInUse, | ||
| }: { | ||
| name: string; | ||
| configured?: boolean; | ||
| modelInUse?: string; | ||
| }) { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
|
|
||
| return ( | ||
| <div | ||
| className={cn([ | ||
| "border rounded-lg transition-all cursor-pointer", | ||
| isOpen | ||
| ? "border-blue-500 ring-2 ring-blue-500 bg-blue-50/30" | ||
| : "border-gray-200 bg-white hover:border-gray-300", | ||
| ])} | ||
| > | ||
| <div className="p-4" onClick={() => setIsOpen(!isOpen)}> | ||
| <div className="flex items-center justify-between"> | ||
| <div className="flex items-center gap-3"> | ||
| <span className="font-medium text-gray-900">{name}</span> | ||
| {configured && ( | ||
| <span className="text-xs text-green-700 flex items-center gap-1"> | ||
| <span>✓</span> | ||
| <span>API key configured</span> | ||
| </span> | ||
| )} | ||
| </div> | ||
| <span className="text-gray-400 text-xl font-light">{isOpen ? "−" : "+"}</span> | ||
| </div> | ||
| {modelInUse && ( | ||
| <p className="text-xs text-gray-500 mt-2"> | ||
| Model being used: <span className="font-mono text-gray-700">{modelInUse}</span> | ||
| </p> | ||
| )} | ||
| </div> | ||
|
|
||
| {isOpen && ( | ||
| <div className="px-4 pb-4 border-t border-gray-200 mt-2"> | ||
| <div className="mt-4"> | ||
| <Input | ||
| placeholder={`Paste your API key for ${name}`} | ||
| type="password" | ||
| className="placeholder:text-gray-400" | ||
| onClick={(e) => e.stopPropagation()} | ||
| /> | ||
| </div> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function SettingsBilling() { | ||
| return null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function SettingsCalendar() { | ||
| return null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { commands as windowsCommands } from "@hypr/plugin-windows/v1"; | ||
|
|
||
| import { useAuth } from "../../auth"; | ||
|
|
||
| export function SettingsDevelopers() { | ||
| const s = useAuth(); | ||
|
|
||
| const handleAuth = () => windowsCommands.windowShow({ type: "auth" }); | ||
|
|
||
| return ( | ||
| <div> | ||
| <pre>{JSON.stringify(s?.session)}</pre> | ||
| <button onClick={handleAuth}>Auth</button> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function SettingsFeedback() { | ||
| return null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { useUpdateGeneral } from "./shared"; | ||
|
|
||
| export function SettingsGeneral() { | ||
| const { value, handle } = useUpdateGeneral(); | ||
|
|
||
| return ( | ||
| <div> | ||
| <pre>{JSON.stringify(value, null, 2)}</pre> | ||
| <input | ||
| type="checkbox" | ||
| checked={value.save_recordings} | ||
| onChange={(e) => handle.setField("save_recordings", e.target.checked)} | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export function SettingsIntegrations() { | ||
| return null; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.