odant-work 1.0.104 → 1.0.106
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/$ai/handlers/pages/form/system/ai/$handler/class.js +15 -12
- package/$server/$folder/$class/$module/$mcp/handlers/pages/form/system/mcp/$handler/class.js +17 -24
- package/$server/$folder/$class/$module/$provider/handlers/pages/form/system/ai/$handler/class.js +15 -12
- package/$server/$folder/$class/$structure/$project/class.js +39 -5
- package/$server/$folder/$class/$structure/$project/handlers/pages/form/system/modules/$handler/class.js +40 -25
- package/$server/$folder/$class/$structure/$project/handlers/pages/form/system/requisites/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/license/$handler/class.js +13 -12
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/calendar/$handler/class.js +12 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/email/$handler/class.js +12 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/folder/$handler/class.js +12 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/profile/$handler/class.js +30 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/search/$handler/class.js +12 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/$handler/class.js +14 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +5 -4
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/requisites/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/settings/$handler/class.js +6 -37
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +5 -4
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/tokens/$handler/class.js +10 -2
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/users/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/class.js +15 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +82 -23
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +5 -29
- package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +276 -179
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +1 -0
- package/$server/$folder/$class/ai/system.md +2 -2
- package/$server/$folder/$class/class.js +5 -1
- package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +39 -45
- package/$server/$folder/handlers/pages/form/$handler/class.js +194 -2
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +2 -611
- package/$server/$folder/lib/consultant/consultant.js +123 -66
- package/$server/$folder/lib/explorer/explorer.js +9 -21
- package/$server/$folder/lib/folder-browser/folder-browser.js +793 -0
- package/$server/$folder/lib/folder-browser/readme.md +5 -0
- package/$server/$folder/lib/prompt-bar/prompt-bar.js +24 -1
- package/$server/$folder/lib/tree/tree.js +16 -6
- package/AGENTS.md +2 -2
- package/MODULES/$domain/class.js +1 -0
- package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +10 -21
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/engine/$handler/class.js +1 -0
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/models/$handler/class.js +5 -10
- package/MODULES//320/234/320/276/320/264/320/265/320/273/320/270/Local/$provider/handlers/pages/form/system/training/$handler/class.js +1 -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/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +5 -1
- 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/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +1 -1
- package/oda/components/layouts/editor-form/editor-form.js +54 -9
- package/package.json +1 -1
- package/sources/client.js +1 -1
- package/sources/data/print.js +27 -3
- package/sources/host/websocket.js +11 -1
- package/sources/modules/user-profile/user-tokens.js +0 -46
- package/sources/server/access/gateway.js +32 -6
- package/sources/server/chat-threads.js +32 -3
- package/sources/server/class/base-template.js +18 -18
- package/sources/server/class/feed.js +24 -12
- package/sources/server/class/security.js +97 -31
- package/sources/server/class.js +9 -0
- package/sources/server/handler.js +6 -0
- package/sources/server/user.js +12 -4
|
@@ -38,34 +38,6 @@ function ensureConsultantUI() {
|
|
|
38
38
|
]).catch(e => console.warn('[consultant] load UI:', e));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/** Первый лист $ai с поддержкой chat (приоритет провайдеру odant). */
|
|
42
|
-
function firstChatLeaf(node) {
|
|
43
|
-
if (!node)
|
|
44
|
-
return null;
|
|
45
|
-
if (!node.items?.length) {
|
|
46
|
-
if (node.type && node.type !== '$ai')
|
|
47
|
-
return null;
|
|
48
|
-
const mod = String(node.modality || node.DATA?.modality || '').toLowerCase();
|
|
49
|
-
if (['image', 'audio', 'embedding', 'video', 'voice', 'asr', 'tts', 'stt'].includes(mod))
|
|
50
|
-
return null;
|
|
51
|
-
const name = String(node.id || node.label || node.DATA?.label || node.path || '').toLowerCase();
|
|
52
|
-
if (/(flux|sdxl|stable-?diffusion|z-image|embedding|bge-|rerank|whisper|\basr\b|\btts\b|\bstt\b|voice|kokoro|musicgen|wan2|ltx-video)/i.test(name))
|
|
53
|
-
return null;
|
|
54
|
-
const c = node.capabilities || node.DATA?.capabilities;
|
|
55
|
-
const list = Array.isArray(c) ? c.map(String) : String(c || '').split(/[\s,]+/).filter(Boolean);
|
|
56
|
-
if (list.length && !list.includes('chat'))
|
|
57
|
-
return null;
|
|
58
|
-
return node;
|
|
59
|
-
}
|
|
60
|
-
const sorted = [...node.items].sort((a, b) => (a.id === 'odant' ? -1 : b.id === 'odant' ? 1 : 0));
|
|
61
|
-
for (const child of sorted) {
|
|
62
|
-
const found = firstChatLeaf(child);
|
|
63
|
-
if (found)
|
|
64
|
-
return found;
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
41
|
const STATUS_LABELS = {
|
|
70
42
|
idle: { label: 'Готов', icon: 'carbon:checkmark' },
|
|
71
43
|
running: { label: 'Думает…', icon: 'spinners:3-dots-scale' },
|
|
@@ -76,35 +48,76 @@ const STATUS_LABELS = {
|
|
|
76
48
|
limit: { label: 'Лимит шагов', icon: 'carbon:warning' },
|
|
77
49
|
};
|
|
78
50
|
|
|
51
|
+
const TIER_RANK = Object.freeze({
|
|
52
|
+
onboarding: 0,
|
|
53
|
+
member: 1,
|
|
54
|
+
unitBoss: 2,
|
|
55
|
+
workBoss: 3,
|
|
56
|
+
});
|
|
57
|
+
|
|
79
58
|
export const CONSULTANT_PROMPT_CATEGORIES = Object.freeze([
|
|
80
|
-
{ id: 'all', label: 'Все', icon: 'carbon:apps' },
|
|
81
|
-
{ id: 'accounting', label: 'Учёт и отчёты', icon: 'carbon:data-table' },
|
|
82
|
-
{ id: 'org', label: 'Оргструктура и права', icon: 'odant:structure' },
|
|
83
|
-
{ id: 'docs', label: 'Документы и задачи', icon: 'enterprise:calendar' },
|
|
84
|
-
{ id: 'system', label: 'Конструктор и ИИ', icon: 'carbon:tools' },
|
|
59
|
+
{ id: 'all', label: 'Все', icon: 'carbon:apps', minTier: 'member' },
|
|
60
|
+
{ id: 'accounting', label: 'Учёт и отчёты', icon: 'carbon:data-table', minTier: 'member' },
|
|
61
|
+
{ id: 'org', label: 'Оргструктура и права', icon: 'odant:structure', minTier: 'unitBoss' },
|
|
62
|
+
{ id: 'docs', label: 'Документы и задачи', icon: 'enterprise:calendar', minTier: 'member' },
|
|
63
|
+
{ id: 'system', label: 'Конструктор и ИИ', icon: 'carbon:tools', minTier: 'unitBoss' },
|
|
85
64
|
]);
|
|
86
65
|
|
|
87
66
|
export const CONSULTANT_PROMPTS = Object.freeze([
|
|
67
|
+
// Стартовый онбординг для нового неназначенного пользователя
|
|
68
|
+
{
|
|
69
|
+
id: 'onb-what-is-work',
|
|
70
|
+
category: 'docs',
|
|
71
|
+
minTier: 'onboarding',
|
|
72
|
+
maxTier: 'onboarding',
|
|
73
|
+
scenario: 0,
|
|
74
|
+
icon: 'icons:help-outline',
|
|
75
|
+
label: 'Как устроена система WORK и с чего начать?',
|
|
76
|
+
prompt: 'Объясни простыми словами, как устроена система WORK (проекты, подразделения, роли и личный кабинет) и с чего начать новому пользователю.',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'onb-my-access',
|
|
80
|
+
category: 'docs',
|
|
81
|
+
minTier: 'onboarding',
|
|
82
|
+
maxTier: 'onboarding',
|
|
83
|
+
scenario: 0,
|
|
84
|
+
icon: 'icons:supervisor-account',
|
|
85
|
+
label: 'Какие у меня сейчас права и почему нет проектов?',
|
|
86
|
+
prompt: 'Объясни, почему у меня пока не видны проекты и отделы, и как руководитель назначает сотрудника в подразделение.',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'onb-profile',
|
|
90
|
+
category: 'docs',
|
|
91
|
+
minTier: 'onboarding',
|
|
92
|
+
maxTier: 'onboarding',
|
|
93
|
+
scenario: 0,
|
|
94
|
+
icon: 'icons:account-circle',
|
|
95
|
+
label: 'Как заполнить профиль и настроить уведомления?',
|
|
96
|
+
prompt: 'Подскажи, как заполнить личный профиль, аватар, часовой пояс и настроить уведомления в моей учётной записи.',
|
|
97
|
+
},
|
|
88
98
|
// Сценарий 1: Оргструктура и рабочие места (BOSS, ROLES, USERS, GUESTS)
|
|
89
99
|
{
|
|
90
100
|
id: 'org-overview',
|
|
91
101
|
category: 'org',
|
|
102
|
+
minTier: 'unitBoss',
|
|
92
103
|
scenario: 1,
|
|
93
104
|
icon: 'odant:structure',
|
|
94
105
|
label: 'Какие организации, подразделения и модули доступны в системе?',
|
|
95
|
-
prompt: 'Покажи структуру организаций (/PROJECTS)
|
|
106
|
+
prompt: 'Покажи доступную структуру организаций (/PROJECTS) и их подразделений в системе.',
|
|
96
107
|
},
|
|
97
108
|
{
|
|
98
109
|
id: 'org-audit-access',
|
|
99
110
|
category: 'org',
|
|
111
|
+
minTier: 'unitBoss',
|
|
100
112
|
scenario: 1,
|
|
101
113
|
icon: 'icons:supervisor-account',
|
|
102
114
|
label: 'Аудит ролей BOSS и рабочих мест (ROLES / USERS / GUESTS)',
|
|
103
|
-
prompt: 'Проведи аудит настроек безопасности по организациям и подразделениям: кто назначен руководителем (BOSS), какие рабочие места (ROLES) созданы, где назначены групповые субъекты USERS и GUESTS и какие ссылки LINKS им выданы.',
|
|
115
|
+
prompt: 'Проведи аудит настроек безопасности по доступным организациям и подразделениям: кто назначен руководителем (BOSS), какие рабочие места (ROLES) созданы, где назначены групповые субъекты USERS и GUESTS и какие ссылки LINKS им выданы.',
|
|
104
116
|
},
|
|
105
117
|
{
|
|
106
118
|
id: 'org-setup-unit',
|
|
107
119
|
category: 'org',
|
|
120
|
+
minTier: 'unitBoss',
|
|
108
121
|
scenario: 1,
|
|
109
122
|
icon: 'icons:add',
|
|
110
123
|
label: 'Развернуть подразделение и настроить рабочие места',
|
|
@@ -114,6 +127,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
114
127
|
{
|
|
115
128
|
id: 'cat-summary',
|
|
116
129
|
category: 'accounting',
|
|
130
|
+
minTier: 'member',
|
|
117
131
|
scenario: 2,
|
|
118
132
|
icon: 'carbon:data-table',
|
|
119
133
|
label: 'Сводка по справочникам и операциям учёта',
|
|
@@ -122,6 +136,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
122
136
|
{
|
|
123
137
|
id: 'cat-quality',
|
|
124
138
|
category: 'accounting',
|
|
139
|
+
minTier: 'member',
|
|
125
140
|
scenario: 2,
|
|
126
141
|
icon: 'carbon:checkmark-outline',
|
|
127
142
|
label: 'Проверить справочники на дубликаты и пустые реквизиты',
|
|
@@ -131,6 +146,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
131
146
|
{
|
|
132
147
|
id: 'op-register',
|
|
133
148
|
category: 'accounting',
|
|
149
|
+
minTier: 'member',
|
|
134
150
|
scenario: 3,
|
|
135
151
|
icon: 'carbon:task-complete',
|
|
136
152
|
label: 'Зарегистрировать и провести хозяйственную операцию',
|
|
@@ -140,6 +156,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
140
156
|
{
|
|
141
157
|
id: 'acc-sheet-balance',
|
|
142
158
|
category: 'accounting',
|
|
159
|
+
minTier: 'member',
|
|
143
160
|
scenario: 4,
|
|
144
161
|
icon: 'carbon:report',
|
|
145
162
|
label: 'Оборотно-сальдовая ведомость и проверка баланса',
|
|
@@ -148,6 +165,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
148
165
|
{
|
|
149
166
|
id: 'acc-turnovers',
|
|
150
167
|
category: 'accounting',
|
|
168
|
+
minTier: 'member',
|
|
151
169
|
scenario: 4,
|
|
152
170
|
icon: 'carbon:analytics',
|
|
153
171
|
label: 'Анализ оборотов и задолженности по субконто (60, 62, 51, 41)',
|
|
@@ -157,6 +175,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
157
175
|
{
|
|
158
176
|
id: 'docs-feed-summary',
|
|
159
177
|
category: 'docs',
|
|
178
|
+
minTier: 'member',
|
|
160
179
|
scenario: 5,
|
|
161
180
|
icon: 'icons:question-answer',
|
|
162
181
|
label: 'Сводка событий, сообщений и задач в ленте',
|
|
@@ -165,6 +184,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
165
184
|
{
|
|
166
185
|
id: 'docs-office-export',
|
|
167
186
|
category: 'docs',
|
|
187
|
+
minTier: 'member',
|
|
168
188
|
scenario: 5,
|
|
169
189
|
icon: 'files-color:s-xlsx',
|
|
170
190
|
label: 'Сформировать отчёт в Excel (.xlsx) или Word (.docx)',
|
|
@@ -173,6 +193,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
173
193
|
{
|
|
174
194
|
id: 'docs-delegate-task',
|
|
175
195
|
category: 'docs',
|
|
196
|
+
minTier: 'member',
|
|
176
197
|
scenario: 5,
|
|
177
198
|
icon: 'carbon:send-alt',
|
|
178
199
|
label: 'Поставить поручение сотруднику со сроком исполнения',
|
|
@@ -182,6 +203,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
182
203
|
{
|
|
183
204
|
id: 'sys-builder-guide',
|
|
184
205
|
category: 'system',
|
|
206
|
+
minTier: 'unitBoss',
|
|
185
207
|
scenario: 6,
|
|
186
208
|
icon: 'carbon:tools',
|
|
187
209
|
label: 'Как добавить поле/аналитику в класс и настроить форму объекта?',
|
|
@@ -190,6 +212,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
190
212
|
{
|
|
191
213
|
id: 'sys-local-ai',
|
|
192
214
|
category: 'system',
|
|
215
|
+
minTier: 'workBoss',
|
|
193
216
|
scenario: 7,
|
|
194
217
|
icon: 'carbon:machine-learning-model',
|
|
195
218
|
label: 'Модели ИИ и дообучение на данных организации (/MODULES/Модели)',
|
|
@@ -198,6 +221,7 @@ export const CONSULTANT_PROMPTS = Object.freeze([
|
|
|
198
221
|
{
|
|
199
222
|
id: 'sys-mcp-skills',
|
|
200
223
|
category: 'system',
|
|
224
|
+
minTier: 'workBoss',
|
|
201
225
|
scenario: 7,
|
|
202
226
|
icon: 'carbon:plug',
|
|
203
227
|
label: 'Прожарка архитектуры (@grill-me), внешние навыки и MCP (/MODULES)',
|
|
@@ -513,7 +537,7 @@ ODA({
|
|
|
513
537
|
<button class="dialog-btn" no-flex ~if="uiReady && canVoice" :on="voiceOn" :title="voiceOn ? 'Выключить живой голосовой диалог' : 'Живой голосовой диалог (с взаимным перебиванием)'" :aria-pressed="voiceOn ? 'true' : 'false'" @tap="toggleVoice()">
|
|
514
538
|
<work-voice-bars :on="voiceOn"></work-voice-bars>
|
|
515
539
|
</button>
|
|
516
|
-
<oda-button no-flex icon="carbon:plug" :icon-size="16" title="Центр расширений ИИ: MCP-серверы (/MODULES) и Навыки (Skills)" @tap="openMcpAndSkills"></oda-button>
|
|
540
|
+
<oda-button no-flex ~if="isWorkBoss" icon="carbon:plug" :icon-size="16" title="Центр расширений ИИ: MCP-серверы (/MODULES) и Навыки (Skills)" @tap="openMcpAndSkills"></oda-button>
|
|
517
541
|
<oda-button no-flex icon="carbon:idea" :icon-size="16" title="Типовые сценарии и промпты" @tap="togglePrompts"></oda-button>
|
|
518
542
|
<oda-button no-flex icon="carbon:recently-viewed" :icon-size="16" title="Мои консультации (из личных логов)" @tap="toggleHistory"></oda-button>
|
|
519
543
|
<oda-button no-flex icon="carbon:chat" :icon-size="16" title="Открыть ленту пользователя" @tap="openUserFeed"></oda-button>
|
|
@@ -526,7 +550,7 @@ ODA({
|
|
|
526
550
|
<span>Типовые сценарии и промпты</span>
|
|
527
551
|
<oda-button icon="carbon:close" :icon-size="14" @tap="showPrompts = false"></oda-button>
|
|
528
552
|
</div>
|
|
529
|
-
<div class="prompt-cats">
|
|
553
|
+
<div class="prompt-cats" ~if="showCategoryPills">
|
|
530
554
|
<button class="prompt-cat-pill" ~for="promptCategories" :active="promptCategory === $for.item.id" @tap="promptCategory = $for.item.id">
|
|
531
555
|
<oda-icon no-flex :icon="$for.item.icon" :icon-size="12"></oda-icon>
|
|
532
556
|
<span>{{$for.item.label}}</span>
|
|
@@ -563,7 +587,7 @@ ODA({
|
|
|
563
587
|
<div class="welcome-text">
|
|
564
588
|
Задайте вопрос по работе в системе, структуре данных или учёту, выберите один из типовых сценариев ниже либо нажмите кнопку <b>«?»</b> в шапке открытой формы. Все диалоги сохраняются как задачи в ваших личных логах.
|
|
565
589
|
</div>
|
|
566
|
-
<div class="quick-chips" ~if="activeFormSummary">
|
|
590
|
+
<div class="quick-chips" ~if="activeFormSummary && !isUnassignedUser">
|
|
567
591
|
<button class="quick-chip" @tap="askCurrentForm">
|
|
568
592
|
<oda-icon no-flex icon="icons:dashboard" :icon-size="15"></oda-icon>
|
|
569
593
|
<span>Что сейчас открыто в форме «{{activeFormSummary.label}}»?</span>
|
|
@@ -573,7 +597,7 @@ ODA({
|
|
|
573
597
|
<span>{{contextSecondaryPrompt.label}}</span>
|
|
574
598
|
</button>
|
|
575
599
|
</div>
|
|
576
|
-
<div class="prompt-cats">
|
|
600
|
+
<div class="prompt-cats" ~if="showCategoryPills">
|
|
577
601
|
<button class="prompt-cat-pill" ~for="promptCategories" :active="promptCategory === $for.item.id" @tap="promptCategory = $for.item.id">
|
|
578
602
|
<oda-icon no-flex :icon="$for.item.icon" :icon-size="12"></oda-icon>
|
|
579
603
|
<span>{{$for.item.label}}</span>
|
|
@@ -600,7 +624,7 @@ ODA({
|
|
|
600
624
|
<oda-button class="down" ~if="hasMessages && !pinned && !needsHuman" icon="carbon:arrow-down" :icon-size="18" title="К последнему" @tap="toBottom"></oda-button>
|
|
601
625
|
<oda-button class="down attn" ~if="hasMessages && !pinned && needsHuman" accent-invert icon="carbon:arrow-down" :icon-size="16" label="Агент ждёт вас" title="Перейти к вопросу или разрешению" @tap="toBottom"></oda-button>
|
|
602
626
|
<microchat-voice ~if="voiceOn"></microchat-voice>
|
|
603
|
-
<work-prompt-bar ai ::value ::files :pending="busy" :placeholder="placeholderText"
|
|
627
|
+
<work-prompt-bar ai :hide-model-picker="isUnassignedUser" ::value ::files :pending="busy" :placeholder="placeholderText"
|
|
604
628
|
::model
|
|
605
629
|
@model-changed.stop="onModelChanged"
|
|
606
630
|
@send="send" @stop="stop"></work-prompt-bar>
|
|
@@ -630,6 +654,7 @@ ODA({
|
|
|
630
654
|
recentTasks: [],
|
|
631
655
|
activeFormContext: null,
|
|
632
656
|
activeFormSummary: null,
|
|
657
|
+
userScope: null,
|
|
633
658
|
_sending: false,
|
|
634
659
|
voiceOn: {
|
|
635
660
|
$def: false,
|
|
@@ -638,16 +663,46 @@ ODA({
|
|
|
638
663
|
},
|
|
639
664
|
},
|
|
640
665
|
|
|
666
|
+
get accessTier() {
|
|
667
|
+
const s = this.userScope;
|
|
668
|
+
if (!s)
|
|
669
|
+
return globalThis.WORK?.DEV_MODE ? 'workBoss' : 'onboarding';
|
|
670
|
+
if (s.isWorkBoss)
|
|
671
|
+
return 'workBoss';
|
|
672
|
+
if (s.isUnitBoss)
|
|
673
|
+
return 'unitBoss';
|
|
674
|
+
if (s.hasAnyRole)
|
|
675
|
+
return 'member';
|
|
676
|
+
return 'onboarding';
|
|
677
|
+
},
|
|
678
|
+
get isUnassignedUser() {
|
|
679
|
+
return this.accessTier === 'onboarding';
|
|
680
|
+
},
|
|
681
|
+
get isWorkBoss() {
|
|
682
|
+
return this.accessTier === 'workBoss';
|
|
683
|
+
},
|
|
684
|
+
get showCategoryPills() {
|
|
685
|
+
return this.promptCategories.length > 1;
|
|
686
|
+
},
|
|
641
687
|
get promptCategories() {
|
|
642
|
-
|
|
688
|
+
const rank = TIER_RANK[this.accessTier] ?? 0;
|
|
689
|
+
return CONSULTANT_PROMPT_CATEGORIES.filter(c => rank >= (TIER_RANK[c.minTier] ?? 0));
|
|
643
690
|
},
|
|
644
691
|
get filteredPrompts() {
|
|
692
|
+
const rank = TIER_RANK[this.accessTier] ?? 0;
|
|
693
|
+
const allowed = CONSULTANT_PROMPTS.filter(p => {
|
|
694
|
+
const minR = TIER_RANK[p.minTier] ?? 0;
|
|
695
|
+
const maxR = p.maxTier != null ? (TIER_RANK[p.maxTier] ?? 99) : 99;
|
|
696
|
+
return rank >= minR && rank <= maxR;
|
|
697
|
+
});
|
|
645
698
|
const cat = this.promptCategory || 'all';
|
|
646
|
-
if (cat === 'all')
|
|
647
|
-
return
|
|
648
|
-
return
|
|
699
|
+
if (cat === 'all' || this.isUnassignedUser)
|
|
700
|
+
return allowed;
|
|
701
|
+
return allowed.filter(p => p.category === cat);
|
|
649
702
|
},
|
|
650
703
|
get contextSecondaryPrompt() {
|
|
704
|
+
if (this.isUnassignedUser)
|
|
705
|
+
return null;
|
|
651
706
|
const ctx = this.activeFormSummary;
|
|
652
707
|
if (!ctx?.path)
|
|
653
708
|
return null;
|
|
@@ -753,6 +808,7 @@ ODA({
|
|
|
753
808
|
attached() {
|
|
754
809
|
ensureConsultantUI().then(() => {
|
|
755
810
|
this.uiReady = true;
|
|
811
|
+
this._refreshUserScope();
|
|
756
812
|
this._hydrateModel();
|
|
757
813
|
this.refreshFormContext();
|
|
758
814
|
});
|
|
@@ -829,9 +885,28 @@ ODA({
|
|
|
829
885
|
v.addEventListener(k, fn);
|
|
830
886
|
},
|
|
831
887
|
|
|
888
|
+
async _refreshUserScope() {
|
|
889
|
+
if (!globalThis.WORK?.uid) {
|
|
890
|
+
this.userScope = { isUnassigned: true, hasAnyRole: false, isUnitBoss: false, isWorkBoss: false };
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (globalThis.WORK?.DEV_MODE) {
|
|
894
|
+
this.userScope = { isUnassigned: false, hasAnyRole: true, isUnitBoss: true, isWorkBoss: true };
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
const res = await globalThis.WORK.fetch('/', 'my_scope').catch(() => null);
|
|
898
|
+
if (res) {
|
|
899
|
+
this.userScope = res;
|
|
900
|
+
const cats = this.promptCategories;
|
|
901
|
+
if (this.promptCategory !== 'all' && !cats.some(c => c.id === this.promptCategory))
|
|
902
|
+
this.promptCategory = 'all';
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
|
|
832
906
|
async onShow() {
|
|
833
907
|
await ensureConsultantUI();
|
|
834
908
|
this.uiReady = true;
|
|
909
|
+
this._refreshUserScope();
|
|
835
910
|
this._hydrateModel();
|
|
836
911
|
this.refreshFormContext();
|
|
837
912
|
this.async(() => {
|
|
@@ -892,12 +967,9 @@ ODA({
|
|
|
892
967
|
if (this.model && !/(flux|sdxl|stable-?diffusion|z-image|embedding|bge-|rerank|whisper|\basr\b|\btts\b|\bstt\b|voice|kokoro|musicgen|wan2|ltx-video)/i.test(this.model))
|
|
893
968
|
return;
|
|
894
969
|
try {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
|
|
898
|
-
const leaf = firstChatLeaf(aiRoot);
|
|
899
|
-
if (leaf?.path)
|
|
900
|
-
this.model = leaf.path;
|
|
970
|
+
const defModel = await WORK.fetch('/', 'agent_default_model', { nodePath: '/' }).catch(() => '');
|
|
971
|
+
if (typeof defModel === 'string' && defModel.trim())
|
|
972
|
+
this.model = defModel.trim();
|
|
901
973
|
}
|
|
902
974
|
catch { /* ignore */ }
|
|
903
975
|
},
|
|
@@ -922,22 +994,7 @@ ODA({
|
|
|
922
994
|
}
|
|
923
995
|
}
|
|
924
996
|
catch { /* ignore */ }
|
|
925
|
-
|
|
926
|
-
const usersRoot = await WORK.get_item('/USERS');
|
|
927
|
-
const items = await usersRoot?.items;
|
|
928
|
-
if (Array.isArray(items) && items.length) {
|
|
929
|
-
const found = items.find(u => u.id === 'CA4E097FF6C1D387') || items[0];
|
|
930
|
-
if (found?.save_file)
|
|
931
|
-
return found;
|
|
932
|
-
if (found?.id) {
|
|
933
|
-
const u = await WORK.get_$user(found.id);
|
|
934
|
-
if (u)
|
|
935
|
-
return u;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
catch { /* ignore */ }
|
|
940
|
-
return this.$item || await WORK.get_item('/');
|
|
997
|
+
return null;
|
|
941
998
|
},
|
|
942
999
|
|
|
943
1000
|
onModelChanged(e) {
|
|
@@ -183,11 +183,12 @@ export default {
|
|
|
183
183
|
_leftButtonsSig(list) {
|
|
184
184
|
return (list || []).map(b => `${b.icon || ''}|${b.title || ''}|${Boolean(b.rainbow)}|${Boolean(b.errorInvert)}|${b.style || ''}`).join(';;');
|
|
185
185
|
},
|
|
186
|
-
/** Пересобрать кнопки (только при реальном изменении
|
|
187
|
-
_refreshLeftButtons() {
|
|
186
|
+
/** Пересобрать кнопки (только при реальном изменении состава/иконки или пустом списке, чтобы левая панель не мигала и не пропадала). */
|
|
187
|
+
_refreshLeftButtons(force = false) {
|
|
188
188
|
const next = this._buildLeftButtons();
|
|
189
189
|
const sig = this._leftButtonsSig(next);
|
|
190
|
-
|
|
190
|
+
const emptyNow = !Array.isArray(this.left_buttons) || this.left_buttons.length === 0;
|
|
191
|
+
if (force || emptyNow || sig !== this._lastLeftButtonsSig) {
|
|
191
192
|
this._lastLeftButtonsSig = sig;
|
|
192
193
|
this.left_buttons = next;
|
|
193
194
|
}
|
|
@@ -301,23 +302,9 @@ export default {
|
|
|
301
302
|
if (this.$item.type === '$server') {
|
|
302
303
|
try {
|
|
303
304
|
const isAdm = await this.$item.isBoss;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
this.hideTops = 0;
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const info = await WORK.fetch(location.origin + '/', 'info', { deep: 1, tree: 'main' }).catch(() => null);
|
|
311
|
-
if (Array.isArray(info?.items) && info.items.length === 0 && WORK.USER) {
|
|
312
|
-
this._treeScopeUser = WORK.USER;
|
|
313
|
-
this.hideRoots = 0;
|
|
314
|
-
this.hideTops = 0;
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
this._treeScopeUser = null;
|
|
318
|
-
this.hideRoots = 2;
|
|
319
|
-
this.hideTops = 1;
|
|
320
|
-
}
|
|
305
|
+
this._treeScopeUser = null;
|
|
306
|
+
this.hideRoots = 2;
|
|
307
|
+
this.hideTops = isAdm ? 0 : 1;
|
|
321
308
|
}
|
|
322
309
|
catch { /* ignore */ }
|
|
323
310
|
}
|
|
@@ -848,10 +835,11 @@ export default {
|
|
|
848
835
|
if (this.left_drawer)
|
|
849
836
|
this.left_drawer.closed = false;
|
|
850
837
|
}
|
|
851
|
-
this._refreshLeftButtons();
|
|
838
|
+
this._refreshLeftButtons(true);
|
|
852
839
|
this._initTopLicenseBanner();
|
|
853
840
|
this._refreshSupportBadge();
|
|
854
841
|
this._syncExplorerTreeScope();
|
|
842
|
+
this.$('#consultant')?._refreshUserScope?.();
|
|
855
843
|
this.render?.();
|
|
856
844
|
});
|
|
857
845
|
if (!this._onNodeDeleted && WORK.chatEvents) {
|