From b9c89127b6686f33f7694b0654329f2fdcdc5391 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 26 Jan 2025 17:03:06 +0800 Subject: [PATCH] Revert "Add RAG and Version support to Assistant context and options" --- neo/assistant/api.go | 7 +------ neo/assistant/hooks.go | 2 +- neo/context/context.go | 6 +----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/neo/assistant/api.go b/neo/assistant/api.go index 21ab6b14..0c63e8a0 100644 --- a/neo/assistant/api.go +++ b/neo/assistant/api.go @@ -54,10 +54,6 @@ func (ast *Assistant) Execute(c *gin.Context, ctx chatctx.Context, input string, contents := chatMessage.NewContents() options = ast.withOptions(options) - // Add RAG and Version support - ctx.RAG = rag != nil - ctx.Version = ast.vision - // Run init hook res, err := ast.HookInit(c, ctx, messages, options, contents) if err != nil { @@ -374,7 +370,6 @@ func (ast *Assistant) withOptions(options map[string]interface{}) map[string]int options = map[string]interface{}{} } - // Add Custom Options if ast.Options != nil { for key, value := range ast.Options { options[key] = value @@ -382,7 +377,7 @@ func (ast *Assistant) withOptions(options map[string]interface{}) map[string]int } // Add functions - if ast.Functions != nil && len(ast.Functions) > 0 { + if ast.Functions != nil { options["tools"] = ast.Functions if options["tool_choice"] == nil { options["tool_choice"] = "auto" diff --git a/neo/assistant/hooks.go b/neo/assistant/hooks.go index 97de8222..fa8171cd 100644 --- a/neo/assistant/hooks.go +++ b/neo/assistant/hooks.go @@ -20,7 +20,7 @@ func (ast *Assistant) HookInit(c *gin.Context, context chatctx.Context, input [] ctx, cancel := ast.createTimeoutContext(c) defer cancel() - v, err := ast.call(ctx, "Init", c, contents, context, input, options) + v, err := ast.call(ctx, "Init", c, contents, context, input) if err != nil { if err.Error() == HookErrorMethodNotFound { return nil, nil diff --git a/neo/context/context.go b/neo/context/context.go index 686d3949..da0efd51 100644 --- a/neo/context/context.go +++ b/neo/context/context.go @@ -22,8 +22,6 @@ type Context struct { Config map[string]interface{} `json:"config,omitempty"` Signal interface{} `json:"signal,omitempty"` Upload *FileUpload `json:"upload,omitempty"` - Version bool `json:"version,omitempty"` // Version support - RAG bool `json:"rag,omitempty"` // RAG support } // Field the context field @@ -86,9 +84,7 @@ func WithTimeout(parent Context, timeout time.Duration) (Context, context.Cancel // Map the context to a map func (ctx *Context) Map() map[string]interface{} { data := map[string]interface{}{ - "sid": ctx.Sid, - "rag": ctx.RAG, - "version": ctx.Version, + "sid": ctx.Sid, } if ctx.ChatID != "" {