mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-19 06:01:05 +08:00
Go CLI: refactor (#16299)
``` RAGFlow(api/default)> list dataset 'e93ab2c04ad111f1b17438a74640adcc' documents; Total: 1 RAGFlow(api/default)> list datasets; RAGFlow(api/default)> list chats; Total: 2 RAGFlow(api/default)> list agents; Total: 1 RAGFlow(api/default)> list searches; Total: 1 RAGFlow(api/default)> list keys; +----------------------------------+---------------+----------------------------------+-----------------------------------------------------+---------------+ | beta | create_time | tenant_id | token | update_time | +----------------------------------+---------------+----------------------------------+-----------------------------------------------------+---------------+ | GKsLEdSUkl76gJz1k_4fJpSQRIlWsiki | 1782285917523 | 2ba4881420fa11f19e9c38a74640adcc | ragflow-JgnarFSCUiV99oOvvMDei7ZzZg1cVlqGd1AMHrHeKE4 | 1782285917523 | +----------------------------------+---------------+----------------------------------+-----------------------------------------------------+---------------+ RAGFlow(api/default)> create key; SUCCESS RAGFlow(api/default)> drop key 'ragflow-aA4R7AuUD158yh2LDh7IDBiqwOKFDKeTwUSQSLVdPdM'; SUCCESS ``` --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -827,25 +827,6 @@ func (c *CLI) RunSingleCommand(command *string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyAuth verifies authentication if needed
|
||||
func (c *CLI) NewVerifyAuth(username, password *string) error {
|
||||
// Otherwise, use username/password authentication
|
||||
if username == nil {
|
||||
return fmt.Errorf("username is required")
|
||||
}
|
||||
|
||||
if password == nil {
|
||||
return fmt.Errorf("password is required")
|
||||
}
|
||||
|
||||
// Create login command with username and password
|
||||
cmd := NewCommand("login_user")
|
||||
cmd.Params["email"] = *username
|
||||
cmd.Params["password"] = *password
|
||||
_, err := c.ExecuteCommand(cmd)
|
||||
return err
|
||||
}
|
||||
|
||||
// VerifyAuth verifies authentication if needed
|
||||
func (c *CLI) VerifyAuth(username, password string) error {
|
||||
// Otherwise, use username/password authentication
|
||||
@@ -858,10 +839,11 @@ func (c *CLI) VerifyAuth(username, password string) error {
|
||||
}
|
||||
|
||||
// Create login command with username and password
|
||||
cmd := NewCommand("login_user")
|
||||
cmd := NewCommand("login_user_on_startup")
|
||||
cmd.Params["email"] = username
|
||||
cmd.Params["password"] = password
|
||||
_, err := c.ExecuteCommand(cmd)
|
||||
|
||||
_, err := c.LoginUserByCommand(cmd)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user