Skip to content

Commit

Permalink
Merge pull request #821 from trheyi/main
Browse files Browse the repository at this point in the history
Enhance Neo API assistant with improved error handling and message st…
  • Loading branch information
trheyi authored Jan 18, 2025
2 parents 2726753 + e874e8d commit 883dd07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion neo/assistant/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ func (ast *Assistant) call(ctx context.Context, method string, context chatctx.C
// Wait for either context cancellation or method completion
select {
case <-ctx.Done():
scriptCtx.Close() // Force close the script context
if scriptCtx != nil {
scriptCtx.Close() // Force close the script context
}
return nil, ctx.Err()
case <-done:
return result, callErr
Expand Down
6 changes: 6 additions & 0 deletions neo/message/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ func (c *Content) String() string {
data := map[string]interface{}{
"id": c.ID,
"type": "function",
"text": c.Name,
"props": map[string]interface{}{
"id": c.ID,
"name": c.Name,
"arguments": arguments,
},
"function": map[string]interface{}{
"name": c.Name,
"arguments": arguments,
Expand Down

0 comments on commit 883dd07

Please sign in to comment.