HEX
Server: Apache/2.4.63 (Unix)
System: Linux Synopilou92 4.4.302+ #72806 SMP Mon Jul 21 23:16:00 CST 2025 x86_64
User: pilou92 (1026)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /volume1/@appstore/Spreadsheet/ui/dist/chunk.577.js
"use strict";(globalThis.webpackChunksynoffice_ui=globalThis.webpackChunksynoffice_ui||[]).push([["577"],{75887:function(t,e,n){n.r(e),n.d(e,{getLiteToolDefinitions:()=>u,getCompleteToolDefinitions:()=>l});var o=n(52836),i=n.n(o);let r=Object.entries(i()).map(t=>{let[e,n]=t;return{id:e,name:e,...n}}),s=r.map(t=>{let{name:e,description:n}=t;return{name:e,description:n}}),a=new class{constructor(t){this.options=t,this.map=new Map}addAll(t){for(let e of t)this.add(e)}add(t){this.map.set(t.id,this.getDocumentInfo(t))}search(t){let e=[];for(let n of this.map.values()){let o=n.searchableContent,i=this.match(o,t);i>0&&e.push({score:i,record:this.getStoreContent(n.raw)})}return e.sort((t,e)=>e.score-t.score),e}getFieldContent(t,e){let n=e.split("."),o=t;for(let t of n)o=o[t]??"";return o.toString()}getSearchableContent(t){return this.options.fields.map(e=>this.getFieldContent(t,e)).join(" ")}getStoreContent(t){return this.options.storeFields?Object.fromEntries(this.options.storeFields.map(e=>[e,this.getFieldContent(t,e)])):t}getDocumentInfo(t){return{raw:t,searchableContent:this.getSearchableContent(t)}}splitKeywords(t){return t.split(" ")}match(t,e){let n=t.toLowerCase().split(/[^a-zA-Z0-9]+/),o=new Set(this.splitKeywords(e.toLowerCase()));return n.filter(t=>o.has(t)).length/n.length}}({fields:["name","description","arguments.name","arguments.description","category"],storeFields:["name","description"]});function l(){return[c(!0),h,p]}function u(){return[c(!1),p]}function c(t){let e="You should use this tool to search for functions in Synology Spreadsheet with keywords you provide.";return t&&(e+=" Call this tool function prior to the other tool `listFunctions`."),{type:"function",function:{name:"searchFunctions",description:e,parameters:{type:"object",properties:{keywords:{type:"string",description:"The keywords of the functions you want to search for. Separate multiple keywords with space. Note that the keywords must be in English. If your keywords are not in English, please translate them to English first."}},required:["keywords"],additionalProperties:!1}},implementation:t=>{try{let{keywords:e}=JSON.parse(t);return JSON.stringify(a.search(e).slice(0,20).map(t=>{let{record:{name:e,description:n}}=t;return{name:e,description:n}}))}catch{return`invalid arguments: ${t}`}}}}a.addAll(r);let h={type:"function",function:{name:"listFunctions",description:"You can use this tool to get all supported functions in Synology Spreadsheet. Call this tool only if you have tried the tool `searchFunctions` but cannot found what you need."},implementation:()=>JSON.stringify(s)},p={type:"function",function:{name:"getFunctionDefinition",description:"You can use this tool to get the definition of a function in Synology Spreadsheet. You must call this tool before you are going to suggest functions or generate formula.",parameters:{type:"object",properties:{name:{type:"string",description:"The name of the function you want to get the definition."}},required:["name"],additionalProperties:!1}},implementation:t=>{let e,n="",o="";try{var r;r=n=JSON.parse(t)?.name??"",(e=i()[r])||(o="Function not found")}catch{o=`Invalid arguments: ${t}`}return JSON.stringify(o||!e?{error:o,name:n}:{name:n,...e})}}}}]);