Skip to content

Commit

Permalink
fix: missing field in request (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
yingjiehe-xyz authored Jan 30, 2025
1 parent 06a2464 commit a6e97b8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,12 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
.mask('▪')
.interact()?
} else {
cliclack::input(format!("Enter new value for {}", key.name))
.interact()?
let mut input =
cliclack::input(format!("Enter new value for {}", key.name));
if key.default.is_some() {
input = input.default_input(&key.default.clone().unwrap());
}
input.interact()?
};

if key.secret {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export function ConfigureProvidersGrid() {
return;
}

const isSecret = isSecretKey(keyName);

try {
// Delete existing key if provider is already configured
const isUpdate = providers.find((p) => p.id === selectedForSetup)?.isConfigured;
Expand All @@ -96,7 +98,10 @@ export function ConfigureProvidersGrid() {
'Content-Type': 'application/json',
'X-Secret-Key': getSecretKey(),
},
body: JSON.stringify({ key: keyName }),
body: JSON.stringify({
key: keyName,
isSecret,
}),
});

if (!deleteResponse.ok) {
Expand All @@ -107,7 +112,6 @@ export function ConfigureProvidersGrid() {
}

// Store new key
const isSecret = isSecretKey(keyName);
const storeResponse = await fetch(getApiUrl('/configs/store'), {
method: 'POST',
headers: {
Expand Down
7 changes: 5 additions & 2 deletions ui/desktop/src/components/welcome_screen/ProviderGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export function ProviderGrid({ onSubmit }: ProviderGridProps) {
return;
}

const isSecret = isSecretKey(keyName);
try {
if (selectedId && providers.find((p) => p.id === selectedId)?.isConfigured) {
const deleteResponse = await fetch(getApiUrl('/configs/delete'), {
Expand All @@ -89,7 +90,10 @@ export function ProviderGrid({ onSubmit }: ProviderGridProps) {
'Content-Type': 'application/json',
'X-Secret-Key': getSecretKey(),
},
body: JSON.stringify({ key: keyName }),
body: JSON.stringify({
key: keyName,
isSecret,
}),
});

if (!deleteResponse.ok) {
Expand All @@ -99,7 +103,6 @@ export function ProviderGrid({ onSubmit }: ProviderGridProps) {
}
}

const isSecret = isSecretKey(keyName);
const storeResponse = await fetch(getApiUrl('/configs/store'), {
method: 'POST',
headers: {
Expand Down

0 comments on commit a6e97b8

Please sign in to comment.