Skip to content

Commit

Permalink
Allow empty API key (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
crspeller authored Aug 19, 2024
1 parent 2aca528 commit 4139a55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/ai/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion webapp/src/components/system_console/bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit 4139a55

Please sign in to comment.