odant-work 1.0.93 → 1.0.94
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.
- package/#system/package-manifest.json +620 -651
- package/$server/$folder/$class/$ai/class.js +1 -0
- package/$server/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js +4 -1
- package/$server/$folder/$class/$data/$catalog/$virtual/class.js +1 -0
- package/$server/$folder/$class/$data/$catalog/class.js +1 -0
- package/$server/$folder/$class/$data/$operation/class.js +1 -0
- package/$server/$folder/$class/$data/$register/$account/class.js +1 -0
- package/$server/$folder/$class/$data/$register/class.js +1 -0
- package/$server/$folder/$class/$data/$struct/class.js +1 -0
- package/$server/$folder/$class/$domain/class.js +1 -0
- package/$server/$folder/$class/$module/$mcp/class.js +1 -0
- package/$server/$folder/$class/$module/$provider/class.js +1 -0
- package/$server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js +38 -6
- package/$server/$folder/$class/$module/class.js +1 -0
- package/$server/$folder/$class/$structure/$project/class.js +1 -0
- package/$server/$folder/$class/$structure/$server/class.js +1 -0
- package/$server/$folder/$class/$structure/$user/class.js +2 -0
- package/$server/$folder/$class/$structure/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat-task.js +20 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +23 -17
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +35 -3
- package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +38 -3
- package/$server/$folder/$class/$users/class.js +1 -0
- package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +95 -24
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +22 -4
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +4 -3
- package/$server/$folder/handlers/pages/form/$handler/class.js +81 -7
- package/$server/$folder/lib/explorer/explorer.js +2 -1
- package/$server/$folder/lib/icon/icon.js +2 -2
- package/$server/$folder/lib/node/node.js +3 -11
- package/$server/$folder/lib/prompt-bar/prompt-bar.js +4 -2
- package/$server/$folder/lib/tree/tree.js +12 -1
- package/MODULES//320/224/320/260/320/275/320/275/321/213/320/265/Geo/$module/class.js +1 -0
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/engine/$handler/class.js +445 -0
- package/MODULES//320/243/321/207/321/221/321/202 /320/270 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/321/213/Register/$module/class.js" +1 -0
- package/package.json +1 -1
- package/run.mjs +11 -0
- package/scripts/agent-eval.mjs +1 -1
- package/scripts/migrate-tree.mjs +9 -438
- package/sources/client/class.js +1 -1
- package/sources/host/auto-updater.js +34 -24
- package/sources/host/tree-migration.js +580 -0
- package/sources/host/tree-migration.json +85 -0
- package/sources/modules/agent/index.js +23 -10
- package/sources/modules/agent/session.js +22 -2
- package/sources/modules/agent/tools/meta.js +1 -1
- package/sources/modules/agent/voice.js +6 -2
- package/sources/modules/trainer/dataset.js +6 -4
- package/sources/modules/trainer/halogen.js +9 -9
- package/sources/modules/trainer/huggingface.js +1 -1
- package/sources/modules/trainer/index.js +25 -5
- package/sources/modules/trainer/local-engine.js +17 -11
- package/sources/modules/trainer/runner.js +32 -9
- package/sources/server/class/distro.js +1 -1
- package/sources/server/class.js +8 -0
- package/sources/server/folder.js +9 -2
- package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +0 -4
- package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +0 -4
- package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +0 -4
- package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +0 -4
- package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +0 -4
- package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +0 -4
- package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +0 -4
- package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +0 -4
- package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +0 -4
- package/$server/$folder/$class/$module/$folder/$class/$module/class.js +0 -4
- package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$structure/$project/class.js +0 -4
- package/$server/$folder/$class/$structure/$project/$folder/$class/$structure/class.js +0 -4
- package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +0 -4
- package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +0 -4
|
@@ -28,6 +28,7 @@ export default {
|
|
|
28
28
|
icon: 'carbon:machine-learning-model',
|
|
29
29
|
form: 'system',
|
|
30
30
|
mainTreeChildren: [],
|
|
31
|
+
allowTypes: '',
|
|
31
32
|
/** карточка модели для клиента: попадает в info, читается баром и usage-панелью */
|
|
32
33
|
$public: {
|
|
33
34
|
maxTokens: 4096, // лимит контекста (usage / info)
|
|
@@ -577,7 +577,10 @@ export default {
|
|
|
577
577
|
},
|
|
578
578
|
get providerName() {
|
|
579
579
|
const parts = String(this.info?.path || this.$item?.path || '').split('/').filter(Boolean);
|
|
580
|
-
|
|
580
|
+
const mIdx = parts.indexOf('Модели');
|
|
581
|
+
if (mIdx >= 0 && parts[mIdx + 1]) return parts[mIdx + 1];
|
|
582
|
+
if (parts.length >= 2 && parts[0].toUpperCase() === 'MODELS') return parts[1];
|
|
583
|
+
return parts.length >= 2 ? parts[parts.length - 2] : 'Local';
|
|
581
584
|
},
|
|
582
585
|
get isLocalModel() {
|
|
583
586
|
return String(this.info?.path || this.$item?.path || '').startsWith('/MODULES/Модели/Local/');
|
package/$server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js
CHANGED
|
@@ -201,17 +201,17 @@ export default {
|
|
|
201
201
|
|
|
202
202
|
<div class="field">
|
|
203
203
|
<label>{{state.keyLabel || 'API-ключ'}} <span ~if="state.hasKey" style="color:#16a34a;font-weight:700;">(сохранён: {{state.maskedKey}})</span></label>
|
|
204
|
-
<input type="password" :value="apiKeyInput" :placeholder="state.hasKey ? 'Оставьте пустым, чтобы не менять (' + state.maskedKey + ')' : state.keyPlaceholder" @input="apiKeyInput = $this.value">
|
|
204
|
+
<input type="password" :value="apiKeyInput" :placeholder="state.hasKey ? 'Оставьте пустым, чтобы не менять (' + state.maskedKey + ')' : state.keyPlaceholder" @input="apiKeyInput = $this.value; _notifyForm()">
|
|
205
205
|
</div>
|
|
206
206
|
|
|
207
207
|
<div class="field" ~if="state.needsFolderId">
|
|
208
208
|
<label>ID каталога Yandex Cloud (Folder ID)</label>
|
|
209
|
-
<input :value="folderIdInput" :placeholder="state.folderPlaceholder || 'b1g...'" @input="folderIdInput = $this.value">
|
|
209
|
+
<input :value="folderIdInput" :placeholder="state.folderPlaceholder || 'b1g...'" @input="folderIdInput = $this.value; _notifyForm()">
|
|
210
210
|
</div>
|
|
211
211
|
|
|
212
212
|
<div class="field" ~if="state.protocol === 'gigachat'">
|
|
213
213
|
<label>Scope (версия API GigaChat)</label>
|
|
214
|
-
<select @change="scopeInput = $this.value">
|
|
214
|
+
<select @change="scopeInput = $this.value; _notifyForm()">
|
|
215
215
|
<option value="GIGACHAT_API_PERS" :selected="scopeInput === 'GIGACHAT_API_PERS'">GIGACHAT_API_PERS (Физлица)</option>
|
|
216
216
|
<option value="GIGACHAT_API_B2B" :selected="scopeInput === 'GIGACHAT_API_B2B'">GIGACHAT_API_B2B (ИП / Юрлица по пакетам)</option>
|
|
217
217
|
<option value="GIGACHAT_API_CORP" :selected="scopeInput === 'GIGACHAT_API_CORP'">GIGACHAT_API_CORP (Корпоративный pay-as-you-go)</option>
|
|
@@ -220,12 +220,12 @@ export default {
|
|
|
220
220
|
|
|
221
221
|
<div class="field">
|
|
222
222
|
<label>Адрес API (Base URL)</label>
|
|
223
|
-
<input :value="baseUrlInput" @input="baseUrlInput = $this.value">
|
|
223
|
+
<input :value="baseUrlInput" @input="baseUrlInput = $this.value; _notifyForm()">
|
|
224
224
|
</div>
|
|
225
225
|
|
|
226
226
|
<div class="field">
|
|
227
227
|
<label>Протокол</label>
|
|
228
|
-
<select @change="protocolInput = $this.value">
|
|
228
|
+
<select @change="protocolInput = $this.value; _notifyForm()">
|
|
229
229
|
<option value="openai" :selected="protocolInput === 'openai'">OpenAI-совместимый (openai)</option>
|
|
230
230
|
<option value="gigachat" :selected="protocolInput === 'gigachat'">Сбер GigaChat (gigachat)</option>
|
|
231
231
|
<option value="yandex" :selected="protocolInput === 'yandex'">Яндекс Cloud AI / Алиса (yandex)</option>
|
|
@@ -235,7 +235,6 @@ export default {
|
|
|
235
235
|
</div>
|
|
236
236
|
|
|
237
237
|
<div class="toolbar" style="margin-top:4px;">
|
|
238
|
-
<button type="button" class="btn primary" @tap="saveConfig()">Сохранить ключ и настройки</button>
|
|
239
238
|
<button type="button" class="btn" ~if="state.hasKey" @tap="clearKey()">Очистить ключ</button>
|
|
240
239
|
<button type="button" class="btn" @tap="fetchRemoteModels()">Проверить API / Загрузить модели</button>
|
|
241
240
|
</div>
|
|
@@ -293,17 +292,42 @@ export default {
|
|
|
293
292
|
if (n) this.reload();
|
|
294
293
|
}
|
|
295
294
|
},
|
|
295
|
+
$form: null,
|
|
296
|
+
allowSave: true,
|
|
296
297
|
state: null,
|
|
297
298
|
apiKeyInput: '',
|
|
298
299
|
folderIdInput: '',
|
|
299
300
|
scopeInput: 'GIGACHAT_API_PERS',
|
|
300
301
|
baseUrlInput: '',
|
|
301
302
|
protocolInput: 'openai',
|
|
303
|
+
_savedSnap: '',
|
|
302
304
|
customModelId: '',
|
|
303
305
|
customModelLabel: '',
|
|
304
306
|
remoteModels: [],
|
|
305
307
|
notice: '',
|
|
306
308
|
error: '',
|
|
309
|
+
_currentSnap() {
|
|
310
|
+
return JSON.stringify({
|
|
311
|
+
apiKey: String(this.apiKeyInput || '').trim(),
|
|
312
|
+
folderId: String(this.folderIdInput || ''),
|
|
313
|
+
scope: String(this.scopeInput || 'GIGACHAT_API_PERS'),
|
|
314
|
+
baseUrl: String(this.baseUrlInput || ''),
|
|
315
|
+
protocol: String(this.protocolInput || 'openai'),
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
get isChanged() {
|
|
319
|
+
if (!this.state) return false;
|
|
320
|
+
return this._currentSnap() !== this._savedSnap;
|
|
321
|
+
},
|
|
322
|
+
isDirty() {
|
|
323
|
+
return this.isChanged;
|
|
324
|
+
},
|
|
325
|
+
_notifyForm() {
|
|
326
|
+
this.$form?.syncFromView?.(this);
|
|
327
|
+
},
|
|
328
|
+
async save() {
|
|
329
|
+
return await this.saveConfig();
|
|
330
|
+
},
|
|
307
331
|
get missingPresetModels() {
|
|
308
332
|
const installed = new Set((this.state?.installedModels || []).map(m => m.model));
|
|
309
333
|
return (this.state?.presetModels || []).filter(m => !installed.has(m.model));
|
|
@@ -320,6 +344,8 @@ export default {
|
|
|
320
344
|
this.scopeInput = st?.scope || 'GIGACHAT_API_PERS';
|
|
321
345
|
this.baseUrlInput = st?.baseUrl || '';
|
|
322
346
|
this.protocolInput = st?.protocol || 'openai';
|
|
347
|
+
this._savedSnap = this._currentSnap();
|
|
348
|
+
this._notifyForm();
|
|
323
349
|
} catch (e) {
|
|
324
350
|
this.error = String(e?.message || e);
|
|
325
351
|
}
|
|
@@ -354,7 +380,13 @@ export default {
|
|
|
354
380
|
const res = await this.$item.fetch('provider_save_config', payload);
|
|
355
381
|
this.apiKeyInput = '';
|
|
356
382
|
this.state = res?.status || (await this.$item.fetch('provider_status'));
|
|
383
|
+
this.folderIdInput = this.state?.folderId || this.folderIdInput;
|
|
384
|
+
this.scopeInput = this.state?.scope || this.scopeInput;
|
|
385
|
+
this.baseUrlInput = this.state?.baseUrl || this.baseUrlInput;
|
|
386
|
+
this.protocolInput = this.state?.protocol || this.protocolInput;
|
|
387
|
+
this._savedSnap = this._currentSnap();
|
|
357
388
|
this.notice = 'Настройки и ключ провайдера сохранены.';
|
|
389
|
+
this._notifyForm();
|
|
358
390
|
this._refreshModelsTree();
|
|
359
391
|
} catch (e) {
|
|
360
392
|
this.error = String(e?.message || e);
|
|
@@ -108,13 +108,26 @@ function userAiStorageKey(suffix = 'model') {
|
|
|
108
108
|
return `work.user.ai:${uid}:${suffix}`;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
export function normalizeModelPath(modelPath) {
|
|
112
|
+
const s = String(modelPath || '').trim().replace(/\\/g, '/');
|
|
113
|
+
if (!s)
|
|
114
|
+
return '';
|
|
115
|
+
if (/^\/?MODELS(?:\/|$)/i.test(s)) {
|
|
116
|
+
const clean = s.startsWith('/') ? s : '/' + s;
|
|
117
|
+
const modelsBase = ['MODULES', 'Модели'].join('/');
|
|
118
|
+
return '/' + modelsBase + clean.slice('/MODELS'.length);
|
|
119
|
+
}
|
|
120
|
+
return s;
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
export function getUserPreferredModel() {
|
|
112
124
|
if (typeof localStorage === 'undefined')
|
|
113
125
|
return '';
|
|
114
126
|
try {
|
|
115
|
-
const
|
|
127
|
+
const raw = localStorage.getItem(userAiStorageKey('model'))
|
|
116
128
|
|| localStorage.getItem('work.user.ai:default:model')
|
|
117
129
|
|| '';
|
|
130
|
+
const val = normalizeModelPath(raw);
|
|
118
131
|
if (val && NON_CHAT_MODEL_RE.test(val))
|
|
119
132
|
return '';
|
|
120
133
|
return val;
|
|
@@ -125,15 +138,16 @@ export function getUserPreferredModel() {
|
|
|
125
138
|
}
|
|
126
139
|
|
|
127
140
|
export function setUserPreferredModel(modelPath) {
|
|
128
|
-
|
|
141
|
+
const clean = normalizeModelPath(modelPath);
|
|
142
|
+
if (!clean || typeof localStorage === 'undefined')
|
|
129
143
|
return;
|
|
130
|
-
if (NON_CHAT_MODEL_RE.test(
|
|
144
|
+
if (NON_CHAT_MODEL_RE.test(clean))
|
|
131
145
|
return;
|
|
132
146
|
try {
|
|
133
|
-
localStorage.setItem(userAiStorageKey('model'),
|
|
134
|
-
localStorage.setItem('work.user.ai:default:model',
|
|
147
|
+
localStorage.setItem(userAiStorageKey('model'), clean);
|
|
148
|
+
localStorage.setItem('work.user.ai:default:model', clean);
|
|
135
149
|
if (typeof BroadcastChannel !== 'undefined')
|
|
136
|
-
new BroadcastChannel('work-user-ai-model').postMessage({ model:
|
|
150
|
+
new BroadcastChannel('work-user-ai-model').postMessage({ model: clean });
|
|
137
151
|
}
|
|
138
152
|
catch { /* ignore */ }
|
|
139
153
|
}
|
|
@@ -95,24 +95,30 @@ ODA({
|
|
|
95
95
|
return this.$item?.short;
|
|
96
96
|
},
|
|
97
97
|
async _hydrateModel() {
|
|
98
|
-
|
|
99
|
-
if (userModel &&
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!aiRoot) return;
|
|
105
|
-
const tree = await aiRoot.info({
|
|
106
|
-
deep: -1
|
|
107
|
-
});
|
|
108
|
-
const leaf = await firstChatLeaf(tree);
|
|
109
|
-
const path = leaf?.path;
|
|
110
|
-
if (path) {
|
|
111
|
-
this.model = path;
|
|
112
|
-
setUserPreferredModel(path);
|
|
113
|
-
}
|
|
114
|
-
} catch {}
|
|
98
|
+
let userModel = getUserPreferredModel();
|
|
99
|
+
if (userModel && typeof WORK?.get_item === 'function') {
|
|
100
|
+
const existing = await WORK.get_item(userModel).catch(() => null);
|
|
101
|
+
if (!existing || existing.type !== '$ai' || !isChatModel(existing)) {
|
|
102
|
+
userModel = '';
|
|
103
|
+
}
|
|
115
104
|
}
|
|
105
|
+
if (userModel) {
|
|
106
|
+
if (this.model !== userModel) this.model = userModel;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.model = '';
|
|
110
|
+
try {
|
|
111
|
+
const modelsPath = '/' + ['MODULES', 'Модели'].join('/');
|
|
112
|
+
const modelsRoot = await WORK.get_item(modelsPath).catch(() => null);
|
|
113
|
+
if (!modelsRoot) return;
|
|
114
|
+
const tree = await modelsRoot.info({ deep: -1 });
|
|
115
|
+
const leaf = await firstChatLeaf(tree);
|
|
116
|
+
const path = leaf?.path;
|
|
117
|
+
if (path) {
|
|
118
|
+
this.model = path;
|
|
119
|
+
setUserPreferredModel(path);
|
|
120
|
+
}
|
|
121
|
+
} catch {}
|
|
116
122
|
},
|
|
117
123
|
get formChat() {
|
|
118
124
|
return this;
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js
CHANGED
|
@@ -67,6 +67,7 @@ export default {
|
|
|
67
67
|
icon: 'bootstrap:robot',
|
|
68
68
|
order: 70,
|
|
69
69
|
group: 'infra',
|
|
70
|
+
allowSave: true,
|
|
70
71
|
component: {
|
|
71
72
|
imports: 'oda//icon, oda//button',
|
|
72
73
|
template: /* html */`
|
|
@@ -222,9 +223,8 @@ export default {
|
|
|
222
223
|
{{showInherited ? 'Скрыть унаследованную' : 'Унаследованная (' + inheritedLayers.length + ')'}}
|
|
223
224
|
</button>
|
|
224
225
|
<span ~if="!inheritedLayers.length"></span>
|
|
225
|
-
<div class="row">
|
|
226
|
-
<span
|
|
227
|
-
<oda-button icon="icons:save" info-invert @tap="saveSystemPrompt()">Сохранить</oda-button>
|
|
226
|
+
<div class="row" ~if="systemStatus">
|
|
227
|
+
<span class="muted">{{systemStatus}}</span>
|
|
228
228
|
</div>
|
|
229
229
|
</div>
|
|
230
230
|
<div ~if="showInherited && inheritedLayers.length" class="inherited-box">
|
|
@@ -452,9 +452,37 @@ export default {
|
|
|
452
452
|
autoReply: true,
|
|
453
453
|
quietDigest: true
|
|
454
454
|
},
|
|
455
|
+
$form: null,
|
|
456
|
+
allowSave: true,
|
|
457
|
+
_savedSystemSnap: '',
|
|
455
458
|
systemText: '',
|
|
456
459
|
systemReplace: false,
|
|
457
460
|
systemStatus: '',
|
|
461
|
+
_currentSystemSnap() {
|
|
462
|
+
return JSON.stringify({
|
|
463
|
+
text: String(this.systemText || ''),
|
|
464
|
+
replace: Boolean(this.systemReplace),
|
|
465
|
+
});
|
|
466
|
+
},
|
|
467
|
+
get isChanged() {
|
|
468
|
+
if (!this._savedSystemSnap) return false;
|
|
469
|
+
return this._currentSystemSnap() !== this._savedSystemSnap;
|
|
470
|
+
},
|
|
471
|
+
isDirty() {
|
|
472
|
+
return this.isChanged;
|
|
473
|
+
},
|
|
474
|
+
_notifyForm() {
|
|
475
|
+
this.$form?.syncFromView?.(this);
|
|
476
|
+
},
|
|
477
|
+
$observers: {
|
|
478
|
+
_sysChanged(systemText, systemReplace) {
|
|
479
|
+
void systemText; void systemReplace;
|
|
480
|
+
this._notifyForm();
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
async save() {
|
|
484
|
+
return await this.saveSystemPrompt();
|
|
485
|
+
},
|
|
458
486
|
inheritedLayers: [],
|
|
459
487
|
showInherited: false,
|
|
460
488
|
flatClassOptions: [],
|
|
@@ -514,6 +542,8 @@ export default {
|
|
|
514
542
|
this.systemReplace = Boolean(sysRes.replace);
|
|
515
543
|
this.inheritedLayers = Array.isArray(sysRes.inherited) ? sysRes.inherited : [];
|
|
516
544
|
}
|
|
545
|
+
this._savedSystemSnap = this._currentSystemSnap();
|
|
546
|
+
this._notifyForm();
|
|
517
547
|
const opts = [];
|
|
518
548
|
const walkCls = nodes => {
|
|
519
549
|
for (const n of Array.isArray(nodes) ? nodes : []) {
|
|
@@ -555,7 +585,9 @@ export default {
|
|
|
555
585
|
text: this.systemText,
|
|
556
586
|
replace: Boolean(this.systemReplace)
|
|
557
587
|
}));
|
|
588
|
+
this._savedSystemSnap = this._currentSystemSnap();
|
|
558
589
|
this.systemStatus = 'Сохранено';
|
|
590
|
+
this._notifyForm();
|
|
559
591
|
} catch (e) {
|
|
560
592
|
this.systemStatus = '';
|
|
561
593
|
this.error = String(e?.message || e);
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js
CHANGED
|
@@ -3,6 +3,7 @@ export default {
|
|
|
3
3
|
icon: 'communication:phonelink-ring',
|
|
4
4
|
order: 60,
|
|
5
5
|
group: 'infra',
|
|
6
|
+
allowSave: true,
|
|
6
7
|
component: {
|
|
7
8
|
imports: 'oda//icon, oda//button',
|
|
8
9
|
template: /*html*/`
|
|
@@ -228,9 +229,8 @@ export default {
|
|
|
228
229
|
</label>
|
|
229
230
|
</div>
|
|
230
231
|
|
|
231
|
-
<div class="row" style="justify-content: flex-end; gap: 8px;">
|
|
232
|
-
<oda-button
|
|
233
|
-
<oda-button icon="icons:save" label="Сохранить настройки точки" @tap="saveConfig()"></oda-button>
|
|
232
|
+
<div class="row" style="justify-content: flex-end; gap: 8px;" ~if="effectiveBot">
|
|
233
|
+
<oda-button icon="communication:chat" label="Проверить общую рассылку подразделения" @tap="testDelivery('department')"></oda-button>
|
|
234
234
|
</div>
|
|
235
235
|
</div>
|
|
236
236
|
|
|
@@ -283,6 +283,9 @@ export default {
|
|
|
283
283
|
</div>
|
|
284
284
|
</div>
|
|
285
285
|
`,
|
|
286
|
+
$form: null,
|
|
287
|
+
allowSave: true,
|
|
288
|
+
_savedSnap: '',
|
|
286
289
|
pointLabel: '',
|
|
287
290
|
ownBot: null,
|
|
288
291
|
effectiveBot: null,
|
|
@@ -301,6 +304,36 @@ export default {
|
|
|
301
304
|
linkCodeInfo: null,
|
|
302
305
|
notice: '',
|
|
303
306
|
error: '',
|
|
307
|
+
_currentSnap() {
|
|
308
|
+
return JSON.stringify({
|
|
309
|
+
k: this.draftBotKind || 'telegram',
|
|
310
|
+
l: this.draftBotLabel || '',
|
|
311
|
+
t: this.draftBotToken || '',
|
|
312
|
+
u: this.draftBotUsername || '',
|
|
313
|
+
g: this.draftGroupChatId || '',
|
|
314
|
+
gt: this.draftGroupTitle || '',
|
|
315
|
+
b: Boolean(this.draftBroadcastToMembers),
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
get isChanged() {
|
|
319
|
+
if (!this._savedSnap) return false;
|
|
320
|
+
return this._currentSnap() !== this._savedSnap;
|
|
321
|
+
},
|
|
322
|
+
isDirty() {
|
|
323
|
+
return this.isChanged;
|
|
324
|
+
},
|
|
325
|
+
_notifyForm() {
|
|
326
|
+
this.$form?.syncFromView?.(this);
|
|
327
|
+
},
|
|
328
|
+
$observers: {
|
|
329
|
+
_draftChanged(draftBotKind, draftBotLabel, draftBotToken, draftBotUsername, draftGroupChatId, draftGroupTitle, draftBroadcastToMembers) {
|
|
330
|
+
void draftBotKind; void draftBotLabel; void draftBotToken; void draftBotUsername; void draftGroupChatId; void draftGroupTitle; void draftBroadcastToMembers;
|
|
331
|
+
this._notifyForm();
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
async save() {
|
|
335
|
+
return await this.saveConfig();
|
|
336
|
+
},
|
|
304
337
|
async attached() {
|
|
305
338
|
await this.reload();
|
|
306
339
|
},
|
|
@@ -325,6 +358,8 @@ export default {
|
|
|
325
358
|
this.draftGroupChatId = st.groupChatId || '';
|
|
326
359
|
this.draftGroupTitle = st.groupTitle || '';
|
|
327
360
|
this.draftBroadcastToMembers = st.broadcastToMembers !== false;
|
|
361
|
+
this._savedSnap = this._currentSnap();
|
|
362
|
+
this._notifyForm();
|
|
328
363
|
},
|
|
329
364
|
async loadUsers() {
|
|
330
365
|
try {
|