SimpleChatTC:ChatMessageEx: send tool_calls, only if needed

This commit is contained in:
hanishkvc 2025-10-15 00:04:29 +05:30
parent 2ef201ff8d
commit 2bb3d747e6
1 changed files with 8 additions and 2 deletions

View File

@ -11,6 +11,7 @@ class Roles {
static System = "system";
static User = "user";
static Assistant = "assistant";
static Tool = "tool";
}
class ApiEP {
@ -286,9 +287,14 @@ class SimpleChat {
*/
recent_chat_ns(iRecentUserMsgCnt) {
let xchat = this.recent_chat(iRecentUserMsgCnt);
let chat = []
let chat = [];
for (const msg of xchat) {
chat.push(msg.ns)
let tmsg = ChatMessageEx.newFrom(msg);
if (!tmsg.has_toolcall()) {
// @ts-ignore
delete(tmsg.ns.tool_calls)
}
chat.push(tmsg.ns);
}
return chat
}