Enhance assistant struct with tags and options handling in Neo API
- Added support for initializing assistant tags with a default value of "Built-in" if none are provided, improving data consistency. - Implemented loading of tags, options, and description from the input data map, enhancing the flexibility of assistant configuration. - Updated the LoadBuiltIn and loadMap functions to accommodate new fields, streamlining the assistant loading process.
This commit is contained in:
parent
f8ce8fc193
commit
8d320f0e41
1 changed files with 19 additions and 0 deletions
|
|
@ -61,6 +61,10 @@ func LoadBuiltIn() error {
|
|||
assistant.Readonly = true
|
||||
assistant.BuiltIn = true
|
||||
assistant.Sort = sort
|
||||
if assistant.Tags == nil {
|
||||
assistant.Tags = []string{"Built-in"}
|
||||
}
|
||||
|
||||
sort++
|
||||
loaded.Put(assistant)
|
||||
|
||||
|
|
@ -238,6 +242,21 @@ func loadMap(data map[string]interface{}) (*Assistant, error) {
|
|||
assistant.Connector = connector
|
||||
}
|
||||
|
||||
// tags
|
||||
if v, ok := data["tags"].([]string); ok {
|
||||
assistant.Tags = v
|
||||
}
|
||||
|
||||
// options
|
||||
if v, ok := data["options"].(map[string]interface{}); ok {
|
||||
assistant.Options = v
|
||||
}
|
||||
|
||||
// description
|
||||
if v, ok := data["description"].(string); ok {
|
||||
assistant.Description = v
|
||||
}
|
||||
|
||||
// prompts
|
||||
if v, ok := data["prompts"].(string); ok {
|
||||
var prompts []Prompt
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue