@datagrok/compute 1.17.0 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,63 +0,0 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
-
5
- //description: A spreadsheet that lets you interactively edit parameters and evaluate functions
6
- //tags: functionAnalysis
7
- //input: func f
8
- //output: view result
9
- export function _functionParametersGrid(f: DG.Func): DG.View {
10
-
11
- let view = DG.View.create();
12
- let gridHost = ui.div();
13
- let functionName = ui.stringInput('Function', f.name);
14
-
15
- view.root.appendChild(functionName.root);
16
- view.root.appendChild(gridHost);
17
-
18
- function init() {
19
- view.name = f.name;
20
- ui.empty(gridHost);
21
-
22
- let table = DG.DataFrame.fromProperties(f.inputs.concat(f.outputs), 5);
23
- let grid = DG.Grid.create(table);
24
- let calculating: boolean = false;
25
-
26
- function refreshRow(row: number) {
27
- for (let i = 0; i < f.inputs.length; i++)
28
- if (table.columns.byIndex(i).isNone(row))
29
- return;
30
-
31
- let params: any = {};
32
- for (let p of f.inputs)
33
- params[p.name] = table.col(p.name)!.get(row);
34
-
35
- calculating = true;
36
- let call = f.prepare(params);
37
- call.call().then(c => {
38
- for (let p of f.outputs)
39
- table.col(p.name)!.set(row, call.outputs[p.name]);
40
- calculating = false;
41
- });
42
- }
43
-
44
- grid.onCellValueEdited.subscribe(gc => refreshRow(gc.tableRow?.idx!));
45
- gridHost.appendChild(grid.root);
46
- }
47
-
48
- init();
49
- functionName.onChanged(() => {
50
- DG.Func
51
- .findAll({name: functionName.value})
52
- .then(funcs => {
53
- if (funcs.length == 1) {
54
- f = funcs[0];
55
- init();
56
- }
57
- });
58
- // ;
59
- // if (f !== null)
60
- // init();
61
- });
62
- return view;
63
- }
@@ -1,12 +0,0 @@
1
- import * as rxjs from "rxjs";
2
-
3
- export class ImportGeneratorStore {
4
- scriptName: string = '';
5
- description: string = '';
6
- dfSheetsToSeek: string[] = [];
7
- scalarsToSeek: string[] = []
8
-
9
- scriptText = new rxjs.BehaviorSubject('');
10
- infoText = new rxjs.BehaviorSubject('');
11
- lastSavedScriptId = new rxjs.BehaviorSubject('');
12
- }
@@ -1,185 +0,0 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
- import { ImportGeneratorStore } from './store';
5
-
6
- export class ImportScriptGeneratorApp extends DG.ViewBase {
7
- store = new ImportGeneratorStore();
8
- scriptNameInput = ui.stringInput('Script name', '', (v: string) => this.store.scriptName = v);
9
- descriptionInput = ui.stringInput('Description', '', (v: string) => this.store.description = v);
10
-
11
- constructor() {
12
- super();
13
-
14
- const runButton = ui.bigButton('Generate script', async () => await this.generate());
15
- const saveButton = ui.bigButton('Save', async () => await this.save());
16
- const openButton = ui.bigButton('Open', async () => this.open());
17
- openButton.style.display = 'none';
18
-
19
- this.store.lastSavedScriptId.subscribe((newId) => {
20
- if (newId !== '') {
21
- openButton.style.removeProperty('display');
22
- }
23
- })
24
-
25
- const dynamicDFInput = (counter: number) => {
26
- const deleteBtn = ui.button('Remove', () => {});
27
- deleteBtn.style.width = deleteBtn.style.height;
28
- deleteBtn.style.alignSelf = 'center';
29
-
30
- this.store.dfSheetsToSeek.push('');
31
-
32
- const containter = ui.divH([
33
- ui.stringInput(`Sheet name #${counter}`, '', (v: string) => this.store.dfSheetsToSeek[counter] = v).root,
34
- deleteBtn,
35
- ], {style: {'justify-content': 'space-between'}});
36
- deleteBtn.addEventListener('click', () => {
37
- this.store.dfSheetsToSeek.splice(counter, 1);
38
- containter.remove();
39
- });
40
-
41
- return containter;
42
- }
43
-
44
- const dynamicScalarInput = (counter: number) => {
45
- const deleteBtn = ui.button('Remove', () => {});
46
- deleteBtn.style.width = deleteBtn.style.height;
47
- deleteBtn.style.alignSelf = 'center';
48
-
49
- this.store.scalarsToSeek.push('');
50
-
51
- const containter = ui.divH([
52
- ui.stringInput(`Scalar name #${counter}`, '', (v: string) => this.store.scalarsToSeek[counter] = v).root,
53
- deleteBtn,
54
- ], {style: {'justify-content': 'space-between'}});
55
- deleteBtn.addEventListener('click', () => {
56
- this.store.scalarsToSeek.splice(counter, 1);
57
- containter.remove();
58
- });
59
-
60
- return containter;
61
- }
62
-
63
- const dfInputsDiv = ui.divV([]);
64
- const dfInputAddBtn = ui.button('Add DF to search', () => {
65
- dfInputsDiv.append(dynamicDFInput(this.store.dfSheetsToSeek.length))
66
- });
67
-
68
- const scalarsInputsDiv = ui.divV([]);
69
- const scalarsInputAddBtn = ui.button('Add scalar to search', () => {
70
- scalarsInputsDiv.append(dynamicScalarInput(this.store.scalarsToSeek.length))
71
- });
72
-
73
- const formDiv = ui.divV([
74
- ui.h3('Script properties'),
75
- this.scriptNameInput.root,
76
- this.descriptionInput.root,
77
- ui.h3('Dataframes to search'),
78
- dfInputsDiv,
79
- dfInputAddBtn,
80
- ui.h3('Scalars to search'),
81
- scalarsInputsDiv,
82
- scalarsInputAddBtn,
83
- ui.divH([runButton], {style: {'justify-content': 'flex-end'}})
84
- ], 'ui-form');
85
-
86
- let scriptDiv = ui.divText(this.store.scriptText.value);
87
- let infoDiv = ui.info(this.store.infoText.value);
88
-
89
- const outputDiv = ui.panel([
90
- ui.h3('Script text'),
91
- scriptDiv,
92
- infoDiv,
93
- ui.divH([saveButton, openButton], {style: {'justify-content': 'flex-end'}})
94
- ], {style: {display: 'none'}})
95
- this.store.scriptText.subscribe((newScriptText) => {
96
- const newScriptDiv = ui.divText(newScriptText);
97
- scriptDiv.replaceWith(newScriptDiv);
98
- scriptDiv = newScriptDiv;
99
-
100
- if (newScriptText !== '') outputDiv.style.removeProperty('display');
101
- })
102
- this.store.infoText.subscribe((newInfoText) => {
103
- const newInfoDiv = (newInfoText === '') ? ui.div([]) : ui.info(newInfoText);
104
- infoDiv.replaceWith(newInfoDiv);
105
- infoDiv = newInfoDiv;
106
- })
107
-
108
- this.root.appendChild(ui.splitH([formDiv, outputDiv], {style: {height: '100%', width: '100%'}}, true));
109
-
110
- ui.tools.handleResize(formDiv.parentElement!, (width) => {
111
- if (width < 350)
112
- formDiv.classList.add('ui-form-condensed');
113
- else
114
- formDiv.classList.remove('ui-form-condensed');
115
- });
116
- formDiv.parentElement!.style.maxWidth = '340px';
117
- }
118
-
119
- async generate() {
120
- const dfOutputsLines = this.store.dfSheetsToSeek.map((dfName) => `//output: dataframe ${dfName.trim()} { viewer: Grid(); }`).join("\n");
121
- const scalarsLines = this.store.scalarsToSeek.map((scalarName) => `//output: string ${scalarName.trim()}`).join("\n");
122
-
123
- const fileParsingCode =
124
- `
125
- const wb = new ExcelJS.Workbook();
126
- await wb.xlsx.load(await uploadedFile.arrayBuffer());
127
- const dfSheetsToSeek = ["${this.store.dfSheetsToSeek.join(`","`)}"];`
128
-
129
- const dfParsingCode = (dfName: string) =>
130
- `
131
- const ${dfName}_ws = wb.getWorksheet("${dfName}");
132
- let ${dfName}_data = await ${dfName}_ws.workbook.csv.writeBuffer();
133
- ${dfName} = grok.data.parseCsv(${dfName}_data.toString());`
134
-
135
- const getAllScalars = () =>
136
- `
137
- const scalarSheets = wb.worksheets.filter(ws => !dfSheetsToSeek.includes(ws.name));
138
- const scalarNames = scalarSheets.flatMap((sheet) => sheet.getColumn(1).values);
139
- const scalarValues = scalarSheets.flatMap((sheet) => sheet.getColumn(2).values);`
140
-
141
- const scalarParsingCode = (searchName: string) =>
142
- `
143
- const ${searchName}_index = scalarNames.findIndex((scalarName) => scalarName === "${searchName}");
144
- ${searchName} = (${searchName}_index >= 0) ? scalarValues[${searchName}_index] : '';`
145
-
146
- let scriptText = `//name: ${this.store.scriptName}` + "\n";
147
- scriptText += `//description: ${this.store.description}` + "\n";
148
- scriptText += `//language: javascript` + "\n";
149
- scriptText += `//input: file uploadedFile` + "\n";
150
- scriptText += scalarsLines + "\n";
151
- scriptText += dfOutputsLines + "\n";
152
- scriptText += `//editor: Compute:FunctionViewEditor` + "\n";
153
- scriptText += fileParsingCode + "\n";
154
-
155
- this.store.dfSheetsToSeek.forEach((dfName) => {
156
- scriptText += dfParsingCode(dfName.trim()) + "\n";
157
- });
158
-
159
- scriptText += getAllScalars();
160
-
161
- this.store.scalarsToSeek.forEach((scalarName) => {
162
- scriptText += scalarParsingCode(scalarName) + "\n";
163
- })
164
-
165
- this.store.scriptText.next(scriptText);
166
-
167
- const duplicates = await grok.dapi.scripts.filter(`name="${this.store.scriptName}"`).list();
168
- if (duplicates.length > 0){
169
- this.store.infoText.next(`Script named "${this.store.scriptName}" already exists`);
170
- }else {
171
- this.store.infoText.next(``);
172
- }
173
- }
174
-
175
- async save() {
176
- const resultScript = DG.Script.create(this.store.scriptText.value);
177
- const savedScript = await grok.dapi.scripts.save(resultScript);
178
- this.store.lastSavedScriptId.next(savedScript.id);
179
- grok.shell.info(`Script "${this.store.scriptName}" has been saved successfully`)
180
- }
181
-
182
- open() {
183
- window.open(`${window.location.origin}/script/${this.store.lastSavedScriptId.value}`)
184
- }
185
- }
@@ -1,84 +0,0 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
- import * as rxjs from "rxjs";
5
- import {ModelHandler} from './model-handler';
6
-
7
- /* eslint-disable */
8
-
9
- let propsSub: rxjs.Subscription;
10
-
11
- export class ModelCatalogView extends DG.CustomCardView {
12
-
13
- constructor() {
14
- super({dataSource: grok.dapi.functions, permanentFilter: '#model'});
15
-
16
- this.root.classList.add('model-catalog-view');
17
- this.meta = new ModelHandler();
18
- this.name = 'Models';
19
- this.permanentFilter = '#model';
20
- this.renderMode = DG.RENDER_MODE.BRIEF;
21
-
22
- this.objectType = 'Func';
23
- this.categoryFilters = {
24
- 'options.department': 'Department',
25
- 'options.HL_process': 'HL_process',
26
- 'options.process': 'Process',
27
- 'tag': 'Tags'
28
- };
29
-
30
- this.filters = {
31
- 'All': '',
32
- 'Favorites': 'starredBy = @current',
33
- 'Used by me': 'usedBy = @current'
34
- };
35
-
36
- this.hierarchy = [
37
- 'options.department',
38
- 'options.HL_process',
39
- 'options.process'
40
- ];
41
-
42
- this.hierarchyProperties = {
43
- 'options.department': 'Department',
44
- 'options.HL_process': 'HL_process',
45
- 'options.process': 'Process'
46
- };
47
-
48
- this.showTree = true;
49
- this.initRibbon();
50
- this.initMenu();
51
- this.currentCall = grok.functions.getCurrentCall();
52
- if (propsSub == null && window.localStorage.getItem('ModelCatalogShowProperties') == null) { // @ts-ignore
53
- propsSub = grok.events.onCurrentObjectChanged.subscribe((o) => {
54
- if (new ModelHandler().isApplicable(o.sender)) {
55
- grok.shell.windows.showProperties = true;
56
- window.localStorage.setItem('ModelCatalogShowProperties', 'false');
57
- propsSub.unsubscribe();
58
- }
59
- })
60
- }
61
- grok.shell.windows.showHelp = false;
62
- }
63
-
64
- currentCall: DG.FuncCall;
65
-
66
- initRibbon() {
67
- this.setRibbonPanels([[ui.icons.sync(() => this.refresh())]]);
68
- }
69
-
70
- initMenu() {
71
- this.ribbonMenu
72
- .group('Help')
73
- .item('Compute Engine', () => window.open('https://github.com/datagrok-ai/public/tree/master/packages/Compute', '_blank'))
74
- .item('Developing Models', () => window.open('https://datagrok.ai/help/compute/scripting', '_blank'))
75
- .endGroup();
76
- }
77
-
78
- setCurrentModel(model: DG.Script) {
79
- let modelView = DG.View.forObject(model)!;
80
- let host: HTMLDivElement = this.root.querySelector('.grok-gallery-grid')! as HTMLDivElement;
81
- ui.empty(host);
82
- host.appendChild(modelView.root);
83
- }
84
- }
@@ -1,261 +0,0 @@
1
- import * as grok from 'datagrok-api/grok';
2
- import * as ui from 'datagrok-api/ui';
3
- import * as DG from 'datagrok-api/dg';
4
- import wu from "wu";
5
- import {ModelCatalogView} from "./model-catalog-view";
6
-
7
- function addPopover(popover: HTMLElement) {
8
- stylePopover(popover);
9
- document.body.append(popover);
10
- }
11
-
12
- function displayPopover(icon: HTMLElement, popover: HTMLElement) {
13
- alignPopover(icon, popover);
14
- popover.showPopover();
15
- }
16
-
17
- function alignPopover(target: HTMLElement, popover: HTMLElement): void {
18
- const bounds = target.getBoundingClientRect().toJSON();
19
- popover.style.inset = 'unset';
20
- popover.style.top = bounds.y + 'px';
21
- popover.style.left = (bounds.x + 20) + 'px';
22
- }
23
-
24
- function stylePopover(popover: HTMLElement): void {
25
- popover.popover = 'auto';
26
- popover.style.cursor = 'default';
27
- popover.style.padding = '10px';
28
- popover.style.background = '#fdffe5';
29
- popover.style.border = '1px solid #E4E6CE';
30
- popover.style.borderRadius = '2px';
31
- popover.style.boxShadow = '0 0 5px #E4E6CE';
32
- popover.style.maxWidth = '500px';
33
- popover.style.color = 'var(--gray-6)';
34
- }
35
-
36
- function requestMembership(groupName: string) {
37
- return async () => {
38
- try {
39
- const groups = await grok.dapi.groups.filter(`friendlyName="${groupName}"`).list();
40
- if (groups.length === 0) {
41
- throw new Error(`group with specified name is not found`);
42
- }
43
- if (groups.length > 1) {
44
- throw new Error(`found more than one group with specified name`);
45
- }
46
- const group = groups[0];
47
-
48
- // Workaround till JS API is not ready: https://reddata.atlassian.net/browse/GROK-14160
49
- fetch(`${window.location.origin}/api/groups/${group.id}/requests/${grok.shell.user.group.id}`, {method: "POST"})
50
- } catch (e: any) {
51
- grok.shell.error(e.toString());
52
- }
53
- }
54
- }
55
-
56
- export class ModelHandler extends DG.ObjectHandler {
57
- userGroups = [] as DG.Group[];
58
-
59
- get type() {
60
- return 'Model';
61
- }
62
-
63
- async getById(id: string): Promise<DG.Func> {
64
- return await grok.dapi.functions.find(id);
65
- }
66
-
67
- async refresh(x: DG.Script): Promise<DG.Func> {
68
- return await this.getById(x.id);
69
- }
70
-
71
- getLanguageIcon(language: string) {
72
- if (language == 'grok')
73
- return ui.iconSvg('project');
74
- return ui.iconImage('script', `/images/entities/${language}.png`);
75
- }
76
-
77
- // Checks whether this is the handler for [x]
78
- isApplicable(x: any) {
79
- return x instanceof DG.Func && x.hasTag('model');
80
- }
81
-
82
- renderIcon(x: DG.Func, context: any = null): HTMLElement {
83
- if (x.options['icon'] != null && (x.options['icon'].startsWith('http://') || x.options['icon'].startsWith('https://'))) {
84
- return ui.iconImage('model-icon', x.options['icon']);
85
- }
86
- if (x instanceof DG.Script) {
87
- return this.getLanguageIcon(x.language);
88
- }
89
- x = DG.Func.find({package: x.package.name, name: x.name})[0];
90
- let iconUrl = x.package.getIconUrl();
91
- if (x.options['icon'] != null) {
92
- let packagePathSegments = iconUrl.split('/');
93
- packagePathSegments.pop();
94
- packagePathSegments.push(x.options['icon']);
95
- iconUrl = packagePathSegments.join('/')
96
- }
97
- return ui.iconImage(x.package.name, iconUrl);
98
- }
99
-
100
- renderMarkup(x: DG.Func): HTMLElement {
101
- const mandatoryUserGroups = JSON.parse(x.options['mandatoryUserGroups'] ? `${x.options['mandatoryUserGroups']}` : '[]') as {name: string, help?: string}[];
102
- const hasMissingMandatoryGroups = mandatoryUserGroups.filter((group) => !this.userGroups.map((userGroup) => userGroup.friendlyName).includes(group.name)).length > 0;
103
- const mandatoryGroupsIcon = ui.iconFA('exclamation-triangle', null);
104
- mandatoryGroupsIcon.classList.remove('grok-icon');
105
-
106
- const getBulletIcon = () => {
107
- const bulletIcon = ui.iconFA('times');
108
- bulletIcon.style.marginRight = '6px';
109
- bulletIcon.classList.remove('grok-icon');
110
- return bulletIcon;
111
- }
112
-
113
- const mandatoryGroupsInfo = ui.div(ui.divV([
114
- ui.label('You should be a member of the following group(s):', {style: {marginLeft: '0px'}}),
115
- ...mandatoryUserGroups.map((group) => ui.divV([
116
- ui.span([getBulletIcon(), group.name], {style: {'font-weight': 600}}),
117
- ...group.help ? [ui.span([group.help], {style: {marginLeft: '16px'}})]: [],
118
- ui.link(`Request group membership`, requestMembership(group.name), undefined, {style: {marginLeft: '16px'}})
119
- ])),
120
- ], {style: {gap: '10px'}})) as HTMLElement;
121
-
122
- if (hasMissingMandatoryGroups) {
123
- addPopover(mandatoryGroupsInfo);
124
-
125
- mandatoryGroupsIcon.addEventListener('click', () => {
126
- displayPopover(mandatoryGroupsIcon, mandatoryGroupsInfo)
127
- })
128
- mandatoryGroupsIcon.addEventListener('mouseover', (e) => {
129
- e.stopPropagation();
130
- })
131
- }
132
-
133
- const label = ui.span([
134
- this.renderIcon(x),
135
- ui.label(x.friendlyName)
136
- ]);
137
- const markup = ui.divH([
138
- label,
139
- ...hasMissingMandatoryGroups ? [ui.span([mandatoryGroupsIcon])]: [],
140
- ], {style: {'justify-content': 'space-between', 'width': '100%'}})
141
-
142
- if (!hasMissingMandatoryGroups) {
143
- markup.ondblclick = () => { ModelHandler.openModel(x); }
144
- markup.onclick = () => { ModelHandler.openHelp(x); }
145
- } else {
146
- label.classList.add('d4-disabled');
147
- }
148
-
149
- return markup;
150
- }
151
-
152
- async renderPreview(x: DG.Func) {
153
- const editorName = x.options.editor ?? 'Compute:RichFunctionViewEditor';
154
- const editor = await grok.functions.find(editorName);
155
- if (editor !== null && editor instanceof DG.Func) {
156
- const viewCall = editor.prepare({'call': x.prepare()});
157
- await viewCall.call(false, undefined, {processed: true});
158
- const view = viewCall.getOutputParamValue();
159
- if (view instanceof DG.View)
160
- return view;
161
- }
162
- //@ts-ignore
163
- return super.renderPreview(x);
164
- }
165
-
166
- renderProperties(func: DG.Func) {
167
- const a = ui.accordion('ComputeModel');
168
- a.context = func;
169
- let titleDiv = ui.div([
170
- ui.span([this.renderIcon(func), ui.label(func.friendlyName), ui.contextActions(func), ui.star(func.id)])]);
171
- a.addTitle(titleDiv);
172
-
173
- if (func.description != null)
174
- titleDiv.appendChild(ui.div([ui.markdown(func.description)], 'model-catalog-description'));
175
- titleDiv.appendChild(ui.tags(func));
176
- if ( func.options['dev.status'] != null)
177
- titleDiv.appendChild(ui.tableFromMap({Status: func.options['dev.status']}));
178
-
179
- a.end();
180
- return a.root;
181
- }
182
-
183
- renderTooltip(x: DG.Func) {
184
- let h = ui.span([this.renderIcon(x), ui.label(x.friendlyName)]);
185
- h.classList.add('d4-link-label');
186
- let card = ui.bind(x, ui.divV([
187
- ui.h2(h),
188
- ui.divV([ui.divText(x.description, 'ui-description')], {style: {lineHeight: '150%'}})
189
- ]));
190
- return card;
191
- }
192
-
193
- renderCard(x: DG.Func, context?: any): HTMLElement {
194
- let h = this.renderMarkup(x);
195
- h.classList.add('d4-link-label');
196
- let card = ui.bind(x, ui.h2(h));
197
- return card;
198
- }
199
-
200
- static async openHelp(func: DG.Func) {
201
- if (func.options['readme'] != null) {
202
- const path = `System:AppData/${func.package.name}/${func.options['readme']}`;
203
- const readmeText = await grok.dapi.files.readAsText(path);
204
-
205
- grok.shell.windows.help.showHelp(ui.markdown(readmeText));
206
- grok.shell.windows.showHelp = true;
207
- }
208
- }
209
-
210
- static getModelCatalogView(): ModelCatalogView {
211
- let modelsView = this.findModelCatalogView();
212
- if (modelsView == null) {
213
- let mc: DG.Func = DG.Func.find({package:'Compute', name: 'ModelCatalog'})[0];
214
- let fc = mc.prepare();
215
- let view = new ModelCatalogView();
216
- view.name = 'Models';
217
- view.parentCall = fc;
218
- grok.shell.addView(view);
219
- }
220
- modelsView = this.findModelCatalogView();
221
- return modelsView as ModelCatalogView;
222
- }
223
-
224
- static findModelCatalogView(): ModelCatalogView | undefined {
225
- return wu(grok.shell.views).find((v) => v.parentCall?.func.name == 'modelCatalog') as ModelCatalogView;
226
- }
227
-
228
- static openModel(x: DG.Func) {
229
- let fc = x.prepare();
230
- fc.edit();
231
- }
232
-
233
- static openModelFromFunccall(funcCall: DG.FuncCall) {
234
- funcCall.edit();
235
- }
236
-
237
- static bindModel(fc: DG.FuncCall) {
238
- let modelsView = ModelHandler.getModelCatalogView();
239
- fc.aux['showOnTaskBar'] = false;
240
- if (modelsView != null) {
241
- let parentCall = modelsView.parentCall;
242
- if (parentCall != null) {
243
- parentCall.aux['view'] = modelsView;
244
- fc.parentCall = parentCall;
245
- }
246
- }
247
- }
248
-
249
- init() {
250
- setTimeout(async () => {
251
- // Workaround till JS API is not ready: https://reddata.atlassian.net/browse/GROK-14159
252
- this.userGroups = (await (await fetch(`${window.location.origin}/api/groups/all_parents`)).json() as DG.Group[]);
253
-
254
- grok.functions.onBeforeRunAction.subscribe((fc) => {
255
- if (fc.func.hasTag('model') || fc.func.hasTag('model-editor')) {
256
- ModelHandler.bindModel(fc);
257
- }
258
- });
259
- });
260
- }
261
- }