@hed-hog/core 0.0.350 → 0.0.353
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/dist/access-log/access-log.controller.d.ts +16 -0
- package/dist/access-log/access-log.controller.d.ts.map +1 -0
- package/dist/access-log/access-log.controller.js +44 -0
- package/dist/access-log/access-log.controller.js.map +1 -0
- package/dist/access-log/access-log.interceptor.d.ts +9 -0
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -0
- package/dist/access-log/access-log.interceptor.js +46 -0
- package/dist/access-log/access-log.interceptor.js.map +1 -0
- package/dist/access-log/access-log.module.d.ts +3 -0
- package/dist/access-log/access-log.module.d.ts.map +1 -0
- package/dist/access-log/access-log.module.js +29 -0
- package/dist/access-log/access-log.module.js.map +1 -0
- package/dist/access-log/access-log.service.d.ts +47 -0
- package/dist/access-log/access-log.service.d.ts.map +1 -0
- package/dist/access-log/access-log.service.js +113 -0
- package/dist/access-log/access-log.service.js.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts +8 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.js +42 -0
- package/dist/access-log/dto/query-access-log.dto.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +9 -9
- package/dist/auth/auth.service.d.ts +19 -19
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +0 -4
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +2 -2
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +0 -1
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core/system.module.d.ts.map +1 -1
- package/dist/core/system.module.js +1 -0
- package/dist/core/system.module.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +12 -0
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +4 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/file/file.controller.js +0 -1
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +65 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +151 -3
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/abstract.provider.d.ts +8 -0
- package/dist/file/provider/abstract.provider.d.ts.map +1 -1
- package/dist/file/provider/abstract.provider.js.map +1 -1
- package/dist/file/provider/azure.provider.d.ts +4 -0
- package/dist/file/provider/azure.provider.d.ts.map +1 -1
- package/dist/file/provider/azure.provider.js +14 -0
- package/dist/file/provider/azure.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts +4 -0
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +14 -0
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts +4 -0
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +19 -0
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/provider.factory.d.ts.map +1 -1
- package/dist/file/provider/provider.factory.js +3 -0
- package/dist/file/provider/provider.factory.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +4 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +17 -0
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/mcp/mcp-audit.service.d.ts +3 -1
- package/dist/mcp/mcp-audit.service.d.ts.map +1 -1
- package/dist/mcp/mcp-audit.service.js +14 -2
- package/dist/mcp/mcp-audit.service.js.map +1 -1
- package/dist/mcp/mcp.controller.d.ts +3 -1
- package/dist/mcp/mcp.controller.d.ts.map +1 -1
- package/dist/mcp/mcp.controller.js +10 -2
- package/dist/mcp/mcp.controller.js.map +1 -1
- package/dist/mcp/mcp.module.d.ts.map +1 -1
- package/dist/mcp/mcp.module.js +72 -0
- package/dist/mcp/mcp.module.js.map +1 -1
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts +45 -0
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js +214 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js +89 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts +29 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js +149 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts +30 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js +185 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.js +140 -0
- package/dist/mcp/tools/core-files.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js +168 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +32 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts +14 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js +106 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts +36 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js +184 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js +118 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts +40 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js +268 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts +31 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js +111 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts +70 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js +355 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts +52 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js +254 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts +47 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js +250 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js +128 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts +25 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts.map +1 -1
- package/dist/mcp/tools/core-settings.mcp-tools.js +138 -0
- package/dist/mcp/tools/core-settings.mcp-tools.js.map +1 -1
- package/dist/mcp/tools/core-system.mcp-tools.d.ts +8 -0
- package/dist/mcp/tools/core-system.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-system.mcp-tools.js +40 -0
- package/dist/mcp/tools/core-system.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts +46 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js +266 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +1 -1
- package/dist/mcp-chat/mcp-chat.service.d.ts +25 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +666 -36
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/notification/notification.controller.d.ts +8 -4
- package/dist/notification/notification.controller.d.ts.map +1 -1
- package/dist/notification/notification.controller.js +12 -0
- package/dist/notification/notification.controller.js.map +1 -1
- package/dist/notification/notification.service.d.ts +19 -5
- package/dist/notification/notification.service.d.ts.map +1 -1
- package/dist/notification/notification.service.js +155 -9
- package/dist/notification/notification.service.js.map +1 -1
- package/dist/pdf/pdf.service.js +1 -1
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +3 -3
- package/dist/profile/profile.controller.js +0 -1
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.module.d.ts.map +1 -1
- package/dist/profile/profile.module.js +1 -0
- package/dist/profile/profile.module.js.map +1 -1
- package/dist/profile/profile.service.d.ts +3 -3
- package/dist/session/session.controller.d.ts +2 -2
- package/dist/session/session.service.d.ts +6 -6
- package/dist/setting/setting.controller.d.ts +1 -1
- package/dist/setting/setting.service.d.ts +1 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +1 -4
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/task/task.service.d.ts +1 -0
- package/dist/task/task.service.d.ts.map +1 -1
- package/dist/task/task.service.js +25 -0
- package/dist/task/task.service.js.map +1 -1
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +0 -1
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +9 -9
- package/dist/user/user.service.d.ts +21 -21
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts +22 -0
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js +120 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +7 -5
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +18 -5
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +14 -5
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +174 -41
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/hedhog/data/menu.yaml +15 -0
- package/hedhog/data/route.yaml +1304 -0
- package/hedhog/data/setting_group.yaml +67 -0
- package/hedhog/data/setting_subgroup.yaml +16 -0
- package/hedhog/frontend/app/access-log/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +10 -3
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +33 -13
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +1817 -356
- package/hedhog/frontend/app/mcp_chat/chat-components.tsx.ejs +43 -5
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +35 -7
- package/hedhog/frontend/app/menu/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/roles/page.tsx.ejs +18 -6
- package/hedhog/frontend/app/routes/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +344 -171
- package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +310 -304
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +25 -7
- package/hedhog/frontend/messages/en.json +104 -3
- package/hedhog/frontend/messages/pt.json +104 -3
- package/hedhog/table/access_log.yaml +31 -0
- package/package.json +4 -3
- package/src/access-log/access-log.controller.ts +29 -0
- package/src/access-log/access-log.interceptor.ts +38 -0
- package/src/access-log/access-log.module.ts +16 -0
- package/src/access-log/access-log.service.ts +129 -0
- package/src/access-log/dto/query-access-log.dto.ts +23 -0
- package/src/auth/auth.service.ts +0 -7
- package/src/challenge/challenge.service.ts +0 -2
- package/src/core/system.module.ts +1 -0
- package/src/core.module.ts +12 -0
- package/src/dashboard/dashboard.module.ts +4 -1
- package/src/file/file.controller.ts +14 -14
- package/src/file/file.service.ts +198 -4
- package/src/file/provider/abstract.provider.ts +10 -0
- package/src/file/provider/azure.provider.ts +24 -0
- package/src/file/provider/gcs.provider.ts +20 -0
- package/src/file/provider/local.provider.ts +30 -2
- package/src/file/provider/provider.factory.ts +3 -0
- package/src/file/provider/s3.provider.ts +22 -0
- package/src/mcp/mcp-audit.service.ts +47 -36
- package/src/mcp/mcp.controller.ts +40 -30
- package/src/mcp/mcp.module.ts +72 -0
- package/src/mcp/tools/core-ai.mcp-tools.ts +156 -0
- package/src/mcp/tools/core-dashboard-items.mcp-tools.ts +63 -0
- package/src/mcp/tools/core-dashboard.mcp-tools.ts +103 -0
- package/src/mcp/tools/core-event-webhooks.mcp-tools.ts +134 -0
- package/src/mcp/tools/core-files.mcp-tools.ts +105 -0
- package/src/mcp/tools/core-integration-events.mcp-tools.ts +118 -0
- package/src/mcp/tools/core-mail-profile.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-mail-sent.mcp-tools.ts +76 -0
- package/src/mcp/tools/core-mail.mcp-tools.ts +130 -0
- package/src/mcp/tools/core-mcp-chat.mcp-tools.ts +81 -0
- package/src/mcp/tools/core-menus.mcp-tools.ts +197 -0
- package/src/mcp/tools/core-notifications.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-profile.mcp-tools.ts +74 -0
- package/src/mcp/tools/core-roles.mcp-tools.ts +288 -0
- package/src/mcp/tools/core-routes.mcp-tools.ts +196 -0
- package/src/mcp/tools/core-screens.mcp-tools.ts +186 -0
- package/src/mcp/tools/core-sessions.mcp-tools.ts +97 -0
- package/src/mcp/tools/core-settings.mcp-tools.ts +171 -53
- package/src/mcp/tools/core-system.mcp-tools.ts +19 -0
- package/src/mcp/tools/core-webhooks.mcp-tools.ts +199 -0
- package/src/mcp-chat/mcp-chat.service.ts +887 -38
- package/src/notification/notification.controller.ts +20 -8
- package/src/notification/notification.service.ts +209 -9
- package/src/pdf/pdf.service.ts +1 -1
- package/src/profile/profile.controller.ts +1 -1
- package/src/profile/profile.module.ts +1 -0
- package/src/setting/setting.service.ts +8 -11
- package/src/task/task.service.ts +31 -0
- package/src/token/token.service.ts +0 -2
- package/src/webhook-integration/dto/webhook-action.dto.ts +96 -0
- package/src/webhook-integration/webhook-integration.controller.ts +124 -103
- package/src/webhook-integration/webhook-integration.service.ts +267 -64
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
Wrench,
|
|
19
19
|
X,
|
|
20
20
|
} from 'lucide-react';
|
|
21
|
-
import { RefObject, useRef, useState } from 'react';
|
|
21
|
+
import { RefObject, useEffect, useRef, useState } from 'react';
|
|
22
22
|
import ReactMarkdown from 'react-markdown';
|
|
23
23
|
import remarkGfm from 'remark-gfm';
|
|
24
24
|
import { Conversation, Message } from './chat-types';
|
|
@@ -175,13 +175,37 @@ export function ToolBadge({
|
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
const TYPING_STATUSES = [
|
|
179
|
+
'Pensando...',
|
|
180
|
+
'Consultando ferramentas...',
|
|
181
|
+
'Processando informações...',
|
|
182
|
+
'Aguardando resposta...',
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
const TYPING_STATUS_DURATIONS = [3000, 5000, 5000];
|
|
186
|
+
|
|
178
187
|
export function TypingIndicator() {
|
|
188
|
+
const [statusIndex, setStatusIndex] = useState(0);
|
|
189
|
+
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
setStatusIndex(0);
|
|
192
|
+
}, []);
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
const duration = TYPING_STATUS_DURATIONS[statusIndex];
|
|
196
|
+
if (duration === undefined) return;
|
|
197
|
+
const timer = setTimeout(() => {
|
|
198
|
+
setStatusIndex((i) => Math.min(i + 1, TYPING_STATUSES.length - 1));
|
|
199
|
+
}, duration);
|
|
200
|
+
return () => clearTimeout(timer);
|
|
201
|
+
}, [statusIndex]);
|
|
202
|
+
|
|
179
203
|
return (
|
|
180
204
|
<div className="flex items-start gap-3">
|
|
181
205
|
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted ring-2 ring-background">
|
|
182
206
|
<Bot className="h-4 w-4 text-muted-foreground" />
|
|
183
207
|
</div>
|
|
184
|
-
<div className="flex items-center gap-
|
|
208
|
+
<div className="flex items-center gap-2 rounded-2xl rounded-tl-sm bg-muted px-4 py-3 shadow-sm">
|
|
185
209
|
<span
|
|
186
210
|
className="h-1.5 w-1.5 rounded-full bg-muted-foreground/60 animate-bounce"
|
|
187
211
|
style={{ animationDelay: '0ms' }}
|
|
@@ -194,6 +218,18 @@ export function TypingIndicator() {
|
|
|
194
218
|
className="h-1.5 w-1.5 rounded-full bg-muted-foreground/60 animate-bounce"
|
|
195
219
|
style={{ animationDelay: '300ms' }}
|
|
196
220
|
/>
|
|
221
|
+
<AnimatePresence mode="wait">
|
|
222
|
+
<motion.span
|
|
223
|
+
key={statusIndex}
|
|
224
|
+
initial={{ opacity: 0, x: 6 }}
|
|
225
|
+
animate={{ opacity: 1, x: 0 }}
|
|
226
|
+
exit={{ opacity: 0, x: -6 }}
|
|
227
|
+
transition={{ duration: 0.2 }}
|
|
228
|
+
className="ml-1 text-xs text-muted-foreground select-none"
|
|
229
|
+
>
|
|
230
|
+
{TYPING_STATUSES[statusIndex]}
|
|
231
|
+
</motion.span>
|
|
232
|
+
</AnimatePresence>
|
|
197
233
|
</div>
|
|
198
234
|
</div>
|
|
199
235
|
);
|
|
@@ -285,6 +321,7 @@ type ChatInputProps = {
|
|
|
285
321
|
input: string;
|
|
286
322
|
isSending: boolean;
|
|
287
323
|
isUploadingFile: boolean;
|
|
324
|
+
disabled?: boolean;
|
|
288
325
|
attachments: Array<{ id: number; name: string }>;
|
|
289
326
|
placeholder: string;
|
|
290
327
|
sendLabel: string;
|
|
@@ -304,6 +341,7 @@ export function ChatInput({
|
|
|
304
341
|
input,
|
|
305
342
|
isSending,
|
|
306
343
|
isUploadingFile,
|
|
344
|
+
disabled = false,
|
|
307
345
|
attachments,
|
|
308
346
|
placeholder,
|
|
309
347
|
sendLabel,
|
|
@@ -420,7 +458,7 @@ export function ChatInput({
|
|
|
420
458
|
className="shrink-0 h-10 w-10 rounded-full cursor-pointer border border-border/60 bg-background/85 hover:bg-background"
|
|
421
459
|
aria-label={attachLabel}
|
|
422
460
|
onClick={handleOpenFilePicker}
|
|
423
|
-
disabled={isSending || isUploadingFile}
|
|
461
|
+
disabled={disabled || isSending || isUploadingFile}
|
|
424
462
|
>
|
|
425
463
|
{isUploadingFile ? (
|
|
426
464
|
<Loader2 className="h-4 w-4 animate-spin" />
|
|
@@ -434,7 +472,7 @@ export function ChatInput({
|
|
|
434
472
|
className="resize-none flex-1 border-0! bg-transparent! shadow-none! focus-visible:ring-0! px-2.5 py-2.5 min-h-10 max-h-40 md:max-h-75 overflow-y-auto text-sm text-foreground leading-5 placeholder:text-sm placeholder:leading-5 placeholder:text-muted-foreground transition-[height] duration-150 ease-out"
|
|
435
473
|
placeholder={isUploadingFile ? uploadingFileLabel : placeholder}
|
|
436
474
|
value={input}
|
|
437
|
-
disabled={isSending}
|
|
475
|
+
disabled={disabled || isSending}
|
|
438
476
|
onChange={(e) => onInputChange(e.target.value)}
|
|
439
477
|
onKeyDown={(e) => {
|
|
440
478
|
if (submitOnEnter && e.key === 'Enter' && !e.shiftKey) {
|
|
@@ -449,7 +487,7 @@ export function ChatInput({
|
|
|
449
487
|
size="icon"
|
|
450
488
|
className="shrink-0 h-10 w-10 rounded-full cursor-pointer"
|
|
451
489
|
aria-label={isSending ? sendingLabel : sendLabel}
|
|
452
|
-
disabled={isSending || (!input.trim() && attachments.length === 0)}
|
|
490
|
+
disabled={disabled || isSending || (!input.trim() && attachments.length === 0)}
|
|
453
491
|
onClick={onSend}
|
|
454
492
|
>
|
|
455
493
|
{isSending ? (
|
|
@@ -14,11 +14,11 @@ import { Button } from '@/components/ui/button';
|
|
|
14
14
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
15
15
|
import {
|
|
16
16
|
Sheet,
|
|
17
|
-
SheetContent,
|
|
18
17
|
SheetDescription,
|
|
19
18
|
SheetHeader,
|
|
20
19
|
SheetTitle,
|
|
21
20
|
} from '@/components/ui/sheet';
|
|
21
|
+
import { ResizableSheetContent } from '@/components/ui/resizable-sheet-content';
|
|
22
22
|
import { SidebarTrigger } from '@/components/ui/sidebar';
|
|
23
23
|
import { useFormDraft } from '@/hooks/use-form-draft';
|
|
24
24
|
import { useIsMobile } from '@/hooks/use-mobile';
|
|
@@ -31,8 +31,9 @@ import { ChatInput, ConversationSidebar, MessageFeed } from './chat-components';
|
|
|
31
31
|
import { Conversation, Message } from './chat-types';
|
|
32
32
|
|
|
33
33
|
export default function McpChatPage() {
|
|
34
|
-
const { request, currentLocaleCode, refetchUser, accessToken } = useApp();
|
|
34
|
+
const { request, currentLocaleCode, refetchUser, accessToken, getSettingValue } = useApp();
|
|
35
35
|
const t = useTranslations('core.McpChatPage');
|
|
36
|
+
const mcpEnabled = getSettingValue('mcp-enabled') !== false;
|
|
36
37
|
const isMobile = useIsMobile();
|
|
37
38
|
|
|
38
39
|
const [selectedConvId, setSelectedConvId] = useState<number | null>(null);
|
|
@@ -84,10 +85,12 @@ export default function McpChatPage() {
|
|
|
84
85
|
});
|
|
85
86
|
return res.data;
|
|
86
87
|
},
|
|
88
|
+
enabled: mcpEnabled,
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
const convList = useMemo(() => conversations ?? [], [conversations]);
|
|
90
92
|
const selectedConv = convList.find((c) => c.id === selectedConvId) ?? null;
|
|
93
|
+
const activeMessageConversationId = mcpEnabled ? selectedConvId : null;
|
|
91
94
|
|
|
92
95
|
useEffect(() => {
|
|
93
96
|
if (selectedConvId !== null || convList.length === 0) return;
|
|
@@ -114,7 +117,7 @@ export default function McpChatPage() {
|
|
|
114
117
|
}, [selectedConvId, loadMessageInputDraft]);
|
|
115
118
|
|
|
116
119
|
useEffect(() => {
|
|
117
|
-
if (!
|
|
120
|
+
if (!activeMessageConversationId) {
|
|
118
121
|
setMessages([]);
|
|
119
122
|
setIsLoadingMessages(false);
|
|
120
123
|
return;
|
|
@@ -124,7 +127,7 @@ export default function McpChatPage() {
|
|
|
124
127
|
setIsLoadingMessages(true);
|
|
125
128
|
|
|
126
129
|
request<Message[]>({
|
|
127
|
-
url: `/mcp-chat/${
|
|
130
|
+
url: `/mcp-chat/${activeMessageConversationId}/messages`,
|
|
128
131
|
method: 'GET',
|
|
129
132
|
})
|
|
130
133
|
.then((res) => {
|
|
@@ -147,7 +150,7 @@ export default function McpChatPage() {
|
|
|
147
150
|
return () => {
|
|
148
151
|
isMounted = false;
|
|
149
152
|
};
|
|
150
|
-
}, [request,
|
|
153
|
+
}, [request, activeMessageConversationId, t]);
|
|
151
154
|
|
|
152
155
|
useEffect(() => {
|
|
153
156
|
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
@@ -384,6 +387,8 @@ export default function McpChatPage() {
|
|
|
384
387
|
}
|
|
385
388
|
|
|
386
389
|
async function handleNewConversation() {
|
|
390
|
+
if (!mcpEnabled) return null;
|
|
391
|
+
|
|
387
392
|
try {
|
|
388
393
|
stopStreaming();
|
|
389
394
|
const res = await request<Conversation>({
|
|
@@ -407,6 +412,7 @@ export default function McpChatPage() {
|
|
|
407
412
|
|
|
408
413
|
async function handleSend() {
|
|
409
414
|
if (
|
|
415
|
+
!mcpEnabled ||
|
|
410
416
|
(!input.trim() && attachments.length === 0) ||
|
|
411
417
|
isSending ||
|
|
412
418
|
isUploadingFile
|
|
@@ -579,6 +585,22 @@ export default function McpChatPage() {
|
|
|
579
585
|
/>
|
|
580
586
|
);
|
|
581
587
|
|
|
588
|
+
if (!mcpEnabled) {
|
|
589
|
+
return (
|
|
590
|
+
<div className="flex h-dvh min-h-0 items-center justify-center bg-background px-4">
|
|
591
|
+
<div className="flex max-w-md flex-col items-center gap-3 text-center">
|
|
592
|
+
<div className="flex h-14 w-14 items-center justify-center rounded-2xl bg-muted text-muted-foreground ring-1 ring-border">
|
|
593
|
+
<Bot className="h-7 w-7" />
|
|
594
|
+
</div>
|
|
595
|
+
<h1 className="text-xl font-semibold tracking-tight">
|
|
596
|
+
{t('title')}
|
|
597
|
+
</h1>
|
|
598
|
+
<p className="text-sm text-muted-foreground">{t('mcpDisabled')}</p>
|
|
599
|
+
</div>
|
|
600
|
+
</div>
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
|
|
582
604
|
return (
|
|
583
605
|
<div className="flex h-dvh min-h-0 overflow-hidden bg-background">
|
|
584
606
|
{/* Sidebar */}
|
|
@@ -590,7 +612,11 @@ export default function McpChatPage() {
|
|
|
590
612
|
open={isMobileConversationsOpen}
|
|
591
613
|
onOpenChange={setIsMobileConversationsOpen}
|
|
592
614
|
>
|
|
593
|
-
<
|
|
615
|
+
<ResizableSheetContent
|
|
616
|
+
sheetId="core-mcp-chat-mobile-conversations-sheet"
|
|
617
|
+
defaultWidth={320}
|
|
618
|
+
minWidth={280}
|
|
619
|
+
maxWidth={560}
|
|
594
620
|
side="left"
|
|
595
621
|
className="w-[85vw] max-w-[320px] p-0 [&>button]:top-2 [&>button]:right-2 [&>button]:z-20"
|
|
596
622
|
>
|
|
@@ -601,7 +627,7 @@ export default function McpChatPage() {
|
|
|
601
627
|
<div className="flex h-full flex-col bg-muted/30 pt-11">
|
|
602
628
|
{sidebarContent}
|
|
603
629
|
</div>
|
|
604
|
-
</
|
|
630
|
+
</ResizableSheetContent>
|
|
605
631
|
</Sheet>
|
|
606
632
|
|
|
607
633
|
{/* Main area */}
|
|
@@ -645,6 +671,7 @@ export default function McpChatPage() {
|
|
|
645
671
|
input={input}
|
|
646
672
|
isSending={isSending}
|
|
647
673
|
isUploadingFile={isUploadingFile}
|
|
674
|
+
disabled={!mcpEnabled}
|
|
648
675
|
attachments={attachments}
|
|
649
676
|
placeholder={t('placeholder')}
|
|
650
677
|
sendLabel={t('send')}
|
|
@@ -699,6 +726,7 @@ export default function McpChatPage() {
|
|
|
699
726
|
input={input}
|
|
700
727
|
isSending={isSending}
|
|
701
728
|
isUploadingFile={isUploadingFile}
|
|
729
|
+
disabled={!mcpEnabled}
|
|
702
730
|
attachments={attachments}
|
|
703
731
|
placeholder={t('placeholder')}
|
|
704
732
|
sendLabel={t('send')}
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
ResizablePanel,
|
|
58
58
|
ResizablePanelGroup,
|
|
59
59
|
} from '@/components/ui/resizable';
|
|
60
|
+
import { ResizableSheetContent } from '@/components/ui/resizable-sheet-content';
|
|
60
61
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
61
62
|
import {
|
|
62
63
|
Select,
|
|
@@ -68,7 +69,6 @@ import {
|
|
|
68
69
|
import { usePersistedPageSize } from '@/hooks/use-persisted-page-size';
|
|
69
70
|
import {
|
|
70
71
|
Sheet,
|
|
71
|
-
SheetContent,
|
|
72
72
|
SheetDescription,
|
|
73
73
|
SheetHeader,
|
|
74
74
|
SheetTitle,
|
|
@@ -2583,7 +2583,13 @@ export default function MenuPage() {
|
|
|
2583
2583
|
</div>
|
|
2584
2584
|
|
|
2585
2585
|
<Sheet open={isDialogOpen} onOpenChange={setIsDialogOpen}>
|
|
2586
|
-
<
|
|
2586
|
+
<ResizableSheetContent
|
|
2587
|
+
sheetId="core-menu-form-sheet"
|
|
2588
|
+
defaultWidth={560}
|
|
2589
|
+
minWidth={420}
|
|
2590
|
+
maxWidth={920}
|
|
2591
|
+
className="w-full gap-0 overflow-y-auto sm:max-w-lg"
|
|
2592
|
+
>
|
|
2587
2593
|
<SheetHeader>
|
|
2588
2594
|
<SheetTitle>{t('dialogAddMenuTitle')}</SheetTitle>
|
|
2589
2595
|
<SheetDescription>{t('dialogAddMenuDescription')}</SheetDescription>
|
|
@@ -2740,7 +2746,7 @@ export default function MenuPage() {
|
|
|
2740
2746
|
</Button>
|
|
2741
2747
|
</form>
|
|
2742
2748
|
</Form>
|
|
2743
|
-
</
|
|
2749
|
+
</ResizableSheetContent>
|
|
2744
2750
|
</Sheet>
|
|
2745
2751
|
|
|
2746
2752
|
<AlertDialog open={openDeleteModal} onOpenChange={setOpenDeleteModal}>
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
} from '@/components/ui/select';
|
|
46
46
|
import {
|
|
47
47
|
Sheet,
|
|
48
|
-
SheetContent,
|
|
49
48
|
SheetDescription,
|
|
50
49
|
SheetHeader,
|
|
51
50
|
SheetTitle,
|
|
52
51
|
} from '@/components/ui/sheet';
|
|
52
|
+
import { ResizableSheetContent } from '@/components/ui/resizable-sheet-content';
|
|
53
53
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
54
54
|
import { Textarea } from '@/components/ui/textarea';
|
|
55
55
|
import { useFormDraft } from '@/hooks/use-form-draft';
|
|
@@ -694,7 +694,13 @@ export default function RolePage() {
|
|
|
694
694
|
}
|
|
695
695
|
}}
|
|
696
696
|
>
|
|
697
|
-
<
|
|
697
|
+
<ResizableSheetContent
|
|
698
|
+
sheetId="core-roles-create-sheet"
|
|
699
|
+
defaultWidth={560}
|
|
700
|
+
minWidth={420}
|
|
701
|
+
maxWidth={920}
|
|
702
|
+
className="w-full sm:max-w-lg overflow-y-auto gap-0"
|
|
703
|
+
>
|
|
698
704
|
<SheetHeader>
|
|
699
705
|
<SheetTitle>{t('dialogAddRoleTitle')}</SheetTitle>
|
|
700
706
|
<SheetDescription>
|
|
@@ -780,12 +786,18 @@ export default function RolePage() {
|
|
|
780
786
|
</Button>
|
|
781
787
|
</form>
|
|
782
788
|
</Form>
|
|
783
|
-
</
|
|
789
|
+
</ResizableSheetContent>
|
|
784
790
|
</Sheet>
|
|
785
791
|
|
|
786
792
|
{editingRole && (
|
|
787
793
|
<Sheet open={!!editingRole} onOpenChange={() => setEditingRole(null)}>
|
|
788
|
-
<
|
|
794
|
+
<ResizableSheetContent
|
|
795
|
+
sheetId="core-roles-edit-sheet"
|
|
796
|
+
defaultWidth={920}
|
|
797
|
+
minWidth={620}
|
|
798
|
+
maxWidth={1320}
|
|
799
|
+
className="w-full sm:max-w-3xl overflow-y-auto gap-0"
|
|
800
|
+
>
|
|
789
801
|
<SheetHeader>
|
|
790
802
|
<SheetTitle>{t('titleEditRole')}</SheetTitle>
|
|
791
803
|
<SheetDescription>
|
|
@@ -851,7 +863,7 @@ export default function RolePage() {
|
|
|
851
863
|
value={selectedLocale}
|
|
852
864
|
onValueChange={(value) => setSelectedLocale(value)}
|
|
853
865
|
>
|
|
854
|
-
<SelectTrigger className="
|
|
866
|
+
<SelectTrigger className="h-8 w-45">
|
|
855
867
|
<SelectValue placeholder={t('selectLocale')} />
|
|
856
868
|
</SelectTrigger>
|
|
857
869
|
<SelectContent>
|
|
@@ -978,7 +990,7 @@ export default function RolePage() {
|
|
|
978
990
|
/>
|
|
979
991
|
</TabsContent>
|
|
980
992
|
</Tabs>
|
|
981
|
-
</
|
|
993
|
+
</ResizableSheetContent>
|
|
982
994
|
</Sheet>
|
|
983
995
|
)}
|
|
984
996
|
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
} from '@/components/ui/select';
|
|
47
47
|
import {
|
|
48
48
|
Sheet,
|
|
49
|
-
SheetContent,
|
|
50
49
|
SheetDescription,
|
|
51
50
|
SheetHeader,
|
|
52
51
|
SheetTitle,
|
|
53
52
|
} from '@/components/ui/sheet';
|
|
53
|
+
import { ResizableSheetContent } from '@/components/ui/resizable-sheet-content';
|
|
54
54
|
import { Switch } from '@/components/ui/switch';
|
|
55
55
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
56
56
|
import { usePersistedPageSize } from '@/hooks/use-persisted-page-size';
|
|
@@ -1081,7 +1081,13 @@ export default function RoutePage() {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
}}
|
|
1083
1083
|
>
|
|
1084
|
-
<
|
|
1084
|
+
<ResizableSheetContent
|
|
1085
|
+
sheetId="core-routes-form-sheet"
|
|
1086
|
+
defaultWidth={920}
|
|
1087
|
+
minWidth={620}
|
|
1088
|
+
maxWidth={1320}
|
|
1089
|
+
className="w-full gap-0 overflow-y-auto sm:max-w-3xl"
|
|
1090
|
+
>
|
|
1085
1091
|
<SheetHeader>
|
|
1086
1092
|
<SheetTitle>
|
|
1087
1093
|
{editingRoute ? t('titleEditRoute') : t('dialogAddRouteTitle')}
|
|
@@ -1315,7 +1321,7 @@ export default function RoutePage() {
|
|
|
1315
1321
|
</TabsContent>
|
|
1316
1322
|
) : null}
|
|
1317
1323
|
</Tabs>
|
|
1318
|
-
</
|
|
1324
|
+
</ResizableSheetContent>
|
|
1319
1325
|
</Sheet>
|
|
1320
1326
|
|
|
1321
1327
|
<AlertDialog open={openDeleteModal} onOpenChange={setOpenDeleteModal}>
|