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
This commit is contained in:
hanishkvc 2025-10-20 16:59:32 +05:30
parent 3e0cf2a2df
commit 8ca77e455a
1 changed files with 10 additions and 1 deletions

View File

@ -199,7 +199,16 @@ class ChatMessageEx {
*/ */
update_oneshot(nwo, apiEP) { update_oneshot(nwo, apiEP) {
if (apiEP == ApiEP.Type.Chat) { 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 { } else {
try { try {
this.ns.content = nwo["choices"][0]["text"]; this.ns.content = nwo["choices"][0]["text"];