feat: don't ask for password if backend is localai

Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
This commit is contained in:
Aris Boutselis 2023-04-25 20:45:04 +03:00
parent c365c53332
commit 74d9a750ca
No known key found for this signature in database
GPG Key ID: 702CD37DB0D0FF51
2 changed files with 5 additions and 1 deletions

View File

@ -71,7 +71,7 @@ var AuthCmd = &cobra.Command{
os.Exit(1)
}
if password == "" {
if ai.NeedPassword(backend) && password == "" {
fmt.Printf("Enter %s Key: ", backend)
bytePassword, err := term.ReadPassword(int(syscall.Stdin))
if err != nil {

View File

@ -67,3 +67,7 @@ func (p *AIProvider) GetPassword() string {
func (p *AIProvider) GetModel() string {
return p.Model
}
func NeedPassword(backend string) bool {
return backend != "localai"
}