@@ -43,14 +43,15 @@ function bearer_transform() {
4343 * * with a predefined query token and value wrt a predefined path
4444 * NOTE: Initial go, handles textual data type.
4545 * ALERT: Accesses a seperate/external web proxy/caching server, be aware and careful
46+ * @param {string } chatid
4647 * @param {string } toolcallid
4748 * @param {string } toolname
4849 * @param {any } obj
4950 * @param {string } path
5051 * @param {string } qkey
5152 * @param {string } qvalue
5253 */
53- async function proxyserver_get_1arg ( toolcallid , toolname , obj , path , qkey , qvalue ) {
54+ async function proxyserver_get_1arg ( chatid , toolcallid , toolname , obj , path , qkey , qvalue ) {
5455 if ( gToolsWorker . onmessage != null ) {
5556 let newUrl = `${ get_gme ( ) . tools . proxyUrl } /${ path } ?${ qkey } =${ qvalue } `
5657 let btoken = await bearer_transform ( )
@@ -60,9 +61,9 @@ async function proxyserver_get_1arg(toolcallid, toolname, obj, path, qkey, qvalu
6061 }
6162 return resp . text ( )
6263 } ) . then ( data => {
63- message_toolsworker ( new MessageEvent ( 'message' , { data : { id : toolcallid , name : toolname , data : data } } ) )
64+ message_toolsworker ( new MessageEvent ( 'message' , { data : { cid : chatid , tcid : toolcallid , name : toolname , data : data } } ) )
6465 } ) . catch ( ( err ) => {
65- message_toolsworker ( new MessageEvent ( 'message' , { data : { id : toolcallid , name : toolname , data : `Error:${ err } ` } } ) )
66+ message_toolsworker ( new MessageEvent ( 'message' , { data : { cid : chatid , tcid : toolcallid , name : toolname , data : `Error:${ err } ` } } ) )
6667 } )
6768 }
6869}
@@ -122,12 +123,13 @@ let fetchweburlraw_meta = {
122123 * * with a query token named url wrt the path urlraw
123124 * which gives the actual url to fetch
124125 * ALERT: Accesses a seperate/external web proxy/caching server, be aware and careful
126+ * @param {string } chatid
125127 * @param {string } toolcallid
126128 * @param {string } toolname
127129 * @param {any } obj
128130 */
129- function fetchweburlraw_run ( toolcallid , toolname , obj ) {
130- return proxyserver_get_1arg ( toolcallid , toolname , obj , 'urlraw' , 'url' , encodeURIComponent ( obj . url ) ) ;
131+ function fetchweburlraw_run ( chatid , toolcallid , toolname , obj ) {
132+ return proxyserver_get_1arg ( chatid , toolcallid , toolname , obj , 'urlraw' , 'url' , encodeURIComponent ( obj . url ) ) ;
131133}
132134
133135
@@ -179,12 +181,13 @@ let fetchweburltext_meta = {
179181 * * strips out head as well as any script, style, header, footer, nav and so blocks in body
180182 * before returning remaining body contents.
181183 * ALERT: Accesses a seperate/external web proxy/caching server, be aware and careful
184+ * @param {string } chatid
182185 * @param {string } toolcallid
183186 * @param {string } toolname
184187 * @param {any } obj
185188 */
186- function fetchweburltext_run ( toolcallid , toolname , obj ) {
187- return proxyserver_get_1arg ( toolcallid , toolname , obj , 'urltext' , 'url' , encodeURIComponent ( obj . url ) ) ;
189+ function fetchweburltext_run ( chatid , toolcallid , toolname , obj ) {
190+ return proxyserver_get_1arg ( chatid , toolcallid , toolname , obj , 'urltext' , 'url' , encodeURIComponent ( obj . url ) ) ;
188191}
189192
190193
@@ -237,16 +240,17 @@ let searchwebtext_meta = {
237240 * * strips out head as well as any script, style, header, footer, nav and so blocks in body
238241 * before returning remaining body contents.
239242 * ALERT: Accesses a seperate/external web proxy/caching server, be aware and careful
243+ * @param {string } chatid
240244 * @param {string } toolcallid
241245 * @param {string } toolname
242246 * @param {any } obj
243247 */
244- function searchwebtext_run ( toolcallid , toolname , obj ) {
248+ function searchwebtext_run ( chatid , toolcallid , toolname , obj ) {
245249 if ( gToolsWorker . onmessage != null ) {
246250 /** @type {string } */
247251 let searchUrl = get_gme ( ) . tools . searchUrl ;
248252 searchUrl = searchUrl . replace ( "SEARCHWORDS" , encodeURIComponent ( obj . words ) ) ;
249- return proxyserver_get_1arg ( toolcallid , toolname , obj , 'urltext' , 'url' , encodeURIComponent ( searchUrl ) ) ;
253+ return proxyserver_get_1arg ( chatid , toolcallid , toolname , obj , 'urltext' , 'url' , encodeURIComponent ( searchUrl ) ) ;
250254 }
251255}
252256
0 commit comments