mirror of
https://github.com/mudler/LocalAI
synced 2026-05-24 09:28:23 +00:00
The Go-side incremental JSON parser was emitting the same tool call on
every streaming token because it lacked the len > lastEmittedCount guard
that the XML parser had. On top of that, the post-streaming default:
case re-emitted all tool calls from index 0, duplicating everything.
This produced duplicate delta.tool_calls events causing clients to
accumulate arguments as "{args}{args}" — invalid JSON.
Fixes:
- JSON incremental parser: add len(jsonResults) > lastEmittedCount guard
and loop from lastEmittedCount (matching the XML parser pattern)
- Post-streaming default: case: skip i < lastEmittedCount entries that
were already emitted during streaming
- JSON parser: use blocking channel send (matching XML parser behavior)
|
||
|---|---|---|
| .. | ||
| types | ||
| chat.go | ||
| chat_test.go | ||
| completion.go | ||
| constants.go | ||
| edit.go | ||
| embeddings.go | ||
| image.go | ||
| image_test.go | ||
| inference.go | ||
| inference_test.go | ||
| inpainting.go | ||
| inpainting_test.go | ||
| list.go | ||
| openai_suite_test.go | ||
| realtime.go | ||
| realtime_model.go | ||
| realtime_transport.go | ||
| realtime_transport_webrtc.go | ||
| realtime_transport_ws.go | ||
| realtime_webrtc.go | ||
| transcription.go | ||