From 8d320f0e410f95d9f84539e8b6e8a8a41768fda1 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 1 Jan 2025 16:55:11 +0800 Subject: [PATCH] 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. --- neo/assistant/assistant.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/neo/assistant/assistant.go b/neo/assistant/assistant.go index 1a85867a..9f2f92ad 100644 --- a/neo/assistant/assistant.go +++ b/neo/assistant/assistant.go @@ -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