From 8ca77e455a0ae45a3bf0c2ef53ba5d71b68d4d3c Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Mon, 20 Oct 2025 16:59:32 +0530 Subject: [PATCH] SimpleChatTC:NonStreaming: Update oneshot mode wrt tool calls Take care of the possibility of content not being there as well as take care of retrieving the tool calls for further processing. With this tool calls should work in non streaming mode also --- tools/server/public_simplechat/simplechat.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index d1692c3844..eaea16223f 100644 --- a/tools/server/public_simplechat/simplechat.js +++ b/tools/server/public_simplechat/simplechat.js @@ -199,7 +199,16 @@ class ChatMessageEx { */ update_oneshot(nwo, apiEP) { if (apiEP == ApiEP.Type.Chat) { - this.ns.content = nwo["choices"][0]["message"]["content"]; + let curContent = nwo["choices"][0]["message"]["content"]; + if (curContent != undefined) { + if (curContent != null) { + this.ns.content = curContent; + } + } + let curTCs = nwo["choices"][0]["message"]["tool_calls"]; + if (curTCs != undefined) { + this.ns.tool_calls = curTCs; + } } else { try { this.ns.content = nwo["choices"][0]["text"];