SimpleChatTC:DataStore:Eagerness to Wrong JSON conversions

In the eagerness of initial skeleton, had forgotten that the
root/generic tool call router takes care of parsing the json string
into a object, before calling the tool call, so no need to try
parse again. Fixed the same.

Hadnt converted the object based response from data store related
calls in the db web worker, into json string before passing to the
generic tool response callback, fixed the same.

- Rather the though of making the ChatMsgEx.createAllInOne handle
string or object set aside for now, to keep things simple and
consistant to the greatest extent possible across different flows.

And good news - flow is working atleast for the overall happy path
Need to check what corner cases are lurking like calling set on
same key more than once, seemed to have some flow oddity, which I
need to check later.

Also maybe change the field name to value from data in the response
to get, to match the field name convention of set. GPT-OSS is fine
with it. But worst case micro / nano / pico models may trip up, in
worst case, so better to keep things consistent.
This commit is contained in:
hanishkvc 2025-10-30 03:28:07 +05:30
parent 797b702251
commit 4ad88f0da8
3 changed files with 7 additions and 3 deletions

View File

@ -531,6 +531,10 @@ The default Chat UI theme/look changed to help differentiate between different m
history as well as the parts of each message in a slightly better manner. Change the theme slightly
between normal and print views (beyond previous infinite height) for better printed chat history.
Initial skeletons of a builtin data store related tool calls, built on browser's indexedDB, without
needing any proxy / additional helper to handle the store. One could use the ai assistant to store
ones (ie end users) own data or data of ai model.
#### ToDo
Is the tool call promise land trap deep enough, need to think through and explore around this once later.
@ -539,7 +543,7 @@ Trap error responses.
Handle multimodal handshaking with ai models.
Add fetch_rss and documents|data_store tool calling, through the simpleproxy.py if and where needed.
Add fetch_rss and documents|data_store [wip] tool calling, through the simpleproxy.py if and where needed.
Save used config entries along with the auto saved chat sessions and inturn give option to reload the
same when saved chat is loaded.

View File

@ -64,7 +64,7 @@ export function setup(cb) {
cb(ev.data.cid, ev.data.tcid, ev.data.name, ev.data.data)
}
gToolsDBWorker.onmessage = function (ev) {
cb(ev.data.cid, ev.data.tcid, ev.data.name, ev.data.data)
cb(ev.data.cid, ev.data.tcid, ev.data.name, JSON.stringify(ev.data.data))
}
}

View File

@ -42,7 +42,7 @@ self.onmessage = async function (ev) {
let db = await db_open();
let dbTrans = db.transaction('theDB', 'readwrite');
let dbOS = dbTrans.objectStore('theDB');
let args = JSON.parse(ev.data.args);
let args = ev.data.args;
switch (ev.data.name) {
case 'data_store_get':
let reqGet = dbOS.get(args['key'])