From 4139a5502769fb9c43d58c7bff720a37f72fc391 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 19 Aug 2024 07:53:18 -0700 Subject: [PATCH] Allow empty API key (#232) --- server/ai/configuration.go | 4 ++-- webapp/src/components/system_console/bot.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/ai/configuration.go b/server/ai/configuration.go index 7c5b662d..d4310dde 100644 --- a/server/ai/configuration.go +++ b/server/ai/configuration.go @@ -26,7 +26,7 @@ func (c *BotConfig) IsValid() bool { isInvalid := c.Name == "" || c.DisplayName == "" || c.Service.Type == "" || - (c.Service.Type == "openaicompatable" && c.Service.APIURL == "") || - (c.Service.Type != "asksage" && c.Service.APIKey == "") + (c.Service.Type == "openaicompatible" && c.Service.APIURL == "") || + (c.Service.Type != "asksage" && c.Service.Type != "openaicompatible" && c.Service.APIKey == "") return !isInvalid } diff --git a/webapp/src/components/system_console/bot.tsx b/webapp/src/components/system_console/bot.tsx index c7fabc94..eaa0b774 100644 --- a/webapp/src/components/system_console/bot.tsx +++ b/webapp/src/components/system_console/bot.tsx @@ -57,7 +57,7 @@ const Bot = (props: Props) => { const missingInfo = props.bot.name === '' || props.bot.displayName === '' || props.bot.service.type === '' || - (props.bot.service.type !== 'asksage' && props.bot.service.apiKey === '') || + (props.bot.service.type !== 'asksage' && props.bot.service.type !== 'openaicompatible' && props.bot.service.apiKey === '') || (props.bot.service.type === 'openaicompatible' && props.bot.service.apiURL === ''); const invalidUsername = props.bot.name !== '' && (!(/^[a-z0-9.\-_]+$/).test(props.bot.name) || !(/[a-z]/).test(props.bot.name.charAt(0)));