Merge pull request #821 from trheyi/main
Enhance Neo API assistant with improved error handling and message st…
This commit is contained in:
commit
883dd07fb0
2 changed files with 9 additions and 1 deletions
|
|
@ -221,7 +221,9 @@ func (ast *Assistant) call(ctx context.Context, method string, context chatctx.C
|
||||||
// Wait for either context cancellation or method completion
|
// Wait for either context cancellation or method completion
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
scriptCtx.Close() // Force close the script context
|
if scriptCtx != nil {
|
||||||
|
scriptCtx.Close() // Force close the script context
|
||||||
|
}
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
case <-done:
|
case <-done:
|
||||||
return result, callErr
|
return result, callErr
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,12 @@ func (c *Content) String() string {
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"id": c.ID,
|
"id": c.ID,
|
||||||
"type": "function",
|
"type": "function",
|
||||||
|
"text": c.Name,
|
||||||
|
"props": map[string]interface{}{
|
||||||
|
"id": c.ID,
|
||||||
|
"name": c.Name,
|
||||||
|
"arguments": arguments,
|
||||||
|
},
|
||||||
"function": map[string]interface{}{
|
"function": map[string]interface{}{
|
||||||
"name": c.Name,
|
"name": c.Name,
|
||||||
"arguments": arguments,
|
"arguments": arguments,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue