Skip to content

Commit 308e317

Browse files
committed
SimpleChatTC:DataStore:Delete a record - the plumbing side
1 parent 3fda84d commit 308e317

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tools/server/public_simplechat/tooldb.mjs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,38 @@ function dsset_run(chatid, toolcallid, toolname, obj) {
7777
}
7878

7979

80+
let dsdel_meta = {
81+
"type": "function",
82+
"function": {
83+
"name": "data_store_delete",
84+
"description": "Remove the entry associated with a given key, in few seconds using a web worker.",
85+
"parameters": {
86+
"type": "object",
87+
"properties": {
88+
"key": {
89+
"type": "string",
90+
"description": "The key that should be deleted along with its entry."
91+
}
92+
},
93+
"required": ["key"],
94+
}
95+
}
96+
}
97+
98+
99+
/**
100+
* Implementation of the data store delete logic. Minimal skeleton for now.
101+
* NOTE: Has access to the javascript web worker environment and can mess with it and beyond
102+
* @param {string} chatid
103+
* @param {string} toolcallid
104+
* @param {string} toolname
105+
* @param {any} obj
106+
*/
107+
function dsdel_run(chatid, toolcallid, toolname, obj) {
108+
gToolsDBWorker.postMessage({ cid: chatid, tcid: toolcallid, name: toolname, args: obj})
109+
}
110+
111+
80112

81113
/**
82114
* @type {Object<string, Object<string, any>>}
@@ -92,6 +124,11 @@ export let tc_switch = {
92124
"meta": dsset_meta,
93125
"result": ""
94126
},
127+
"data_store_delete": {
128+
"handler": dsdel_run,
129+
"meta": dsdel_meta,
130+
"result": ""
131+
},
95132
}
96133

97134

0 commit comments

Comments
 (0)