@docyrus/ui-pro-ai-assistant 0.3.7 → 0.3.9
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/README.md +1 -0
- package/dist/components/input-area.d.ts +1 -0
- package/dist/docy-assistant.d.ts +1 -1
- package/dist/index.js +160 -60
- package/dist/index.js.map +1 -1
- package/dist/styles.css +30 -9
- package/dist/types/index.d.ts +1 -0
- package/dist/views/assistant-view.d.ts +3 -0
- package/dist/views/chat-panel.d.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -220,6 +220,7 @@ The main chat interface component.
|
|
|
220
220
|
|------|------|---------|-------------|
|
|
221
221
|
| `enableSidebar` | `boolean` | `true` | Show the session list sidebar |
|
|
222
222
|
| `enableNavDropdown` | `boolean` | `false` | Show navigation dropdown |
|
|
223
|
+
| `enableWelcomePage` | `boolean` | `true` | Show a welcome landing page on first open with agent greeting, inline prompt input, and recent sessions. Sidebar and header are hidden in this view. Dismissed on interaction (new chat, session click, or message send) |
|
|
223
224
|
| `defaultFullscreen` | `boolean` | `false` | Start in fullscreen |
|
|
224
225
|
| `hideExpand` | `boolean` | `false` | Hide the fullscreen toggle |
|
|
225
226
|
| `hideCloseButton` | `boolean` | `false` | Hide the close (X) button in the header |
|
package/dist/docy-assistant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
2
|
import { type DocyAssistantProps } from './types';
|
|
3
|
-
export declare const DocyAssistant: ({ ref, isOpen, onClose, supportWebSearch, supportThinking, supportFiles, supportDocumentSearch, supportDeepResearch, supportMultiModels, supportWorkCanvas, apiEndpoint, title: titleProp, description: descriptionProp, placeholder: placeholderProp, logo, footerText: footerTextProp, variant, renderMode, enableSidebar, enableNavDropdown, enableVoice, enableMicrophone, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, hideExpand, hideCloseButton, hideAgentSelector, hideBorder, showHeader, agentSelectorUrl, baseAgentSelectorUrl, onAgentChange, initialPrompt, initialModelId, initialFeatures, initialFiles, ...props }: DocyAssistantProps & {
|
|
3
|
+
export declare const DocyAssistant: ({ ref, isOpen, onClose, supportWebSearch, supportThinking, supportFiles, supportDocumentSearch, supportDeepResearch, supportMultiModels, supportWorkCanvas, apiEndpoint, title: titleProp, description: descriptionProp, placeholder: placeholderProp, logo, footerText: footerTextProp, variant, renderMode, enableSidebar, enableNavDropdown, enableVoice, enableMicrophone, enableWelcomePage, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, hideExpand, hideCloseButton, hideAgentSelector, hideBorder, showHeader, agentSelectorUrl, baseAgentSelectorUrl, onAgentChange, initialPrompt, initialModelId, initialFeatures, initialFiles, ...props }: DocyAssistantProps & {
|
|
4
4
|
ref?: RefObject<HTMLDivElement | null>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -17,10 +17,10 @@ import { createPortal } from 'react-dom';
|
|
|
17
17
|
import { Avatar as Avatar$1, AvatarImage as AvatarImage$1, AvatarFallback as AvatarFallback$1 } from '@docyrus/ui-pro-shared/components/avatar';
|
|
18
18
|
import { ScrollArea } from '@docyrus/ui-pro-shared/components/scroll-area';
|
|
19
19
|
import { Message, AIMessageAvatar, MessageContent, MessageActions, AIConversation, AIConversationContent, MessageResponse, AIConversationScrollButton, MessageAction, Tool, ToolHeader, ToolContent, ToolInput, ToolOutput, CodeBlock, CodeBlockCopyButton, resolveToolIcon, PromptInput, PromptInputTextarea, PromptInputFooter, PromptInputTools, PromptInputButton, PromptInputSubmit, usePromptInputAttachments } from '@docyrus/ui-pro-shared/ai';
|
|
20
|
-
import { Badge } from '@docyrus/ui-pro-shared/components/badge';
|
|
21
|
-
import { Reasoning, ReasoningTrigger, ReasoningContent } from '@docyrus/ui-pro-shared/ai-elements/reasoning';
|
|
22
20
|
import { Spinner } from '@docyrus/ui-pro-shared/components/spinner';
|
|
21
|
+
import { Badge } from '@docyrus/ui-pro-shared/components/badge';
|
|
23
22
|
import { DotLottieReact } from '@lottiefiles/dotlottie-react';
|
|
23
|
+
import { Reasoning, ReasoningTrigger, ReasoningContent } from '@docyrus/ui-pro-shared/ai-elements/reasoning';
|
|
24
24
|
import { Sources, SourcesTrigger, SourcesContent, Source } from '@docyrus/ui-pro-shared/ai-elements/sources';
|
|
25
25
|
import { Card } from '@docyrus/ui-pro-shared/components/card';
|
|
26
26
|
import { ConfirmationAction } from '@docyrus/ui-pro-shared/ai-elements/confirmation';
|
|
@@ -457,7 +457,13 @@ var de_default = {
|
|
|
457
457
|
unknown: "Unbekannt",
|
|
458
458
|
untitled: "Unbenannt",
|
|
459
459
|
no_description: "Keine Beschreibung",
|
|
460
|
-
view: "Ansehen"
|
|
460
|
+
view: "Ansehen",
|
|
461
|
+
settings: "Einstellungen",
|
|
462
|
+
reasoning: "Schlussfolgerungsmodell f\xFCr komplexe Aufgaben verwenden",
|
|
463
|
+
start_recording: "Aufnahme starten",
|
|
464
|
+
stop_recording: "Aufnahme stoppen",
|
|
465
|
+
optimize_prompt: "Eingabe optimieren",
|
|
466
|
+
retry: "Erneut versuchen"
|
|
461
467
|
},
|
|
462
468
|
actions: {
|
|
463
469
|
approve: "Genehmigen",
|
|
@@ -657,7 +663,13 @@ var el_default = {
|
|
|
657
663
|
unknown: "\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF",
|
|
658
664
|
untitled: "\u03A7\u03C9\u03C1\u03AF\u03C2 \u03C4\u03AF\u03C4\u03BB\u03BF",
|
|
659
665
|
no_description: "\u03A7\u03C9\u03C1\u03AF\u03C2 \u03C0\u03B5\u03C1\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE",
|
|
660
|
-
view: "\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE"
|
|
666
|
+
view: "\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE",
|
|
667
|
+
settings: "\u03A1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2",
|
|
668
|
+
reasoning: "\u03A7\u03C1\u03AE\u03C3\u03B7 \u03BC\u03BF\u03BD\u03C4\u03AD\u03BB\u03BF\u03C5 \u03C3\u03C5\u03BB\u03BB\u03BF\u03B3\u03B9\u03C3\u03BC\u03BF\u03CD \u03B3\u03B9\u03B1 \u03B5\u03C0\u03AF\u03BB\u03C5\u03C3\u03B7 \u03C3\u03CD\u03BD\u03B8\u03B5\u03C4\u03C9\u03BD \u03B5\u03C1\u03B3\u03B1\u03C3\u03B9\u03CE\u03BD",
|
|
669
|
+
start_recording: "\u0388\u03BD\u03B1\u03C1\u03BE\u03B7 \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2",
|
|
670
|
+
stop_recording: "\u0394\u03B9\u03B1\u03BA\u03BF\u03C0\u03AE \u03B5\u03B3\u03B3\u03C1\u03B1\u03C6\u03AE\u03C2",
|
|
671
|
+
optimize_prompt: "\u0392\u03B5\u03BB\u03C4\u03B9\u03C3\u03C4\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 \u03B5\u03BD\u03C4\u03BF\u03BB\u03AE\u03C2",
|
|
672
|
+
retry: "\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7"
|
|
661
673
|
},
|
|
662
674
|
actions: {
|
|
663
675
|
approve: "\u0388\u03B3\u03BA\u03C1\u03B9\u03C3\u03B7",
|
|
@@ -858,7 +870,13 @@ var en_default = {
|
|
|
858
870
|
untitled: "Untitled",
|
|
859
871
|
no_description: "No description",
|
|
860
872
|
active: "Active",
|
|
861
|
-
view: "View"
|
|
873
|
+
view: "View",
|
|
874
|
+
settings: "Settings",
|
|
875
|
+
reasoning: "Use reasoning model to solve complex tasks",
|
|
876
|
+
start_recording: "Start Recording",
|
|
877
|
+
stop_recording: "Stop Recording",
|
|
878
|
+
optimize_prompt: "Optimize Prompt",
|
|
879
|
+
retry: "Retry"
|
|
862
880
|
},
|
|
863
881
|
actions: {
|
|
864
882
|
approve: "Approve",
|
|
@@ -1085,7 +1103,13 @@ var es_default = {
|
|
|
1085
1103
|
unknown: "Desconocido",
|
|
1086
1104
|
untitled: "Sin t\xEDtulo",
|
|
1087
1105
|
no_description: "Sin descripci\xF3n",
|
|
1088
|
-
view: "Ver"
|
|
1106
|
+
view: "Ver",
|
|
1107
|
+
settings: "Configuraci\xF3n",
|
|
1108
|
+
reasoning: "Usar modelo de razonamiento para resolver tareas complejas",
|
|
1109
|
+
start_recording: "Iniciar grabaci\xF3n",
|
|
1110
|
+
stop_recording: "Detener grabaci\xF3n",
|
|
1111
|
+
optimize_prompt: "Optimizar instrucci\xF3n",
|
|
1112
|
+
retry: "Reintentar"
|
|
1089
1113
|
},
|
|
1090
1114
|
actions: {
|
|
1091
1115
|
approve: "Aprobar",
|
|
@@ -1285,7 +1309,13 @@ var fr_default = {
|
|
|
1285
1309
|
unknown: "Inconnu",
|
|
1286
1310
|
untitled: "Sans titre",
|
|
1287
1311
|
no_description: "Pas de description",
|
|
1288
|
-
view: "Voir"
|
|
1312
|
+
view: "Voir",
|
|
1313
|
+
settings: "Param\xE8tres",
|
|
1314
|
+
reasoning: "Utiliser le mod\xE8le de raisonnement pour r\xE9soudre des t\xE2ches complexes",
|
|
1315
|
+
start_recording: "D\xE9marrer l'enregistrement",
|
|
1316
|
+
stop_recording: "Arr\xEAter l'enregistrement",
|
|
1317
|
+
optimize_prompt: "Optimiser l'instruction",
|
|
1318
|
+
retry: "R\xE9essayer"
|
|
1289
1319
|
},
|
|
1290
1320
|
actions: {
|
|
1291
1321
|
approve: "Approuver",
|
|
@@ -1485,7 +1515,13 @@ var it_default = {
|
|
|
1485
1515
|
unknown: "Sconosciuto",
|
|
1486
1516
|
untitled: "Senza titolo",
|
|
1487
1517
|
no_description: "Nessuna descrizione",
|
|
1488
|
-
view: "Visualizza"
|
|
1518
|
+
view: "Visualizza",
|
|
1519
|
+
settings: "Impostazioni",
|
|
1520
|
+
reasoning: "Usa il modello di ragionamento per risolvere compiti complessi",
|
|
1521
|
+
start_recording: "Avvia registrazione",
|
|
1522
|
+
stop_recording: "Interrompi registrazione",
|
|
1523
|
+
optimize_prompt: "Ottimizza prompt",
|
|
1524
|
+
retry: "Riprova"
|
|
1489
1525
|
},
|
|
1490
1526
|
actions: {
|
|
1491
1527
|
approve: "Approva",
|
|
@@ -1685,7 +1721,13 @@ var pt_default = {
|
|
|
1685
1721
|
unknown: "Desconhecido",
|
|
1686
1722
|
untitled: "Sem t\xEDtulo",
|
|
1687
1723
|
no_description: "Sem descri\xE7\xE3o",
|
|
1688
|
-
view: "Ver"
|
|
1724
|
+
view: "Ver",
|
|
1725
|
+
settings: "Configura\xE7\xF5es",
|
|
1726
|
+
reasoning: "Usar modelo de racioc\xEDnio para resolver tarefas complexas",
|
|
1727
|
+
start_recording: "Iniciar grava\xE7\xE3o",
|
|
1728
|
+
stop_recording: "Parar grava\xE7\xE3o",
|
|
1729
|
+
optimize_prompt: "Otimizar instru\xE7\xE3o",
|
|
1730
|
+
retry: "Tentar novamente"
|
|
1689
1731
|
},
|
|
1690
1732
|
actions: {
|
|
1691
1733
|
approve: "Aprovar",
|
|
@@ -1885,7 +1927,13 @@ var sl_default = {
|
|
|
1885
1927
|
unknown: "Neznano",
|
|
1886
1928
|
untitled: "Brez naslova",
|
|
1887
1929
|
no_description: "Brez opisa",
|
|
1888
|
-
view: "Ogled"
|
|
1930
|
+
view: "Ogled",
|
|
1931
|
+
settings: "Nastavitve",
|
|
1932
|
+
reasoning: "Uporabi model sklepanja za re\u0161evanje zahtevnih nalog",
|
|
1933
|
+
start_recording: "Za\u010Dni snemanje",
|
|
1934
|
+
stop_recording: "Ustavi snemanje",
|
|
1935
|
+
optimize_prompt: "Optimiziraj ukaz",
|
|
1936
|
+
retry: "Poskusi znova"
|
|
1889
1937
|
},
|
|
1890
1938
|
actions: {
|
|
1891
1939
|
approve: "Odobri",
|
|
@@ -2086,7 +2134,13 @@ var tr_default = {
|
|
|
2086
2134
|
untitled: "Ads\u0131z",
|
|
2087
2135
|
no_description: "A\xE7\u0131klama yok",
|
|
2088
2136
|
active: "Aktif",
|
|
2089
|
-
view: "G\xF6r\xFCnt\xFCle"
|
|
2137
|
+
view: "G\xF6r\xFCnt\xFCle",
|
|
2138
|
+
settings: "Ayarlar",
|
|
2139
|
+
reasoning: "Karma\u015F\u0131k g\xF6revleri \xE7\xF6zmek i\xE7in ak\u0131l y\xFCr\xFCtme modelini kullan",
|
|
2140
|
+
start_recording: "Kayda Ba\u015Fla",
|
|
2141
|
+
stop_recording: "Kayd\u0131 Durdur",
|
|
2142
|
+
optimize_prompt: "Komutu Optimize Et",
|
|
2143
|
+
retry: "Tekrar Dene"
|
|
2090
2144
|
},
|
|
2091
2145
|
actions: {
|
|
2092
2146
|
approve: "Onayla",
|
|
@@ -3979,6 +4033,7 @@ var AIInputArea = ({
|
|
|
3979
4033
|
compactToolbar = false,
|
|
3980
4034
|
threadId,
|
|
3981
4035
|
hasMessages = false,
|
|
4036
|
+
hideFooter = false,
|
|
3982
4037
|
tenantAiProjectId,
|
|
3983
4038
|
initialModelId,
|
|
3984
4039
|
initialFeatures
|
|
@@ -4214,14 +4269,14 @@ var AIInputArea = ({
|
|
|
4214
4269
|
onSubmit: handlePromptSubmit,
|
|
4215
4270
|
accept: supportFiles ? "image/*,.pdf,.docx,.csv,.xlsx,.md,.txt,.json" : void 0,
|
|
4216
4271
|
multiple: true,
|
|
4217
|
-
className: "
|
|
4272
|
+
className: "bg-input/20 shadow-none",
|
|
4218
4273
|
children: [
|
|
4219
4274
|
supportFiles && /* @__PURE__ */ jsx(AttachmentPreview, {}),
|
|
4220
4275
|
/* @__PURE__ */ jsx(
|
|
4221
4276
|
PromptInputTextarea,
|
|
4222
4277
|
{
|
|
4223
4278
|
placeholder,
|
|
4224
|
-
className: "text-sm min-h-
|
|
4279
|
+
className: "text-sm min-h-16",
|
|
4225
4280
|
value,
|
|
4226
4281
|
onChange
|
|
4227
4282
|
}
|
|
@@ -4236,7 +4291,7 @@ var AIInputArea = ({
|
|
|
4236
4291
|
effectiveSupportWorkCanvas && workCanvasActive
|
|
4237
4292
|
].filter(Boolean).length;
|
|
4238
4293
|
return /* @__PURE__ */ jsxs(PromptInputFooter, { className: "gap-2", children: [
|
|
4239
|
-
/* @__PURE__ */ jsxs(PromptInputTools, { children: [
|
|
4294
|
+
/* @__PURE__ */ jsxs(PromptInputTools, { className: "-mb-2", children: [
|
|
4240
4295
|
supportFiles && /* @__PURE__ */ jsx(FileUploadButton, { tooltip: t("tools.file_upload") }),
|
|
4241
4296
|
hasSupport && /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
|
|
4242
4297
|
/* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
@@ -4415,7 +4470,7 @@ var AIInputArea = ({
|
|
|
4415
4470
|
{
|
|
4416
4471
|
variant: "ghost",
|
|
4417
4472
|
onClick: onMicrophoneClick,
|
|
4418
|
-
className: cn("transition-all duration-200", isRecording && "bg-destructive/10 text-destructive hover:bg-destructive/20 ring-1 ring-destructive/30"),
|
|
4473
|
+
className: cn("-mb-2 transition-all duration-200", isRecording && "bg-destructive/10 text-destructive hover:bg-destructive/20 ring-1 ring-destructive/30"),
|
|
4419
4474
|
children: [
|
|
4420
4475
|
/* @__PURE__ */ jsx(Mic, { className: "w-4 h-4" }),
|
|
4421
4476
|
isRecording && /* @__PURE__ */ jsx("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-destructive rounded-full animate-pulse" })
|
|
@@ -4642,7 +4697,7 @@ var AIInputArea = ({
|
|
|
4642
4697
|
]
|
|
4643
4698
|
}
|
|
4644
4699
|
),
|
|
4645
|
-
/* @__PURE__ */ jsxs("div", { className: "relative mt-2 flex items-center px-1", children: [
|
|
4700
|
+
!hideFooter && /* @__PURE__ */ jsxs("div", { className: "relative mt-2 flex items-center px-1", children: [
|
|
4646
4701
|
footerText && /* @__PURE__ */ jsx("span", { className: "flex-1 text-center text-xs text-muted-foreground", children: footerText }),
|
|
4647
4702
|
/* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
4648
4703
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
@@ -7277,7 +7332,7 @@ var MessageItem = memo(({
|
|
|
7277
7332
|
});
|
|
7278
7333
|
};
|
|
7279
7334
|
return /* @__PURE__ */ jsx(Message, { from: message.role, children: /* @__PURE__ */ jsxs("div", { className: cn(
|
|
7280
|
-
"flex items-
|
|
7335
|
+
"flex items-center gap-3",
|
|
7281
7336
|
message.role === "user" && "flex-row-reverse"
|
|
7282
7337
|
), children: [
|
|
7283
7338
|
isStreaming && isAssistantMessage && !logo ? /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "working", className: "w-12 h-12 shrink-0" }) : /* @__PURE__ */ jsx(
|
|
@@ -7289,7 +7344,7 @@ var MessageItem = memo(({
|
|
|
7289
7344
|
className: "w-12 h-12"
|
|
7290
7345
|
}
|
|
7291
7346
|
),
|
|
7292
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
7347
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-full items-center", children: [
|
|
7293
7348
|
/* @__PURE__ */ jsx(MessageContent, { className: "group-[.is-user]:p-2 group-[.is-user]:mt-0.5", children: renderMessageContent() }),
|
|
7294
7349
|
isAssistantMessage && !isStreaming && textContent && /* @__PURE__ */ jsx(MessageActions, { className: "mt-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(CopyButton, { text: textContent }) })
|
|
7295
7350
|
] })
|
|
@@ -7317,7 +7372,7 @@ var MessageList = memo(({
|
|
|
7317
7372
|
messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center", children: isLoadingAgent ? /* @__PURE__ */ jsx("div", { className: "p-2 bg-muted rounded-md", children: /* @__PURE__ */ jsx(Spinner, { className: "size-10 text-muted-foreground" }) }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-3 text-center px-4", children: [
|
|
7318
7373
|
logo ? /* @__PURE__ */ jsx(AIMessageAvatar, { src: logo, name: title || "Assistant", className: "w-20 h-20" }) : /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "opening", className: "w-32 h-32" }),
|
|
7319
7374
|
title && /* @__PURE__ */ jsx("p", { className: "font-semibold text-base text-lg", children: title }),
|
|
7320
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
7375
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: welcomeMessage ? /* @__PURE__ */ jsx(MessageResponse, { children: welcomeMessage }) : /* @__PURE__ */ jsx("p", { children: description || "Your AI-powered assistant for all your document needs." }) })
|
|
7321
7376
|
] }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7322
7377
|
messages.map((message, msgIdx) => {
|
|
7323
7378
|
const isLastMessage = msgIdx === lastMsgIdx;
|
|
@@ -7383,10 +7438,74 @@ function ChatPanel({
|
|
|
7383
7438
|
renderThreadHeader,
|
|
7384
7439
|
messagesClassName,
|
|
7385
7440
|
compactToolbar,
|
|
7441
|
+
showWelcome,
|
|
7442
|
+
recentSessions,
|
|
7443
|
+
onSessionClick,
|
|
7386
7444
|
threadId,
|
|
7387
7445
|
initialModelId,
|
|
7388
7446
|
initialFeatures
|
|
7389
7447
|
}) {
|
|
7448
|
+
const renderInputArea = (hideFooter = false) => /* @__PURE__ */ jsx(
|
|
7449
|
+
AIInputArea,
|
|
7450
|
+
{
|
|
7451
|
+
onSubmit: onSendMessage,
|
|
7452
|
+
onStop,
|
|
7453
|
+
value: input,
|
|
7454
|
+
onChange: onInputChange,
|
|
7455
|
+
placeholder,
|
|
7456
|
+
isLoading,
|
|
7457
|
+
supportFiles,
|
|
7458
|
+
supportWebSearch,
|
|
7459
|
+
supportDocumentSearch,
|
|
7460
|
+
supportDeepResearch,
|
|
7461
|
+
supportThinking,
|
|
7462
|
+
supportWorkCanvas,
|
|
7463
|
+
supportMultiModels,
|
|
7464
|
+
deploymentId,
|
|
7465
|
+
tenantAiAgentId,
|
|
7466
|
+
enableMicrophone,
|
|
7467
|
+
enableVoice,
|
|
7468
|
+
isRecording,
|
|
7469
|
+
recognition,
|
|
7470
|
+
onMicrophoneClick,
|
|
7471
|
+
footerText,
|
|
7472
|
+
showToolbar: !compactToolbar,
|
|
7473
|
+
compactToolbar,
|
|
7474
|
+
threadId,
|
|
7475
|
+
hasMessages: messages.length > 0,
|
|
7476
|
+
hideFooter,
|
|
7477
|
+
initialModelId,
|
|
7478
|
+
initialFeatures
|
|
7479
|
+
}
|
|
7480
|
+
);
|
|
7481
|
+
if (showWelcome && messages.length === 0) {
|
|
7482
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7483
|
+
renderThreadHeader?.(),
|
|
7484
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col", children: [
|
|
7485
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 py-12", children: isLoadingAgent ? /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "p-2 bg-muted rounded-md", children: /* @__PURE__ */ jsx(Spinner, { className: "size-10 text-muted-foreground" }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7486
|
+
logo ? /* @__PURE__ */ jsx(AIMessageAvatar, { src: logo, name: title || "Assistant", className: "w-10 h-10" }) : /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "opening", className: "w-10 h-10" }),
|
|
7487
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground [&_h4]:text-foreground [&_*]:my-0 [&_*+*]:mt-2", children: welcomeMessage ? /* @__PURE__ */ jsx(MessageResponse, { children: welcomeMessage }) : /* @__PURE__ */ jsx("p", { children: description || "Your AI-powered assistant for all your document needs." }) }),
|
|
7488
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2", children: renderInputArea(true) })
|
|
7489
|
+
] }) }),
|
|
7490
|
+
recentSessions && recentSessions.length > 0 && !isLoadingAgent ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
|
|
7491
|
+
/* @__PURE__ */ jsx("h2", { className: "shrink-0 text-sm font-medium text-muted-foreground", children: "Recent Sessions" }),
|
|
7492
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y", children: recentSessions.slice(0, 5).map((session) => /* @__PURE__ */ jsxs(
|
|
7493
|
+
"div",
|
|
7494
|
+
{
|
|
7495
|
+
onClick: () => onSessionClick?.(session),
|
|
7496
|
+
className: "-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-3 transition-colors hover:bg-muted/50",
|
|
7497
|
+
children: [
|
|
7498
|
+
/* @__PURE__ */ jsx(MessageSquare, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
7499
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("p", { className: "truncate text-xs font-medium", children: session.title || "Untitled session" }) }),
|
|
7500
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: session.updatedAt.toLocaleDateString() })
|
|
7501
|
+
]
|
|
7502
|
+
},
|
|
7503
|
+
session.id
|
|
7504
|
+
)) }) })
|
|
7505
|
+
] }) : null
|
|
7506
|
+
] }) })
|
|
7507
|
+
] });
|
|
7508
|
+
}
|
|
7390
7509
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7391
7510
|
renderThreadHeader?.(),
|
|
7392
7511
|
/* @__PURE__ */ jsx(
|
|
@@ -7406,38 +7525,7 @@ function ChatPanel({
|
|
|
7406
7525
|
className: messagesClassName
|
|
7407
7526
|
}
|
|
7408
7527
|
),
|
|
7409
|
-
/* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-2", children:
|
|
7410
|
-
AIInputArea,
|
|
7411
|
-
{
|
|
7412
|
-
onSubmit: onSendMessage,
|
|
7413
|
-
onStop,
|
|
7414
|
-
value: input,
|
|
7415
|
-
onChange: onInputChange,
|
|
7416
|
-
placeholder,
|
|
7417
|
-
isLoading,
|
|
7418
|
-
supportFiles,
|
|
7419
|
-
supportWebSearch,
|
|
7420
|
-
supportDocumentSearch,
|
|
7421
|
-
supportDeepResearch,
|
|
7422
|
-
supportThinking,
|
|
7423
|
-
supportWorkCanvas,
|
|
7424
|
-
supportMultiModels,
|
|
7425
|
-
deploymentId,
|
|
7426
|
-
tenantAiAgentId,
|
|
7427
|
-
enableMicrophone,
|
|
7428
|
-
enableVoice,
|
|
7429
|
-
isRecording,
|
|
7430
|
-
recognition,
|
|
7431
|
-
onMicrophoneClick,
|
|
7432
|
-
footerText,
|
|
7433
|
-
showToolbar: !compactToolbar,
|
|
7434
|
-
compactToolbar,
|
|
7435
|
-
threadId,
|
|
7436
|
-
hasMessages: messages.length > 0,
|
|
7437
|
-
initialModelId,
|
|
7438
|
-
initialFeatures
|
|
7439
|
-
}
|
|
7440
|
-
) })
|
|
7528
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-2", children: renderInputArea() })
|
|
7441
7529
|
] });
|
|
7442
7530
|
}
|
|
7443
7531
|
var ALLOWED_ORIGINS = ["https://shell.docy.work", "https://shell-docyrus.web.app"];
|
|
@@ -22520,6 +22608,9 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22520
22608
|
onMicrophoneClick: commonProps2.onMicrophoneClick,
|
|
22521
22609
|
onToolAction: commonProps2.onToolAction,
|
|
22522
22610
|
openCanvasView: handleOpenCanvasView,
|
|
22611
|
+
showWelcome: commonProps2.showWelcome,
|
|
22612
|
+
recentSessions: commonProps2.recentSessions,
|
|
22613
|
+
onSessionClick: commonProps2.onSessionClick,
|
|
22523
22614
|
threadId: commonProps2.threadId,
|
|
22524
22615
|
initialModelId: commonProps2.initialModelId,
|
|
22525
22616
|
initialFeatures: commonProps2.initialFeatures,
|
|
@@ -22671,7 +22762,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22671
22762
|
activeAgent?.name ?? commonProps.title ?? "Assistant"
|
|
22672
22763
|
] }) : null;
|
|
22673
22764
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22674
|
-
showHeader && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
22765
|
+
showHeader && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
22675
22766
|
"relative z-50 flex items-center justify-between h-12 px-3 border-b shrink-0 bg-background",
|
|
22676
22767
|
!isSidebarOpen && enableSidebar && "pl-12"
|
|
22677
22768
|
), children: [
|
|
@@ -22763,7 +22854,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22763
22854
|
] })
|
|
22764
22855
|
] }),
|
|
22765
22856
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-row min-h-0 overflow-hidden relative", children: [
|
|
22766
|
-
!isSidebarOpen && /* @__PURE__ */ jsxs("div", { className: "absolute top-2 left-2 z-40 flex flex-col gap-1 rounded-md bg-background/80 backdrop-blur-sm p-0.5", children: [
|
|
22857
|
+
!isSidebarOpen && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsxs("div", { className: "absolute top-2 left-2 z-40 flex flex-col gap-1 rounded-md bg-background/80 backdrop-blur-sm p-0.5", children: [
|
|
22767
22858
|
enableSidebar && onToggleSidebar && /* @__PURE__ */ jsx(
|
|
22768
22859
|
Button,
|
|
22769
22860
|
{
|
|
@@ -22801,7 +22892,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22801
22892
|
}
|
|
22802
22893
|
)
|
|
22803
22894
|
] }),
|
|
22804
|
-
enableSidebar && isSidebarOpen && renderSidebar && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22895
|
+
enableSidebar && isSidebarOpen && renderSidebar && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22805
22896
|
/* @__PURE__ */ jsx(
|
|
22806
22897
|
"div",
|
|
22807
22898
|
{
|
|
@@ -22832,7 +22923,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22832
22923
|
/* @__PURE__ */ jsx("div", { className: "flex-1 p-4 flex flex-col min-h-0 overflow-hidden", children: renderSidebar(true) })
|
|
22833
22924
|
] }) })
|
|
22834
22925
|
] }),
|
|
22835
|
-
enableSidebar && renderSidebar && /* @__PURE__ */ jsx(
|
|
22926
|
+
enableSidebar && renderSidebar && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsx(
|
|
22836
22927
|
"div",
|
|
22837
22928
|
{
|
|
22838
22929
|
className: cn(
|
|
@@ -22974,6 +23065,9 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22974
23065
|
onToolAction: commonProps.onToolAction,
|
|
22975
23066
|
openCanvasView: handleOpenCanvasViewInline,
|
|
22976
23067
|
renderThreadHeader,
|
|
23068
|
+
showWelcome: commonProps.showWelcome,
|
|
23069
|
+
recentSessions: commonProps.recentSessions,
|
|
23070
|
+
onSessionClick: commonProps.onSessionClick,
|
|
22977
23071
|
threadId: commonProps.threadId,
|
|
22978
23072
|
initialModelId: commonProps.initialModelId,
|
|
22979
23073
|
initialFeatures: commonProps.initialFeatures,
|
|
@@ -24689,6 +24783,7 @@ var DocyAssistant = ({
|
|
|
24689
24783
|
enableNavDropdown = false,
|
|
24690
24784
|
enableVoice = false,
|
|
24691
24785
|
enableMicrophone = true,
|
|
24786
|
+
enableWelcomePage = true,
|
|
24692
24787
|
tenantAiAgentId,
|
|
24693
24788
|
onMessageSend,
|
|
24694
24789
|
onVoiceStart,
|
|
@@ -24730,6 +24825,7 @@ var DocyAssistant = ({
|
|
|
24730
24825
|
const { state: projectState, actions: projectActions } = useProjectState();
|
|
24731
24826
|
const { state: worksState, actions: worksActions } = useWorksState();
|
|
24732
24827
|
const [input, setInput] = useState("");
|
|
24828
|
+
const [showWelcome, setShowWelcome] = useState(enableWelcomePage);
|
|
24733
24829
|
const currentUserId = configUser.id;
|
|
24734
24830
|
const [projectSearchQuery, setProjectSearchQuery] = useState("");
|
|
24735
24831
|
const [isInlineFullscreen, setIsInlineFullscreen] = useState(defaultFullscreen);
|
|
@@ -24758,16 +24854,15 @@ var DocyAssistant = ({
|
|
|
24758
24854
|
const apiUrl = deploymentId ? `${baseUrl}${endpointPath.replace("/chat", `/deployments/${deploymentId}/chat`)}` : `${baseUrl}${endpointPath}`;
|
|
24759
24855
|
return new DefaultChatTransport({
|
|
24760
24856
|
api: apiUrl,
|
|
24761
|
-
prepareSendMessagesRequest: ({ messages: messages2,
|
|
24857
|
+
prepareSendMessagesRequest: ({ messages: messages2, ...rest }) => {
|
|
24762
24858
|
const options3 = messageOptionsRef.current;
|
|
24763
24859
|
return {
|
|
24860
|
+
...rest,
|
|
24764
24861
|
body: {
|
|
24765
|
-
...body,
|
|
24862
|
+
...rest.body,
|
|
24766
24863
|
agentId: activeAgentId,
|
|
24767
24864
|
threadId: selectedSessionIdRef.current,
|
|
24768
|
-
// Use ref for immediate access
|
|
24769
24865
|
messages: messages2.slice(-10),
|
|
24770
|
-
// Only send last 10 messages
|
|
24771
24866
|
modelId: options3?.modelId,
|
|
24772
24867
|
supportMultipleModels: options3?.supportMultipleModels,
|
|
24773
24868
|
supportFiles: options3?.supportFiles,
|
|
@@ -24783,7 +24878,6 @@ var DocyAssistant = ({
|
|
|
24783
24878
|
headers: () => {
|
|
24784
24879
|
const token = authTokenRef.current;
|
|
24785
24880
|
return {
|
|
24786
|
-
"Content-Type": "application/json",
|
|
24787
24881
|
...token && { Authorization: `Bearer ${token}` }
|
|
24788
24882
|
};
|
|
24789
24883
|
},
|
|
@@ -24985,6 +25079,7 @@ var DocyAssistant = ({
|
|
|
24985
25079
|
sessionActions.selectSessionId(session.id);
|
|
24986
25080
|
sessionActions.selectSession(session);
|
|
24987
25081
|
uiActions.setActiveTab(0);
|
|
25082
|
+
setShowWelcome(false);
|
|
24988
25083
|
await loadThreadMessages2(session.id);
|
|
24989
25084
|
};
|
|
24990
25085
|
const createNewThread = () => {
|
|
@@ -24992,11 +25087,13 @@ var DocyAssistant = ({
|
|
|
24992
25087
|
sessionActions.selectSession(null);
|
|
24993
25088
|
uiActions.setActiveTab(0);
|
|
24994
25089
|
setMessages([]);
|
|
25090
|
+
setShowWelcome(false);
|
|
24995
25091
|
};
|
|
24996
25092
|
const handleSendMessage = async (e, options3, overrideText) => {
|
|
24997
25093
|
e?.preventDefault();
|
|
24998
25094
|
const messageText = (overrideText ?? input).trim();
|
|
24999
25095
|
if (!messageText) return;
|
|
25096
|
+
setShowWelcome(false);
|
|
25000
25097
|
messageOptionsRef.current = options3;
|
|
25001
25098
|
let currentThreadId = selectedSessionIdRef.current;
|
|
25002
25099
|
if (!currentThreadId) {
|
|
@@ -25278,6 +25375,9 @@ var DocyAssistant = ({
|
|
|
25278
25375
|
isRecording,
|
|
25279
25376
|
recognition,
|
|
25280
25377
|
onMicrophoneClick: handleMicrophoneClick,
|
|
25378
|
+
showWelcome,
|
|
25379
|
+
recentSessions: sessionState.sessions,
|
|
25380
|
+
onSessionClick: handleSessionClick,
|
|
25281
25381
|
isSidebarOpen: uiState.isSidebarOpen,
|
|
25282
25382
|
onToggleSidebar: () => uiActions.setSidebarOpen(!uiState.isSidebarOpen),
|
|
25283
25383
|
renderSidebar: renderSidebarContent,
|