Just a couple of nits

This commit is contained in:
Mattias Granlund 2024-03-18 19:03:40 +01:00
parent ef8734d638
commit ec193efd73
4 changed files with 8 additions and 8 deletions

View File

@ -89,7 +89,7 @@ export class AIService {
private cloud: ReturnType<typeof getCloudApiClient>
) {}
async configurationValid(userToken?: string) {
async validateConfiguration(userToken?: string): Promise<boolean> {
const modelKind = await this.gitConfig.getWithDefault<ModelKind>(
GitAIConfigKey.ModelProvider,
ModelKind.OpenAI
@ -109,12 +109,12 @@ export class AIService {
(modelKind == ModelKind.OpenAI && openAIKeyOption == KeyOption.ButlerAPI) ||
(modelKind == ModelKind.Anthropic && anthropicKeyOption == KeyOption.ButlerAPI)
) {
return Boolean(userToken);
return !!userToken;
}
return Boolean(
(modelKind == ModelKind.OpenAI && openAIKey) ||
(modelKind == ModelKind.Anthropic && anthropicKey)
return (
(modelKind == ModelKind.OpenAI && !!openAIKey) ||
(modelKind == ModelKind.Anthropic && !!anthropicKey)
);
}

View File

@ -113,7 +113,7 @@
generateBranchName();
}
onMount(async () => {
onMount(() => {
laneWidth = lscache.get(laneWidthKey + branch.id);
});

View File

@ -44,7 +44,7 @@
$: setAIConfigurationValid($user);
async function setAIConfigurationValid(user: User | undefined) {
aiConfigurationValid = await aiService.configurationValid(user?.access_token);
aiConfigurationValid = await aiService.validateConfiguration(user?.access_token);
}
</script>

View File

@ -139,7 +139,7 @@
let aiConfigurationValid = false;
onMount(async () => {
aiConfigurationValid = await aiService.configurationValid(user?.access_token);
aiConfigurationValid = await aiService.validateConfiguration(user?.access_token);
});
</script>