forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into claude-new-sonnet-and-haiku
- Loading branch information
Showing
13 changed files
with
235 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ dist-ssr | |
_worker.bundle | ||
|
||
Modelfile | ||
modelfiles |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { useState } from 'react'; | ||
import { IconButton } from '~/components/ui/IconButton'; | ||
|
||
interface APIKeyManagerProps { | ||
provider: string; | ||
apiKey: string; | ||
setApiKey: (key: string) => void; | ||
} | ||
|
||
export const APIKeyManager: React.FC<APIKeyManagerProps> = ({ provider, apiKey, setApiKey }) => { | ||
const [isEditing, setIsEditing] = useState(false); | ||
const [tempKey, setTempKey] = useState(apiKey); | ||
|
||
const handleSave = () => { | ||
setApiKey(tempKey); | ||
setIsEditing(false); | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center gap-2 mt-2 mb-2"> | ||
<span className="text-sm text-bolt-elements-textSecondary">{provider} API Key:</span> | ||
{isEditing ? ( | ||
<> | ||
<input | ||
type="password" | ||
value={tempKey} | ||
onChange={(e) => setTempKey(e.target.value)} | ||
className="flex-1 p-1 text-sm rounded border border-bolt-elements-borderColor bg-bolt-elements-prompt-background text-bolt-elements-textPrimary focus:outline-none focus:ring-2 focus:ring-bolt-elements-focus" | ||
/> | ||
<IconButton onClick={handleSave} title="Save API Key"> | ||
<div className="i-ph:check" /> | ||
</IconButton> | ||
<IconButton onClick={() => setIsEditing(false)} title="Cancel"> | ||
<div className="i-ph:x" /> | ||
</IconButton> | ||
</> | ||
) : ( | ||
<> | ||
<span className="flex-1 text-sm text-bolt-elements-textPrimary"> | ||
{apiKey ? '••••••••' : 'Not set (will still work if set in .env file)'} | ||
</span> | ||
<IconButton onClick={() => setIsEditing(true)} title="Edit API Key"> | ||
<div className="i-ph:pencil-simple" /> | ||
</IconButton> | ||
</> | ||
)} | ||
</div> | ||
); | ||
}; |
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
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
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
Oops, something went wrong.