mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 22:55:45 +08:00
Go: refactor model API to accept model id (#15999)
### What problem does this PR solve? Not not only model_name@instance_name@provider_name is acceptable, but also model_id is acceptable. ### 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:
@@ -18,6 +18,7 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"ragflow/internal/common"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -1301,14 +1302,20 @@ func (p *Parser) parseAdminSetDefault() (*Command, error) {
|
||||
}
|
||||
|
||||
p.nextToken()
|
||||
compositeModelName, err := p.parseQuotedString()
|
||||
modelNameOrID, err := p.parseQuotedString()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd := NewCommand("set_default_model")
|
||||
cmd.Params["model_type"] = modelType
|
||||
cmd.Params["composite_model_name"] = compositeModelName
|
||||
if common.IsCompositeModelName(modelNameOrID) {
|
||||
cmd.Params["composite_model_name"] = modelNameOrID
|
||||
} else if common.IsUUID(modelNameOrID) {
|
||||
cmd.Params["model_id"] = modelNameOrID
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid format of model name or ID: %s", modelNameOrID)
|
||||
}
|
||||
|
||||
p.nextToken()
|
||||
// Semicolon is optional for UNSET TOKEN
|
||||
|
||||
Reference in New Issue
Block a user