SimpleChatTC:ShowToolCall: Trap invalid args generated by GenAi
This commit is contained in:
parent
9f5c3d7776
commit
c0f7c8654e
|
|
@ -665,6 +665,10 @@ sliding window based drop off or even before they kick in, this can help in many
|
|||
* renamed and updated logic wrt xml fetching to be fetch_xml_filtered. allow one to use re to identify
|
||||
the tags to be filtered in a fine grained manner including filtering based on tag heirarchy
|
||||
|
||||
* logic which shows the generated tool call has been updated to trap errors when parsing the function call
|
||||
arguments generated by the ai. This ensures that the chat ui itself doesnt get stuck in it. Instead now
|
||||
the tool call response can inform the ai model that its function call had issues.
|
||||
|
||||
|
||||
#### ToDo
|
||||
|
||||
|
|
|
|||
|
|
@ -891,15 +891,20 @@ class MultiChatUI {
|
|||
let secTC = document.createElement('section')
|
||||
secTC.classList.add('chat-message-toolcall')
|
||||
elParent.append(secTC)
|
||||
let entry = ui.el_create_append_p(`name: ${tc.function.name}`, secTC);
|
||||
entry = ui.el_create_append_p(`id: ${tc.id}`, secTC);
|
||||
let oArgs = JSON.parse(tc.function.arguments)
|
||||
for (const k in oArgs) {
|
||||
entry = ui.el_create_append_p(`arg: ${k}`, secTC);
|
||||
let secArg = document.createElement('section')
|
||||
secArg.classList.add('chat-message-toolcall-arg')
|
||||
secTC.append(secArg)
|
||||
secArg.innerText = oArgs[k]
|
||||
ui.el_create_append_p(`name: ${tc.function.name}`, secTC);
|
||||
let entry = ui.el_create_append_p(`id: ${tc.id}`, secTC);
|
||||
try {
|
||||
let oArgs = JSON.parse(tc.function.arguments)
|
||||
for (const k in oArgs) {
|
||||
entry = ui.el_create_append_p(`arg: ${k}`, secTC);
|
||||
let secArg = document.createElement('section')
|
||||
secArg.classList.add('chat-message-toolcall-arg')
|
||||
secTC.append(secArg)
|
||||
secArg.innerText = oArgs[k]
|
||||
}
|
||||
} catch(exc) {
|
||||
ui.el_create_append_p(`WARN:ShowMsgTCARGS: ${exc}`, secTC);
|
||||
ui.el_create_append_p(`args: ${tc.function.arguments}`, secTC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue