Merge pull request #821 from trheyi/main

Enhance Neo API assistant with improved error handling and message st…
This commit is contained in:
Max 2025-01-18 15:02:30 +08:00 committed by GitHub
commit 883dd07fb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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,