Merge pull request #893 from trheyi/main
Add support for passing arguments in assistant method calls
This commit is contained in:
commit
e107f7b3c0
2 changed files with 7 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue