-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[setup] UX simplification for adding API keys on app startup
- Loading branch information
1 parent
e412e99
commit 52ecf7c
Showing
6 changed files
with
107 additions
and
309 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
import React from 'react'; | ||
import { Card } from '../ui/card'; | ||
import { Card } from './ui/card'; | ||
import { Lock } from 'lucide-react' | ||
import { Input } from "../ui/input" | ||
import { Button } from "../ui/button" | ||
import UnionIcon from '../../images/[email protected]'; | ||
import { Input } from "./ui/input" | ||
import { Button } from "./ui/button" | ||
import UnionIcon from '../images/[email protected]'; | ||
|
||
|
||
interface AddModelModalProps { | ||
interface ProviderSetupModalProps { | ||
provider: string | ||
model: string | ||
endpoint: string | ||
onSubmit: (apiKey: string) => void | ||
onCancel: () => void | ||
} | ||
|
||
export function AddModelModal({ provider, model, endpoint, onSubmit, onCancel }: AddModelModalProps) { | ||
export function ProviderSetupModal({ provider, model, endpoint, onSubmit, onCancel }: ProviderSetupModalProps) { | ||
const [apiKey, setApiKey] = React.useState("") | ||
|
||
const headerText = `Add ${provider} API Key` | ||
const handleSubmit = (e: React.FormEvent) => { | ||
e.preventDefault() | ||
onSubmit(apiKey) | ||
|
@@ -36,46 +35,24 @@ export function AddModelModal({ provider, model, endpoint, onSubmit, onCancel }: | |
className="w-32 h-32" | ||
/> | ||
</div> | ||
<h2 className="text-2xl font-semibold text-gray-900">Add model</h2> | ||
<p className="text-gray-500 text-lg"> | ||
Add your model details to integrate into goose | ||
</p> | ||
<h2 className="text-2xl font-semibold text-gray-900">{headerText}</h2> | ||
</div> | ||
|
||
{/* Form */} | ||
<form onSubmit={handleSubmit} className="space-y-8"> | ||
<div className="space-y-5"> | ||
<div> | ||
<Input | ||
type="text" | ||
value={endpoint} | ||
disabled | ||
placeholder="Endpoint" | ||
className="w-full h-14 px-6 rounded-2xl border border-gray-200/75 bg-white text-lg placeholder:text-gray-400" | ||
/> | ||
</div> | ||
<div> | ||
<Input | ||
type="text" | ||
value={model} | ||
onChange={(e) => setModel(e.target.value)} | ||
placeholder="Model" | ||
className="w-full h-14 px-6 rounded-2xl border border-gray-200/75 bg-white text-lg placeholder:text-gray-400" | ||
required | ||
/> | ||
</div> | ||
<div> | ||
<Input | ||
type="password" | ||
value={apiKey} | ||
onChange={(e) => setApiKey(e.target.value)} | ||
placeholder="API key" | ||
placeholder={`${provider} API key`} | ||
className="w-full h-14 px-6 rounded-2xl border border-gray-200/75 bg-white text-lg placeholder:text-gray-400" | ||
required | ||
/> | ||
<div className="flex items-center gap-1.5 mt-3 text-gray-500"> | ||
<Lock className="w-4 h-4" /> | ||
<span className="text-[15px]">Keys are stored in a secure .env file</span> | ||
<span className="text-[15px]">{`Your API key will be stored securely in the keychain and used only for making requests to ${provider}`}</span> | ||
</div> | ||
</div> | ||
</div> | ||
|
Oops, something went wrong.