@@ -5,6 +5,7 @@ import { ProviderConfigDialog } from "./setting/ProviderConfigDialog";
55import { OllamaConfigDialog } from "./setting/OllamaConfigDialog" ;
66import { LiteLLMConfigDialog } from "./setting/LiteLLMConfigDialog" ;
77import { OpenRouterConfigDialog } from "./setting/OpenRouterConfigDialog" ;
8+ import { BedrockConfigDialog } from "./setting/BedrockConfigDialog" ;
89import { AccountApiKeySection } from "./setting/AccountApiKeySection" ;
910
1011interface ProviderConfig {
@@ -31,6 +32,10 @@ export function SettingsTab() {
3132 setLiteLLMModelAlias,
3233 getOpenRouterSelectedModels,
3334 setOpenRouterSelectedModels,
35+ getBedrockRegion,
36+ setBedrockRegion,
37+ getBedrockSecretKey,
38+ setBedrockSecretKey,
3439 } = useAiProviderKeys ( ) ;
3540
3641 const [ editingValue , setEditingValue ] = useState ( "" ) ;
@@ -47,6 +52,10 @@ export function SettingsTab() {
4752 const [ openRouterApiKeyInput , setOpenRouterApiKeyInput ] = useState ( "" ) ;
4853 const [ openRouterSelectedModelsInput , setOpenRouterSelectedModelsInput ] =
4954 useState < string [ ] > ( [ ] ) ;
55+ const [ bedrockDialogOpen , setBedrockDialogOpen ] = useState ( false ) ;
56+ const [ bedrockAccessKeyIdInput , setBedrockAccessKeyIdInput ] = useState ( "" ) ;
57+ const [ bedrockSecretKeyInput , setBedrockSecretKeyInput ] = useState ( "" ) ;
58+ const [ bedrockRegionInput , setBedrockRegionInput ] = useState ( "" ) ;
5059
5160 const providerConfigs : ProviderConfig [ ] = [
5261 {
@@ -94,9 +103,23 @@ export function SettingsTab() {
94103 placeholder : "..." ,
95104 getApiKeyUrl : "https://console.mistral.ai/api-keys/" ,
96105 } ,
106+ {
107+ id : "bedrock" ,
108+ name : "Amazon Bedrock" ,
109+ logo : "/bedrock_logo.png" ,
110+ logoAlt : "Amazon Bedrock" ,
111+ description : "Claude 3.5, Llama 3, Mistral models on AWS Bedrock" ,
112+ placeholder : "AWS Access Key ID" ,
113+ getApiKeyUrl : "https://console.aws.amazon.com/iam/" ,
114+ } ,
97115 ] ;
98116
99117 const handleEdit = ( providerId : string ) => {
118+ if ( providerId === "bedrock" ) {
119+ handleBedrockEdit ( ) ;
120+ return ;
121+ }
122+
100123 const provider = providerConfigs . find ( ( p ) => p . id === providerId ) ;
101124 if ( provider ) {
102125 setSelectedProvider ( provider ) ;
@@ -129,6 +152,11 @@ export function SettingsTab() {
129152 if ( providerId === "openrouter" ) {
130153 setOpenRouterSelectedModels ( [ ] ) ;
131154 }
155+ // Also clear Bedrock credentials if deleting Bedrock provider
156+ if ( providerId === "bedrock" ) {
157+ setBedrockSecretKey ( "" ) ;
158+ setBedrockRegion ( "" ) ;
159+ }
132160 } ;
133161
134162 const handleOllamaEdit = ( ) => {
@@ -194,6 +222,30 @@ export function SettingsTab() {
194222 setOpenRouterSelectedModelsInput ( [ ] ) ;
195223 } ;
196224
225+ const handleBedrockEdit = ( ) => {
226+ setBedrockAccessKeyIdInput ( tokens . bedrock || "" ) ;
227+ setBedrockSecretKeyInput ( getBedrockSecretKey ( ) ) ;
228+ setBedrockRegionInput ( getBedrockRegion ( ) ) ;
229+ setBedrockDialogOpen ( true ) ;
230+ } ;
231+
232+ const handleBedrockSave = ( ) => {
233+ setToken ( "bedrock" , bedrockAccessKeyIdInput ) ;
234+ setBedrockSecretKey ( bedrockSecretKeyInput ) ;
235+ setBedrockRegion ( bedrockRegionInput ) ;
236+ setBedrockDialogOpen ( false ) ;
237+ setBedrockAccessKeyIdInput ( "" ) ;
238+ setBedrockSecretKeyInput ( "" ) ;
239+ setBedrockRegionInput ( "" ) ;
240+ } ;
241+
242+ const handleBedrockCancel = ( ) => {
243+ setBedrockDialogOpen ( false ) ;
244+ setBedrockAccessKeyIdInput ( "" ) ;
245+ setBedrockSecretKeyInput ( "" ) ;
246+ setBedrockRegionInput ( "" ) ;
247+ } ;
248+
197249 return (
198250 < div className = "container mx-auto p-6 max-w-6xl space-y-8" >
199251 < div className = "flex items-center gap-3 mb-6" >
@@ -268,6 +320,20 @@ export function SettingsTab() {
268320 onSave = { handleOpenRouterSave }
269321 onCancel = { handleOpenRouterCancel }
270322 />
323+
324+ { /* Bedrock Configuration Dialog */ }
325+ < BedrockConfigDialog
326+ open = { bedrockDialogOpen }
327+ onOpenChange = { setBedrockDialogOpen }
328+ accessKeyId = { bedrockAccessKeyIdInput }
329+ secretKey = { bedrockSecretKeyInput }
330+ region = { bedrockRegionInput }
331+ onAccessKeyIdChange = { setBedrockAccessKeyIdInput }
332+ onSecretKeyChange = { setBedrockSecretKeyInput }
333+ onRegionChange = { setBedrockRegionInput }
334+ onSave = { handleBedrockSave }
335+ onCancel = { handleBedrockCancel }
336+ />
271337 </ div >
272338 ) ;
273339}
0 commit comments