mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-05 06:02:15 +00:00
fix: early return if no api key is provided (#686)
* fix: early return if no api key is provided * cr
This commit is contained in:
parent
b783d35567
commit
3c6c919fea
2 changed files with 10 additions and 0 deletions
|
|
@ -109,6 +109,7 @@ export function TerminalInput({
|
||||||
MISSING_API_KEYS_TOAST_CONTENT,
|
MISSING_API_KEYS_TOAST_CONTENT,
|
||||||
MISSING_API_KEYS_TOAST_OPTIONS,
|
MISSING_API_KEYS_TOAST_OPTIONS,
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,14 @@ const API_KEY_DEFINITIONS = {
|
||||||
// ],
|
// ],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const shouldAutofocus = (apiKeyId: string, hasValue: boolean): boolean => {
|
||||||
|
if (apiKeyId === "anthropicApiKey") {
|
||||||
|
return !hasValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
export function APIKeysTab() {
|
export function APIKeysTab() {
|
||||||
const { getConfig, updateConfig } = useConfigStore();
|
const { getConfig, updateConfig } = useConfigStore();
|
||||||
const config = getConfig(DEFAULT_CONFIG_KEY);
|
const config = getConfig(DEFAULT_CONFIG_KEY);
|
||||||
|
|
@ -186,6 +194,7 @@ export function APIKeysTab() {
|
||||||
}
|
}
|
||||||
placeholder={`Enter your ${apiKey.name} API key`}
|
placeholder={`Enter your ${apiKey.name} API key`}
|
||||||
className="font-mono text-sm"
|
className="font-mono text-sm"
|
||||||
|
autoFocus={shouldAutofocus(apiKey.id, !!apiKey.value)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue