Merge pull request #893 from trheyi/main

Add support for passing arguments in assistant method calls
This commit is contained in:
Max 2025-03-12 17:25:07 +08:00 committed by GitHub
commit e107f7b3c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -247,6 +247,7 @@ func (obj *objectCall) run(info *v8go.FunctionCallbackInfo) *v8go.Value {
chatCtx.AssistantID = assistantID
chatCtx.ChatID = fmt.Sprintf("call_%s", uuid.New().String()) // New chat id
chatCtx.Silent = options.Silent
chatCtx.Args = goArgs // Arguments for call
// Define the callback function
var cb func(msg *chatMessage.Message) = nil

View file

@ -28,6 +28,7 @@ type Context struct {
Upload *FileUpload `json:"upload,omitempty"`
Version bool `json:"version,omitempty"` // Version support
RAG bool `json:"rag,omitempty"` // RAG support
Args []interface{} `json:"args,omitempty"` // Arguments for call
SharedSpace plan.Space `json:"-"` // Shared space
}
@ -125,6 +126,11 @@ func (ctx *Context) Map() map[string]interface{} {
data["retry"] = ctx.Retry
}
// Arguments for call
if ctx.Args != nil && len(ctx.Args) > 0 {
data["args"] = ctx.Args
}
// Retry times
data["retry_times"] = ctx.RetryTimes