mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 14:45:42 +08:00
Go CLI: fix key commands (#16306)
### What problem does this PR solve? ``` RAGFlow(api/default)> set key 'ragflow-JgnarFSCUiV99oOvvMDei7ZzZg1cVlqGd1AMHrHeKE4'; SUCCESS RAGFlow(api/default)> unset key; SUCCESS RAGFlow(api/default)> list provider 'zhipu-ai' instances; RAGFlow(api/default)> list providers; RAGFlow(api/default)> list available providers; RAGFlow(api/default)> list provider 'zhipu-ai' instance 'test' models; ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -1136,8 +1136,8 @@ func (c *CLI) ListAPIServer(cmd *Command) (ResponseIf, error) {
|
||||
}
|
||||
if c.APIServerClientMap[serverName].LoginToken != nil {
|
||||
element["auth"] = "login"
|
||||
} else if apiServerConfig.ApiToken != nil {
|
||||
element["auth"] = "api token"
|
||||
} else if c.APIServerClientMap[serverName].APIKey != nil {
|
||||
element["auth"] = "api key"
|
||||
} else {
|
||||
element["auth"] = "no auth"
|
||||
}
|
||||
@@ -1310,7 +1310,7 @@ func (c *CLI) SaveServerConfig(cmd *Command) (ResponseIf, error) {
|
||||
return nil, fmt.Errorf("admin server isn't already login")
|
||||
}
|
||||
case APIMode:
|
||||
if c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].APIToken == nil && c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].LoginToken == nil {
|
||||
if c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].APIKey == nil && c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].LoginToken == nil {
|
||||
return nil, fmt.Errorf("API token not set. Please login first")
|
||||
}
|
||||
default:
|
||||
@@ -1365,8 +1365,8 @@ func (c *CLI) GetAPIServerInfo(serverName string) (ResponseIf, error) {
|
||||
}
|
||||
if c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].LoginToken != nil {
|
||||
result.Data["auth"] = "login"
|
||||
} else if apiServerConfig.ApiToken != nil {
|
||||
result.Data["auth"] = "api token"
|
||||
} else if c.APIServerClientMap[c.Config.APIClientConfig.CurrentAPIServer].APIKey != nil {
|
||||
result.Data["auth"] = "api key"
|
||||
} else {
|
||||
result.Data["auth"] = "no auth"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user