Skip to content

Commit 8186d8c

Browse files
committed
SimpleChatTC:DataStore:List keys - the plumbing
1 parent 3135a42 commit 8186d8c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tools/server/public_simplechat/tooldb.mjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,33 @@ function dsdel_run(chatid, toolcallid, toolname, obj) {
109109
}
110110

111111

112+
let dslist_meta = {
113+
"type": "function",
114+
"function": {
115+
"name": "data_store_list",
116+
"description": "List all keys wrt key-value pairs currently stored in the data store. This will take few seconds and uses a web worker.",
117+
"parameters": {
118+
"type": "object",
119+
"properties": {
120+
},
121+
}
122+
}
123+
}
124+
125+
126+
/**
127+
* Implementation of the data store list logic. Minimal skeleton for now.
128+
* NOTE: Has access to the javascript web worker environment and can mess with it and beyond
129+
* @param {string} chatid
130+
* @param {string} toolcallid
131+
* @param {string} toolname
132+
* @param {any} obj
133+
*/
134+
function dslist_run(chatid, toolcallid, toolname, obj) {
135+
gToolsDBWorker.postMessage({ cid: chatid, tcid: toolcallid, name: toolname, args: obj})
136+
}
137+
138+
112139

113140
/**
114141
* @type {Object<string, Object<string, any>>}
@@ -129,6 +156,11 @@ export let tc_switch = {
129156
"meta": dsdel_meta,
130157
"result": ""
131158
},
159+
"data_store_list": {
160+
"handler": dslist_run,
161+
"meta": dslist_meta,
162+
"result": ""
163+
},
132164
}
133165

134166

0 commit comments

Comments
 (0)