mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-06 11:28:38 +08:00
Go CLI: admin list providers (#16243)
### What problem does this PR solve? ``` RAGFlow(admin)> list providers; +----------------------+-------------------------------------------------------------+ | command | error | +----------------------+-------------------------------------------------------------+ | list_model_providers | 'list model providers' is implemented in enterprise edition | +----------------------+-------------------------------------------------------------+ RAGFlow(admin)> add provider 'zhipu-ai'; +-------------+-----------------------------------------------------------+ | field | value | +-------------+-----------------------------------------------------------+ | command | add_model_provider | | error | 'add model provider' is implemented in enterprise edition | | provider_id | admin | | user_id | zhipu-ai | +-------------+-----------------------------------------------------------+ RAGFlow(admin)> delete provider 'zhipu-ai'; +-------------+--------------------------------------------------------------+ | field | value | +-------------+--------------------------------------------------------------+ | command | delete_model_provider | | error | 'delete model provider' is implemented in enterprise edition | | provider_id | admin | | user_id | zhipu-ai | +-------------+--------------------------------------------------------------+ RAGFlow(admin)> add provider 'zhipu-ai' instance 'instance1'; +---------------+-----------------------------------------------------------+ | field | value | +---------------+-----------------------------------------------------------+ | command | add_model_instance | | error | 'add model instance' is implemented in enterprise edition | | instance_name | instance1 | | provider_id | zhipu-ai | | user_id | admin | +---------------+-----------------------------------------------------------+ RAGFlow(admin)> delete provider 'zhipu-ai' instance 'test' +-------------+--------------------------------------------------------------+ | field | value | +-------------+--------------------------------------------------------------+ | instances | [test] | | provider_id | zhipu-ai | | user_id | admin | | command | delete_model_provider | | error | 'delete model instance' is implemented in enterprise edition | +-------------+--------------------------------------------------------------+ RAGFlow(admin)> add provider 'zhipu-ai' instance 'instance1' model 'xxx'; +---------------+--------------------------------------------------+ | field | value | +---------------+--------------------------------------------------+ | command | add_model | | error | 'add model' is implemented in enterprise edition | | instance_name | instance1 | | model_names | [xxx] | | provider_id | zhipu-ai | | user_id | admin | +---------------+--------------------------------------------------+ RAGFlow(admin)> delete provider 'zhipu-ai' instance 'test' model 'xxx'; +---------------+------------------------------------------------------+ | field | value | +---------------+------------------------------------------------------+ | command | delete_model_provider | | error | 'delete models' is implemented in enterprise edition | | instance_name | test | | models | [xxx] | | provider_id | zhipu-ai | | user_id | admin | +---------------+------------------------------------------------------+ ``` ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -736,7 +736,6 @@ func (p *Parser) parseCreateModelProvider() (*Command, error) {
|
||||
|
||||
// parseAddProvider parses ADD PROVIDER commands
|
||||
// ADD PROVIDER <name>
|
||||
// ADD PROVIDER <name> <api_key>
|
||||
func (p *Parser) parseAddProvider() (*Command, error) {
|
||||
p.nextToken() // consume PROVIDER
|
||||
|
||||
@@ -750,16 +749,6 @@ func (p *Parser) parseAddProvider() (*Command, error) {
|
||||
|
||||
p.nextToken()
|
||||
|
||||
// Check if api_key is provided (optional)
|
||||
if p.curToken.Type == TokenQuotedString {
|
||||
apiKey, err := p.parseQuotedString()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("expected api key: %w", err)
|
||||
}
|
||||
cmd.Params["api_key"] = apiKey
|
||||
p.nextToken()
|
||||
}
|
||||
|
||||
// Semicolon is optional
|
||||
if p.curToken.Type == TokenSemicolon {
|
||||
p.nextToken()
|
||||
|
||||
Reference in New Issue
Block a user