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

View File

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

View File

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

View File

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