odant-work 1.0.103 → 1.0.104
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/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/settings/$handler/class.js +292 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +11 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +14 -11
- package/$server/$folder/$file/$html/handlers/preview/$handler/preview.js +7 -0
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +11 -0
- package/$server/$folder/$file/$md/handlers/preview/$handler/preview.js +29 -8
- package/$server/$folder/$file/$office/handlers/preview/$handler/preview.js +6 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +34 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +14 -11
- package/$server/$folder/$file/$task/handlers/preview/$handler/preview.js +1 -0
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +9 -0
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +15 -0
- package/$server/$folder/handlers/pages/form/$handler/class.js +10 -2
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +523 -25
- package/$server/$folder/lib/explorer/explorer.js +63 -0
- package/$server/$folder/lib/tree/tree.js +45 -14
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +552 -36
- package/oda/components/icon/icon.js +20 -7
- package/package.json +1 -1
- package/sources/client.js +24 -0
- package/sources/host/websocket.js +17 -0
- package/sources/modules/agent/index.js +25 -6
- package/sources/modules/agent/permissions.js +4 -2
- package/sources/modules/agent/scope.js +72 -5
- package/sources/modules/agent/session.js +59 -6
- package/sources/modules/agent/tools/work/classes.js +16 -1
- package/sources/modules/license/index.js +120 -0
- package/sources/modules/nodes/registry.js +57 -7
- package/sources/modules/trainer/local-engine.js +22 -9
- package/sources/modules/user-profile/user-profile.js +0 -129
- package/sources/modules/user-profile/user-tokens.js +426 -85
- package/sources/server/access/gateway.js +1 -0
- package/sources/server/folder.js +5 -1
- package/sources/server/node.js +16 -0
- package/sources/server/server.js +14 -5
- package/sources/server/user.js +3 -0
package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
async allowUse($context, params) {
|
|
3
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
4
|
+
return false;
|
|
5
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
6
|
+
if (uid && $context.id === uid)
|
|
7
|
+
return true;
|
|
8
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
9
|
+
return true;
|
|
10
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
11
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
12
|
+
},
|
|
3
13
|
};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
async allowUse($context, params) {
|
|
3
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
4
|
+
return false;
|
|
5
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
6
|
+
if (uid && $context.id === uid)
|
|
7
|
+
return true;
|
|
8
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
9
|
+
return true;
|
|
10
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
11
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
12
|
+
},
|
|
3
13
|
};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
label: 'Настройки',
|
|
3
|
+
icon: 'icons:tune',
|
|
4
|
+
order: 16,
|
|
5
|
+
async allowUse($context, params) {
|
|
6
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
7
|
+
return false;
|
|
8
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
9
|
+
if (uid && $context.id === uid)
|
|
10
|
+
return true;
|
|
11
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
12
|
+
return true;
|
|
13
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
14
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
15
|
+
},
|
|
16
|
+
component: {
|
|
17
|
+
imports: 'oda//icon, oda//button',
|
|
18
|
+
template: /* html */`
|
|
19
|
+
<style>
|
|
20
|
+
:host {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
flex: 1;
|
|
24
|
+
min-height: 0;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
padding: 20px 24px 32px;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
background: var(--content-background, #ffffff);
|
|
29
|
+
color: var(--content-color, #1f2937);
|
|
30
|
+
font-family: var(--font-family, system-ui, -apple-system, sans-serif);
|
|
31
|
+
}
|
|
32
|
+
.page {
|
|
33
|
+
width: min(760px, 100%);
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: 16px;
|
|
38
|
+
}
|
|
39
|
+
.header {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 12px;
|
|
43
|
+
}
|
|
44
|
+
.title-ico {
|
|
45
|
+
width: 40px;
|
|
46
|
+
height: 40px;
|
|
47
|
+
border-radius: 10px;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
background: color-mix(in srgb, var(--accent-color, #2563eb) 14%, transparent);
|
|
52
|
+
color: var(--accent-color, #2563eb);
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
|
+
h2 {
|
|
56
|
+
margin: 0;
|
|
57
|
+
font-size: 18px;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
}
|
|
60
|
+
.subtitle {
|
|
61
|
+
margin: 3px 0 0;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
opacity: 0.75;
|
|
64
|
+
}
|
|
65
|
+
.card {
|
|
66
|
+
border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.25)));
|
|
67
|
+
border-radius: 12px;
|
|
68
|
+
background: var(--subtle-background, rgba(128, 128, 128, 0.03));
|
|
69
|
+
padding: 16px 18px;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: 14px;
|
|
73
|
+
}
|
|
74
|
+
.card-title {
|
|
75
|
+
font-size: 15px;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
}
|
|
78
|
+
.field {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 6px;
|
|
82
|
+
}
|
|
83
|
+
.field-label {
|
|
84
|
+
font-size: 13.5px;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
}
|
|
87
|
+
.field-hint {
|
|
88
|
+
font-size: 12.5px;
|
|
89
|
+
opacity: 0.72;
|
|
90
|
+
line-height: 1.4;
|
|
91
|
+
}
|
|
92
|
+
.select {
|
|
93
|
+
width: 100%;
|
|
94
|
+
padding: 9px 12px;
|
|
95
|
+
border-radius: 8px;
|
|
96
|
+
border: 1px solid var(--control-border-color, var(--border-color, #cbd5e1));
|
|
97
|
+
background: var(--content-background, #ffffff);
|
|
98
|
+
color: var(--content-color, #1f2937);
|
|
99
|
+
font: inherit;
|
|
100
|
+
font-size: 13.5px;
|
|
101
|
+
box-sizing: border-box;
|
|
102
|
+
}
|
|
103
|
+
.toggle-row {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: flex-start;
|
|
106
|
+
gap: 12px;
|
|
107
|
+
padding: 12px 14px;
|
|
108
|
+
border-radius: 10px;
|
|
109
|
+
border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.22)));
|
|
110
|
+
background: var(--content-background, #ffffff);
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
}
|
|
113
|
+
.toggle-row input {
|
|
114
|
+
width: 18px;
|
|
115
|
+
height: 18px;
|
|
116
|
+
margin: 2px 0 0;
|
|
117
|
+
flex-shrink: 0;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
.status {
|
|
121
|
+
font-size: 13px;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
color: #059669;
|
|
124
|
+
}
|
|
125
|
+
.status[error] {
|
|
126
|
+
color: var(--error-color, #dc2626);
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
129
|
+
|
|
130
|
+
<div class="page">
|
|
131
|
+
<div class="header">
|
|
132
|
+
<div class="title-ico">
|
|
133
|
+
<oda-icon icon="icons:tune" icon-size="22"></oda-icon>
|
|
134
|
+
</div>
|
|
135
|
+
<div>
|
|
136
|
+
<h2>Личные настройки</h2>
|
|
137
|
+
<p class="subtitle">{{targetTitle}} · Индивидуальные параметры интерфейса и работы ИИ-ассистента.</p>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div class="card">
|
|
142
|
+
<div class="card-title">Искусственный интеллект</div>
|
|
143
|
+
<div class="field">
|
|
144
|
+
<label class="field-label" for="aiModelSelect">Главная модель ИИ</label>
|
|
145
|
+
<select id="aiModelSelect" class="select" @change="_onModelChange($event)">
|
|
146
|
+
<option value="" :selected="!settingModel">{{defaultOptionLabel}}</option>
|
|
147
|
+
<option ~for="chatModels" :value="$for.item.path" :selected="$for.item.path === settingModel">{{$for.item.label}}</option>
|
|
148
|
+
</select>
|
|
149
|
+
<div class="field-hint">
|
|
150
|
+
Используется по умолчанию во всех новых чатах на любом устройстве и синхронизируется при смене модели в строке чата.
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div class="card">
|
|
156
|
+
<div class="card-title">Интерфейс и уведомления</div>
|
|
157
|
+
<label class="toggle-row">
|
|
158
|
+
<input type="checkbox" :checked="settingChatSound" @change="_onSoundChange($event)">
|
|
159
|
+
<div>
|
|
160
|
+
<div class="field-label">Звуковой щелчок по завершении ответа</div>
|
|
161
|
+
<div class="field-hint">Короткий тихий сигнал, когда открытый на экране чат завершил ответ или ждёт вашего подтверждения.</div>
|
|
162
|
+
</div>
|
|
163
|
+
</label>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div class="status" ~if="statusText" :error="!!statusError">{{statusText}}</div>
|
|
167
|
+
</div>
|
|
168
|
+
`,
|
|
169
|
+
$item: {
|
|
170
|
+
$def: null,
|
|
171
|
+
set(n) {
|
|
172
|
+
if (n) this.reload();
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
chatModels: [],
|
|
176
|
+
systemDefaultModel: '',
|
|
177
|
+
settingModel: '',
|
|
178
|
+
settingChatSound: true,
|
|
179
|
+
statusText: '',
|
|
180
|
+
statusError: false,
|
|
181
|
+
get targetUid() {
|
|
182
|
+
return this.$item?.id || WORK?.uid || '';
|
|
183
|
+
},
|
|
184
|
+
get isSelf() {
|
|
185
|
+
return Boolean(WORK?.uid && this.targetUid === WORK.uid);
|
|
186
|
+
},
|
|
187
|
+
get targetTitle() {
|
|
188
|
+
return this.$item?.DATA?.label || this.$item?.label || this.targetUid || 'Пользователь';
|
|
189
|
+
},
|
|
190
|
+
get defaultOptionLabel() {
|
|
191
|
+
const defItem = (this.chatModels || []).find(m => m.path === this.systemDefaultModel);
|
|
192
|
+
if (defItem)
|
|
193
|
+
return `По умолчанию системы (${defItem.label})`;
|
|
194
|
+
return 'По умолчанию системы';
|
|
195
|
+
},
|
|
196
|
+
attached() {
|
|
197
|
+
this._onUserSettings = () => {
|
|
198
|
+
if (this.isSelf) {
|
|
199
|
+
const s = WORK.userSettings || {};
|
|
200
|
+
this.settingModel = typeof s.aiModel === 'string' ? s.aiModel : '';
|
|
201
|
+
this.settingChatSound = s.chatSound !== false;
|
|
202
|
+
this._syncSelectDom();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
WORK.authEvents?.addEventListener?.('user-settings', this._onUserSettings);
|
|
206
|
+
this.reload();
|
|
207
|
+
},
|
|
208
|
+
detached() {
|
|
209
|
+
if (this._onUserSettings)
|
|
210
|
+
WORK.authEvents?.removeEventListener?.('user-settings', this._onUserSettings);
|
|
211
|
+
},
|
|
212
|
+
_syncSelectDom() {
|
|
213
|
+
this.async(() => {
|
|
214
|
+
const sel = this.$?.('#aiModelSelect');
|
|
215
|
+
if (sel && sel.value !== this.settingModel)
|
|
216
|
+
sel.value = this.settingModel || '';
|
|
217
|
+
}, 20);
|
|
218
|
+
},
|
|
219
|
+
async reload() {
|
|
220
|
+
if (!WORK?.uid || typeof WORK?.fetch !== 'function')
|
|
221
|
+
return;
|
|
222
|
+
const uid = this.targetUid;
|
|
223
|
+
try {
|
|
224
|
+
const [settings, models, defPath] = await Promise.all([
|
|
225
|
+
WORK.fetch('/', 'user_settings_get', uid ? { uid } : {}),
|
|
226
|
+
WORK.fetch('/', 'agent_chat_models').catch(() => []),
|
|
227
|
+
WORK.fetch('/', 'agent_default_model', { nodePath: this.$item?.path || '/' }).catch(() => ''),
|
|
228
|
+
]);
|
|
229
|
+
if (Array.isArray(models))
|
|
230
|
+
this.chatModels = models;
|
|
231
|
+
this.systemDefaultModel = typeof defPath === 'string' ? defPath : '';
|
|
232
|
+
if (settings && typeof settings === 'object') {
|
|
233
|
+
this.settingModel = typeof settings.aiModel === 'string' ? settings.aiModel : '';
|
|
234
|
+
this.settingChatSound = settings.chatSound !== false;
|
|
235
|
+
if (this.isSelf)
|
|
236
|
+
WORK._applyUserSettings?.(settings, { broadcast: false });
|
|
237
|
+
}
|
|
238
|
+
this._syncSelectDom();
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
this.statusError = true;
|
|
242
|
+
this.statusText = e?.message || 'Не удалось загрузить настройки';
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
async _savePatch(patch) {
|
|
246
|
+
this.statusError = false;
|
|
247
|
+
this.statusText = '';
|
|
248
|
+
try {
|
|
249
|
+
const payload = { ...patch, ...(!this.isSelf && this.targetUid ? { uid: this.targetUid } : {}) };
|
|
250
|
+
let saved;
|
|
251
|
+
if (this.isSelf && typeof WORK.saveUserSettings === 'function') {
|
|
252
|
+
saved = await WORK.saveUserSettings(patch);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
saved = await WORK.fetch('/', 'user_settings_save', {}, payload);
|
|
256
|
+
}
|
|
257
|
+
if (saved && typeof saved === 'object') {
|
|
258
|
+
this.settingModel = typeof saved.aiModel === 'string' ? saved.aiModel : '';
|
|
259
|
+
this.settingChatSound = saved.chatSound !== false;
|
|
260
|
+
}
|
|
261
|
+
if (this.isSelf && 'aiModel' in patch && patch.aiModel && typeof BroadcastChannel !== 'undefined') {
|
|
262
|
+
try { new BroadcastChannel('work-user-ai-model').postMessage({ model: patch.aiModel }); } catch {}
|
|
263
|
+
}
|
|
264
|
+
this._syncSelectDom();
|
|
265
|
+
this.statusText = 'Сохранено';
|
|
266
|
+
clearTimeout(this._stTimer);
|
|
267
|
+
this._stTimer = setTimeout(() => { this.statusText = ''; }, 2000);
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
this.statusError = true;
|
|
271
|
+
this.statusText = e?.message || 'Ошибка сохранения';
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
_onModelChange(e) {
|
|
275
|
+
const val = String(e?.target?.value || '');
|
|
276
|
+
this.settingModel = val;
|
|
277
|
+
if (this.isSelf && !val && typeof localStorage !== 'undefined') {
|
|
278
|
+
try {
|
|
279
|
+
const uid = WORK.uid || this.targetUid || 'default';
|
|
280
|
+
localStorage.removeItem('work.user.ai:' + uid + ':model');
|
|
281
|
+
localStorage.removeItem('work.user.ai:default:model');
|
|
282
|
+
} catch {}
|
|
283
|
+
}
|
|
284
|
+
this._savePatch({ aiModel: val });
|
|
285
|
+
},
|
|
286
|
+
_onSoundChange(e) {
|
|
287
|
+
const checked = Boolean(e?.target?.checked);
|
|
288
|
+
this.settingChatSound = checked;
|
|
289
|
+
this._savePatch({ chatSound: checked });
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
};
|
package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
async allowUse($context, params) {
|
|
3
|
+
if (!$context?.id || $context?.DATA?.usersContainer)
|
|
4
|
+
return false;
|
|
5
|
+
const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
|
|
6
|
+
if (uid && $context.id === uid)
|
|
7
|
+
return true;
|
|
8
|
+
if (globalThis.WORK?.DEV_MODE)
|
|
9
|
+
return true;
|
|
10
|
+
const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
|
|
11
|
+
return Array.isArray(roles) && roles.includes('BOSS');
|
|
12
|
+
},
|
|
3
13
|
};
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js
CHANGED
|
@@ -170,6 +170,11 @@ export default {
|
|
|
170
170
|
color: var(--accent-color, #2563eb);
|
|
171
171
|
font-weight: 600;
|
|
172
172
|
}
|
|
173
|
+
oda-button[label] {
|
|
174
|
+
padding: 5px 12px;
|
|
175
|
+
gap: 6px;
|
|
176
|
+
border-radius: 6px;
|
|
177
|
+
}
|
|
173
178
|
.inherited-box {
|
|
174
179
|
@apply --vertical;
|
|
175
180
|
gap: 6px;
|
|
@@ -246,9 +251,7 @@ export default {
|
|
|
246
251
|
<input type="checkbox" :checked="auditEnabled" @change="saveAuditSettings({ enabled: $event.target.checked })">
|
|
247
252
|
<span>Включён</span>
|
|
248
253
|
</label>
|
|
249
|
-
<oda-button icon="
|
|
250
|
-
{{auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'}}
|
|
251
|
-
</oda-button>
|
|
254
|
+
<oda-button icon="av:play-arrow" info-invert :disabled="auditRunning" :label="auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'" @tap="runAuditNow()"></oda-button>
|
|
252
255
|
</div>
|
|
253
256
|
</div>
|
|
254
257
|
<div class="row">
|
|
@@ -274,17 +277,17 @@ export default {
|
|
|
274
277
|
</div>
|
|
275
278
|
<div class="row" style="justify-content:space-between;" ~if="auditLastText || auditResultText">
|
|
276
279
|
<span class="muted">{{auditResultText || auditLastText}}</span>
|
|
277
|
-
<oda-button ~if="auditLastTask" icon="icons:open-in-new" @tap="openAuditTask()"
|
|
280
|
+
<oda-button ~if="auditLastTask" icon="icons:open-in-new" label="Открыть задачу" @tap="openAuditTask()"></oda-button>
|
|
278
281
|
</div>
|
|
279
282
|
</div>
|
|
280
283
|
|
|
281
284
|
<!-- 2. Автоматические реакции на события -->
|
|
282
285
|
<div class="card">
|
|
283
286
|
<div class="card-head">
|
|
284
|
-
<oda-icon icon="
|
|
287
|
+
<oda-icon icon="social:notifications-active" icon-size="20"></oda-icon>
|
|
285
288
|
<span>Автоматические реакции ({{triggerCards.length}})</span>
|
|
286
289
|
<div class="row" style="margin-left:auto;">
|
|
287
|
-
<oda-button icon="icons:add" @tap="openNewRule()"
|
|
290
|
+
<oda-button icon="icons:add" label="Добавить" @tap="openNewRule()"></oda-button>
|
|
288
291
|
</div>
|
|
289
292
|
</div>
|
|
290
293
|
|
|
@@ -381,8 +384,8 @@ export default {
|
|
|
381
384
|
</div>
|
|
382
385
|
|
|
383
386
|
<div class="row" style="justify-content:flex-end;">
|
|
384
|
-
<oda-button icon="icons:check" info-invert :disabled="!canSaveRule" @tap="saveRule()"
|
|
385
|
-
<oda-button icon="icons:close" @tap="editing = false"
|
|
387
|
+
<oda-button icon="icons:check" info-invert :disabled="!canSaveRule" label="Сохранить" @tap="saveRule()"></oda-button>
|
|
388
|
+
<oda-button icon="icons:close" label="Отмена" @tap="editing = false"></oda-button>
|
|
386
389
|
</div>
|
|
387
390
|
</div>
|
|
388
391
|
|
|
@@ -396,7 +399,7 @@ export default {
|
|
|
396
399
|
<span ~if="$for.item.approval" class="badge">подтверждение</span>
|
|
397
400
|
<span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'вкл' : 'выкл'}}</span>
|
|
398
401
|
<div class="row" style="margin-left:auto;">
|
|
399
|
-
<oda-button icon="editor:mode-edit" @tap="editRule($for.item.raw)"
|
|
402
|
+
<oda-button icon="editor:mode-edit" label="Изменить" @tap="editRule($for.item.raw)"></oda-button>
|
|
400
403
|
<oda-button ~if="$for.item.own" icon="icons:delete" @tap="deleteRule($for.item.name)"></oda-button>
|
|
401
404
|
</div>
|
|
402
405
|
</div>
|
|
@@ -460,7 +463,7 @@ export default {
|
|
|
460
463
|
::value="schedPrompt" style="min-height:52px;"></textarea>
|
|
461
464
|
|
|
462
465
|
<div class="row" style="justify-content:flex-end;">
|
|
463
|
-
<oda-button icon="icons:add" info-invert @tap="addSchedule()"
|
|
466
|
+
<oda-button icon="icons:add" info-invert label="Добавить" @tap="addSchedule()"></oda-button>
|
|
464
467
|
</div>
|
|
465
468
|
</div>
|
|
466
469
|
|
|
@@ -472,7 +475,7 @@ export default {
|
|
|
472
475
|
<span ~if="$for.item.rule?.mask" class="muted" style="font-family:monospace;">{{$for.item.rule.mask}}</span>
|
|
473
476
|
<span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'активно' : 'пауза'}}</span>
|
|
474
477
|
<div class="row" style="margin-left:auto;">
|
|
475
|
-
<oda-button
|
|
478
|
+
<oda-button :label="$for.item.enabled ? 'Пауза' : 'Включить'" @tap="toggleSched($for.item)"></oda-button>
|
|
476
479
|
<oda-button icon="icons:delete" @tap="deleteSched($for.item)"></oda-button>
|
|
477
480
|
</div>
|
|
478
481
|
</div>
|
|
@@ -12,6 +12,13 @@ export default {
|
|
|
12
12
|
background: white;
|
|
13
13
|
display: block;
|
|
14
14
|
}
|
|
15
|
+
:host([full-height]) {
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
:host([full-height]) iframe {
|
|
19
|
+
flex: 1;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
15
22
|
</style>
|
|
16
23
|
<!-- sandbox: скрипты работают в изолированном источнике без доступа
|
|
17
24
|
к родителю; топ-навигация и формы запрещены -->
|
|
@@ -21,6 +21,17 @@ export default{
|
|
|
21
21
|
min-width: 0;
|
|
22
22
|
@apply --flex;
|
|
23
23
|
}
|
|
24
|
+
:host([full-height]) {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
:host([full-height]) img {
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
max-height: 100%;
|
|
34
|
+
}
|
|
24
35
|
</style>
|
|
25
36
|
<img @tap="$item.execute()" loading="lazy" :src/>
|
|
26
37
|
`,
|
|
@@ -5,6 +5,12 @@ export default {
|
|
|
5
5
|
:host{
|
|
6
6
|
@apply --vertical;
|
|
7
7
|
}
|
|
8
|
+
:host([full-height]) {
|
|
9
|
+
height: 100%;
|
|
10
|
+
padding: 8px 14px;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
}
|
|
8
14
|
oda-markdown-viewer{
|
|
9
15
|
max-width: 100%;
|
|
10
16
|
overflow-x: auto;
|
|
@@ -18,18 +24,33 @@ export default {
|
|
|
18
24
|
})
|
|
19
25
|
},
|
|
20
26
|
set $item(n){
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
const seq = (this._mdSeq = (this._mdSeq || 0) + 1);
|
|
28
|
+
if (!n) {
|
|
29
|
+
this.value = '';
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
n.load().then(content=>{
|
|
33
|
+
if (seq !== this._mdSeq) return;
|
|
34
|
+
const apply = text => {
|
|
35
|
+
if (seq !== this._mdSeq) return;
|
|
23
36
|
const base = n.short || n.path || '';
|
|
24
37
|
const File = CORE.$file || n.constructor;
|
|
25
|
-
let
|
|
38
|
+
let s = String(text ?? '');
|
|
26
39
|
if (typeof File.fixWorkMdLinks === 'function')
|
|
27
|
-
|
|
40
|
+
s = File.fixWorkMdLinks(s, base);
|
|
28
41
|
if (typeof File.fixMdHistoryLinks === 'function')
|
|
29
|
-
|
|
30
|
-
this.value =
|
|
31
|
-
}
|
|
32
|
-
|
|
42
|
+
s = File.fixMdHistoryLinks(s);
|
|
43
|
+
this.value = s;
|
|
44
|
+
};
|
|
45
|
+
if (content?.DATA instanceof Blob) {
|
|
46
|
+
content.DATA.text().then(apply);
|
|
47
|
+
} else {
|
|
48
|
+
apply(content);
|
|
49
|
+
}
|
|
50
|
+
}).catch(() => {
|
|
51
|
+
if (seq === this._mdSeq)
|
|
52
|
+
this.value = '';
|
|
53
|
+
});
|
|
33
54
|
},
|
|
34
55
|
value: '',
|
|
35
56
|
|
|
@@ -56,6 +56,10 @@ export default {
|
|
|
56
56
|
padding: 6px 14px; border-radius: 999px; font-size: small; @apply --raised; @apply --content;
|
|
57
57
|
}
|
|
58
58
|
.legacy { @apply --muted; font-size: x-small; text-align: center; padding-bottom: 12px; }
|
|
59
|
+
.missing {
|
|
60
|
+
padding: 10px 14px; border-radius: var(--radius-m); border: 1px solid var(--subtle-border);
|
|
61
|
+
background: var(--code-background); @apply --muted; font-size: small; text-align: center; margin-top: 8px;
|
|
62
|
+
}
|
|
59
63
|
</style>
|
|
60
64
|
<div class="main" flex vertical ~if="showMain">
|
|
61
65
|
<microchat-header no-flex ~if="!inForm"></microchat-header>
|
|
@@ -63,12 +67,13 @@ export default {
|
|
|
63
67
|
<div class="col">
|
|
64
68
|
<div class="legacy" ~if="data?.legacy">Задача из прежней версии агента — показана упрощённо; продолжить можно как обычно.</div>
|
|
65
69
|
<microchat-feed :items="feedItems"></microchat-feed>
|
|
66
|
-
<div class="
|
|
70
|
+
<div class="missing" ~if="missing">Задача или её узел удалены.</div>
|
|
71
|
+
<div class="working" ~if="activity && !missing">
|
|
67
72
|
<oda-icon icon="spinners:3-dots-scale" :icon-size="16"></oda-icon><span>{{activity.text}}</span>
|
|
68
73
|
</div>
|
|
69
74
|
</div>
|
|
70
75
|
</div>
|
|
71
|
-
<div class="bottom" vertical no-flex>
|
|
76
|
+
<div class="bottom" vertical no-flex ~if="!missing">
|
|
72
77
|
<oda-button class="down" ~if="!pinned && !needsHuman" icon="carbon:arrow-down" :icon-size="18" title="К последнему" @tap="toBottom"></oda-button>
|
|
73
78
|
<oda-button class="down attn" ~if="!pinned && needsHuman" accent-invert icon="carbon:arrow-down" :icon-size="16" label="Агент ждёт вас" title="Перейти к вопросу или разрешению" @tap="toBottom"></oda-button>
|
|
74
79
|
<microchat-todos ~if="showTodos" :todos="data.todos"></microchat-todos>
|
|
@@ -83,6 +88,7 @@ export default {
|
|
|
83
88
|
data: null,
|
|
84
89
|
streams: {},
|
|
85
90
|
status: 'idle',
|
|
91
|
+
missing: false,
|
|
86
92
|
optimistic: null,
|
|
87
93
|
toastText: '',
|
|
88
94
|
pinned: true,
|
|
@@ -293,8 +299,25 @@ export default {
|
|
|
293
299
|
}, 50);
|
|
294
300
|
this._startPcPoll();
|
|
295
301
|
this._watchPresence();
|
|
302
|
+
if (!this._onNodeDeleted && WORK.chatEvents) {
|
|
303
|
+
this._onNodeDeleted = ev => {
|
|
304
|
+
const delPath = String(ev?.detail?.path || '').replace(/\/+$/, '');
|
|
305
|
+
const mine = String(this._bound?.path || this.$item?.path || '').replace(/\/+$/, '');
|
|
306
|
+
if (delPath && mine && (mine === delPath || mine.startsWith(delPath + '/'))) {
|
|
307
|
+
this.missing = true;
|
|
308
|
+
this.status = 'idle';
|
|
309
|
+
this._hasActiveRun = false;
|
|
310
|
+
this.optimistic = null;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
WORK.chatEvents.addEventListener('node.deleted', this._onNodeDeleted);
|
|
314
|
+
}
|
|
296
315
|
},
|
|
297
316
|
detached() {
|
|
317
|
+
if (this._onNodeDeleted && WORK.chatEvents) {
|
|
318
|
+
WORK.chatEvents.removeEventListener('node.deleted', this._onNodeDeleted);
|
|
319
|
+
this._onNodeDeleted = null;
|
|
320
|
+
}
|
|
298
321
|
this._unbindItem();
|
|
299
322
|
this._unwatchPresence();
|
|
300
323
|
this._voice?.disable();
|
|
@@ -554,6 +577,7 @@ export default {
|
|
|
554
577
|
this._again = false;
|
|
555
578
|
try {
|
|
556
579
|
const raw = await this.$item?.load();
|
|
580
|
+
this.missing = false;
|
|
557
581
|
const data = typeof raw === 'string' ? JSON.parse(raw || '{}') : raw || {};
|
|
558
582
|
const done = new Set((data.items || []).filter(i => i.type === 'assistant' && (i.durationMs || i.stopped || i.interrupted)).map(i => i.id));
|
|
559
583
|
if (Object.keys(this.streams).some(id => done.has(id))) {
|
|
@@ -577,6 +601,14 @@ export default {
|
|
|
577
601
|
this._voice?.onData(data);
|
|
578
602
|
tries = 0;
|
|
579
603
|
} catch (e) {
|
|
604
|
+
const msg = String(e?.message || e || '');
|
|
605
|
+
if (/not found|ENOENT|404/i.test(msg)) {
|
|
606
|
+
this.missing = true;
|
|
607
|
+
this.status = 'idle';
|
|
608
|
+
this._hasActiveRun = false;
|
|
609
|
+
this.optimistic = null;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
580
612
|
if (++tries > 5) break;
|
|
581
613
|
this._again = true;
|
|
582
614
|
await new Promise(r => setTimeout(r, 300 * tries));
|
|
@@ -350,6 +350,11 @@ ODA({ is: 'microchat-tool',
|
|
|
350
350
|
.btns { @apply --horizontal; flex-wrap: wrap; gap: 8px; }
|
|
351
351
|
.btns oda-button { border-radius: var(--radius-s); padding: 4px 12px; box-sizing: border-box; }
|
|
352
352
|
.btns .help-btn { padding: 4px 9px; font-weight: 700; min-width: 28px; }
|
|
353
|
+
.always-chk {
|
|
354
|
+
@apply --horizontal; align-items: center; gap: 6px;
|
|
355
|
+
font-size: x-small; @apply --muted; cursor: pointer; user-select: none;
|
|
356
|
+
}
|
|
357
|
+
.always-chk input { width: auto; margin: 0; padding: 0; accent-color: var(--accent-color); cursor: pointer; }
|
|
353
358
|
.auto-tag { padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-color); font-weight: 600; }
|
|
354
359
|
.explain-box {
|
|
355
360
|
padding: 8px 10px;
|
|
@@ -407,13 +412,15 @@ ODA({ is: 'microchat-tool',
|
|
|
407
412
|
<div class="ask" ~if="isApproval">
|
|
408
413
|
<div class="q">Разрешить «{{meta.label}}»{{target ? ': ' + target : ''}}?</div>
|
|
409
414
|
<div class="why" ~if="data?.reason">{{data.reason}}</div>
|
|
415
|
+
<label class="always-chk" ~if="!data?.noAlways">
|
|
416
|
+
<input type="checkbox" :checked="rememberInTask" @change="rememberInTask = $event.target.checked">
|
|
417
|
+
<span>Больше не спрашивать в этой задаче{{alwaysScopeText ? ' (' + alwaysScopeText + ')' : ''}}</span>
|
|
418
|
+
</label>
|
|
410
419
|
<div class="btns">
|
|
411
|
-
<oda-button hide-icon accent-invert label="Разрешить" @tap="approve(true)"></oda-button>
|
|
412
|
-
<oda-button hide-icon class="ghost
|
|
413
|
-
<oda-button hide-icon class="ghost danger" label="Отклонить" @tap="approve(false)"></oda-button>
|
|
420
|
+
<oda-button hide-icon accent-invert label="Разрешить" @tap="approve(true, rememberInTask)"></oda-button>
|
|
421
|
+
<oda-button hide-icon class="ghost danger" label="Отклонить" @tap="approve(false, false)"></oda-button>
|
|
414
422
|
<oda-button hide-icon class="ghost help-btn" label="?" :disabled="explainLoading" title="Кратко объяснить действие и последствия с помощью ИИ" @tap="toggleExplain()"></oda-button>
|
|
415
423
|
</div>
|
|
416
|
-
<div class="why" ~if="!data?.noAlways && data?.approvalLabel">Общее разрешение: {{data.approvalLabel}}</div>
|
|
417
424
|
<div class="explain-box" ~if="explainLoading">Анализирую действие…</div>
|
|
418
425
|
<div class="explain-err" ~if="explainError && !explainLoading">{{explainError}}</div>
|
|
419
426
|
<div class="explain-box" ~if="explainOpen && !explainLoading && explainText">
|
|
@@ -685,16 +692,12 @@ ODA({ is: 'microchat-tool',
|
|
|
685
692
|
explainLoading: false,
|
|
686
693
|
explainError: '',
|
|
687
694
|
explainLocal: '',
|
|
695
|
+
rememberInTask: false,
|
|
688
696
|
get explainText() {
|
|
689
697
|
return this.explainLocal || this.data?.explanation || '';
|
|
690
698
|
},
|
|
691
|
-
get
|
|
692
|
-
return this.data?.
|
|
693
|
-
},
|
|
694
|
-
get alwaysBtnTitle() {
|
|
695
|
-
return this.data?.approvalLabel
|
|
696
|
-
? 'Не спрашивать в этой задаче: ' + this.data.approvalLabel
|
|
697
|
-
: 'Не спрашивать про «' + (this.meta?.label || '') + '» в этой задаче';
|
|
699
|
+
get alwaysScopeText() {
|
|
700
|
+
return String(this.data?.approvalLabel || '').trim();
|
|
698
701
|
},
|
|
699
702
|
async toggleExplain() {
|
|
700
703
|
if (this.explainLoading)
|