summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-08-08 13:14:06 +0300
committerGrail Finder <wohilas@gmail.com>2025-08-08 13:14:06 +0300
commit972d9cdbffad19efbf2bb05f2f91e31d09120e32 (patch)
tree78a4e9d637489852871882be9a4933ae299ce085
parentc3a5de7a0d2631c8eda71a54cad9587d3d8915e1 (diff)
Enha: get func name from oai tool call
-rw-r--r--bot.go2
-rw-r--r--llm.go4
2 files changed, 5 insertions, 1 deletions
diff --git a/bot.go b/bot.go
index 21fcf25..cc540c7 100644
--- a/bot.go
+++ b/bot.go
@@ -442,7 +442,7 @@ func findCall(msg, toolCall string, tv *tview.TextView) {
// call a func
f, ok := fnMap[fc.Name]
if !ok {
- m := fc.Name + "%s is not implemented"
+ m := fc.Name + " is not implemented"
chatRound(m, cfg.ToolRole, tv, false, false)
return
}
diff --git a/llm.go b/llm.go
index 3c3085f..14caa5c 100644
--- a/llm.go
+++ b/llm.go
@@ -146,6 +146,10 @@ func (op OpenAIer) ParseChunk(data []byte) (*models.TextChunk, error) {
}
if len(llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls) > 0 {
resp.ToolChunk = llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls[0].Function.Arguments
+ fname := llmchunk.Choices[len(llmchunk.Choices)-1].Delta.ToolCalls[0].Function.Name
+ if fname != "" {
+ resp.FuncName = fname
+ }
}
if llmchunk.Choices[len(llmchunk.Choices)-1].FinishReason == "stop" {
if resp.Chunk != "" {