@docyrus/ui-pro-ai-assistant 0.3.8 → 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 +97 -51
- 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';
|
|
@@ -4033,6 +4033,7 @@ var AIInputArea = ({
|
|
|
4033
4033
|
compactToolbar = false,
|
|
4034
4034
|
threadId,
|
|
4035
4035
|
hasMessages = false,
|
|
4036
|
+
hideFooter = false,
|
|
4036
4037
|
tenantAiProjectId,
|
|
4037
4038
|
initialModelId,
|
|
4038
4039
|
initialFeatures
|
|
@@ -4268,14 +4269,14 @@ var AIInputArea = ({
|
|
|
4268
4269
|
onSubmit: handlePromptSubmit,
|
|
4269
4270
|
accept: supportFiles ? "image/*,.pdf,.docx,.csv,.xlsx,.md,.txt,.json" : void 0,
|
|
4270
4271
|
multiple: true,
|
|
4271
|
-
className: "
|
|
4272
|
+
className: "bg-input/20 shadow-none",
|
|
4272
4273
|
children: [
|
|
4273
4274
|
supportFiles && /* @__PURE__ */ jsx(AttachmentPreview, {}),
|
|
4274
4275
|
/* @__PURE__ */ jsx(
|
|
4275
4276
|
PromptInputTextarea,
|
|
4276
4277
|
{
|
|
4277
4278
|
placeholder,
|
|
4278
|
-
className: "text-sm min-h-
|
|
4279
|
+
className: "text-sm min-h-16",
|
|
4279
4280
|
value,
|
|
4280
4281
|
onChange
|
|
4281
4282
|
}
|
|
@@ -4290,7 +4291,7 @@ var AIInputArea = ({
|
|
|
4290
4291
|
effectiveSupportWorkCanvas && workCanvasActive
|
|
4291
4292
|
].filter(Boolean).length;
|
|
4292
4293
|
return /* @__PURE__ */ jsxs(PromptInputFooter, { className: "gap-2", children: [
|
|
4293
|
-
/* @__PURE__ */ jsxs(PromptInputTools, { children: [
|
|
4294
|
+
/* @__PURE__ */ jsxs(PromptInputTools, { className: "-mb-2", children: [
|
|
4294
4295
|
supportFiles && /* @__PURE__ */ jsx(FileUploadButton, { tooltip: t("tools.file_upload") }),
|
|
4295
4296
|
hasSupport && /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
|
|
4296
4297
|
/* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
@@ -4469,7 +4470,7 @@ var AIInputArea = ({
|
|
|
4469
4470
|
{
|
|
4470
4471
|
variant: "ghost",
|
|
4471
4472
|
onClick: onMicrophoneClick,
|
|
4472
|
-
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"),
|
|
4473
4474
|
children: [
|
|
4474
4475
|
/* @__PURE__ */ jsx(Mic, { className: "w-4 h-4" }),
|
|
4475
4476
|
isRecording && /* @__PURE__ */ jsx("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-destructive rounded-full animate-pulse" })
|
|
@@ -4696,7 +4697,7 @@ var AIInputArea = ({
|
|
|
4696
4697
|
]
|
|
4697
4698
|
}
|
|
4698
4699
|
),
|
|
4699
|
-
/* @__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: [
|
|
4700
4701
|
footerText && /* @__PURE__ */ jsx("span", { className: "flex-1 text-center text-xs text-muted-foreground", children: footerText }),
|
|
4701
4702
|
/* @__PURE__ */ jsxs(Tooltip$1, { children: [
|
|
4702
4703
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
@@ -7331,7 +7332,7 @@ var MessageItem = memo(({
|
|
|
7331
7332
|
});
|
|
7332
7333
|
};
|
|
7333
7334
|
return /* @__PURE__ */ jsx(Message, { from: message.role, children: /* @__PURE__ */ jsxs("div", { className: cn(
|
|
7334
|
-
"flex items-
|
|
7335
|
+
"flex items-center gap-3",
|
|
7335
7336
|
message.role === "user" && "flex-row-reverse"
|
|
7336
7337
|
), children: [
|
|
7337
7338
|
isStreaming && isAssistantMessage && !logo ? /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "working", className: "w-12 h-12 shrink-0" }) : /* @__PURE__ */ jsx(
|
|
@@ -7343,7 +7344,7 @@ var MessageItem = memo(({
|
|
|
7343
7344
|
className: "w-12 h-12"
|
|
7344
7345
|
}
|
|
7345
7346
|
),
|
|
7346
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
7347
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-full items-center", children: [
|
|
7347
7348
|
/* @__PURE__ */ jsx(MessageContent, { className: "group-[.is-user]:p-2 group-[.is-user]:mt-0.5", children: renderMessageContent() }),
|
|
7348
7349
|
isAssistantMessage && !isStreaming && textContent && /* @__PURE__ */ jsx(MessageActions, { className: "mt-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx(CopyButton, { text: textContent }) })
|
|
7349
7350
|
] })
|
|
@@ -7371,7 +7372,7 @@ var MessageList = memo(({
|
|
|
7371
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: [
|
|
7372
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" }),
|
|
7373
7374
|
title && /* @__PURE__ */ jsx("p", { className: "font-semibold text-base text-lg", children: title }),
|
|
7374
|
-
/* @__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." }) })
|
|
7375
7376
|
] }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7376
7377
|
messages.map((message, msgIdx) => {
|
|
7377
7378
|
const isLastMessage = msgIdx === lastMsgIdx;
|
|
@@ -7437,10 +7438,74 @@ function ChatPanel({
|
|
|
7437
7438
|
renderThreadHeader,
|
|
7438
7439
|
messagesClassName,
|
|
7439
7440
|
compactToolbar,
|
|
7441
|
+
showWelcome,
|
|
7442
|
+
recentSessions,
|
|
7443
|
+
onSessionClick,
|
|
7440
7444
|
threadId,
|
|
7441
7445
|
initialModelId,
|
|
7442
7446
|
initialFeatures
|
|
7443
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
|
+
}
|
|
7444
7509
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7445
7510
|
renderThreadHeader?.(),
|
|
7446
7511
|
/* @__PURE__ */ jsx(
|
|
@@ -7460,38 +7525,7 @@ function ChatPanel({
|
|
|
7460
7525
|
className: messagesClassName
|
|
7461
7526
|
}
|
|
7462
7527
|
),
|
|
7463
|
-
/* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-2", children:
|
|
7464
|
-
AIInputArea,
|
|
7465
|
-
{
|
|
7466
|
-
onSubmit: onSendMessage,
|
|
7467
|
-
onStop,
|
|
7468
|
-
value: input,
|
|
7469
|
-
onChange: onInputChange,
|
|
7470
|
-
placeholder,
|
|
7471
|
-
isLoading,
|
|
7472
|
-
supportFiles,
|
|
7473
|
-
supportWebSearch,
|
|
7474
|
-
supportDocumentSearch,
|
|
7475
|
-
supportDeepResearch,
|
|
7476
|
-
supportThinking,
|
|
7477
|
-
supportWorkCanvas,
|
|
7478
|
-
supportMultiModels,
|
|
7479
|
-
deploymentId,
|
|
7480
|
-
tenantAiAgentId,
|
|
7481
|
-
enableMicrophone,
|
|
7482
|
-
enableVoice,
|
|
7483
|
-
isRecording,
|
|
7484
|
-
recognition,
|
|
7485
|
-
onMicrophoneClick,
|
|
7486
|
-
footerText,
|
|
7487
|
-
showToolbar: !compactToolbar,
|
|
7488
|
-
compactToolbar,
|
|
7489
|
-
threadId,
|
|
7490
|
-
hasMessages: messages.length > 0,
|
|
7491
|
-
initialModelId,
|
|
7492
|
-
initialFeatures
|
|
7493
|
-
}
|
|
7494
|
-
) })
|
|
7528
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 pb-3 pt-2", children: renderInputArea() })
|
|
7495
7529
|
] });
|
|
7496
7530
|
}
|
|
7497
7531
|
var ALLOWED_ORIGINS = ["https://shell.docy.work", "https://shell-docyrus.web.app"];
|
|
@@ -22574,6 +22608,9 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22574
22608
|
onMicrophoneClick: commonProps2.onMicrophoneClick,
|
|
22575
22609
|
onToolAction: commonProps2.onToolAction,
|
|
22576
22610
|
openCanvasView: handleOpenCanvasView,
|
|
22611
|
+
showWelcome: commonProps2.showWelcome,
|
|
22612
|
+
recentSessions: commonProps2.recentSessions,
|
|
22613
|
+
onSessionClick: commonProps2.onSessionClick,
|
|
22577
22614
|
threadId: commonProps2.threadId,
|
|
22578
22615
|
initialModelId: commonProps2.initialModelId,
|
|
22579
22616
|
initialFeatures: commonProps2.initialFeatures,
|
|
@@ -22725,7 +22762,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22725
22762
|
activeAgent?.name ?? commonProps.title ?? "Assistant"
|
|
22726
22763
|
] }) : null;
|
|
22727
22764
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22728
|
-
showHeader && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
22765
|
+
showHeader && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
22729
22766
|
"relative z-50 flex items-center justify-between h-12 px-3 border-b shrink-0 bg-background",
|
|
22730
22767
|
!isSidebarOpen && enableSidebar && "pl-12"
|
|
22731
22768
|
), children: [
|
|
@@ -22817,7 +22854,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22817
22854
|
] })
|
|
22818
22855
|
] }),
|
|
22819
22856
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-row min-h-0 overflow-hidden relative", children: [
|
|
22820
|
-
!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: [
|
|
22821
22858
|
enableSidebar && onToggleSidebar && /* @__PURE__ */ jsx(
|
|
22822
22859
|
Button,
|
|
22823
22860
|
{
|
|
@@ -22855,7 +22892,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22855
22892
|
}
|
|
22856
22893
|
)
|
|
22857
22894
|
] }),
|
|
22858
|
-
enableSidebar && isSidebarOpen && renderSidebar && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22895
|
+
enableSidebar && isSidebarOpen && renderSidebar && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22859
22896
|
/* @__PURE__ */ jsx(
|
|
22860
22897
|
"div",
|
|
22861
22898
|
{
|
|
@@ -22886,7 +22923,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22886
22923
|
/* @__PURE__ */ jsx("div", { className: "flex-1 p-4 flex flex-col min-h-0 overflow-hidden", children: renderSidebar(true) })
|
|
22887
22924
|
] }) })
|
|
22888
22925
|
] }),
|
|
22889
|
-
enableSidebar && renderSidebar && /* @__PURE__ */ jsx(
|
|
22926
|
+
enableSidebar && renderSidebar && !(commonProps.showWelcome && commonProps.messages.length === 0) && /* @__PURE__ */ jsx(
|
|
22890
22927
|
"div",
|
|
22891
22928
|
{
|
|
22892
22929
|
className: cn(
|
|
@@ -23028,6 +23065,9 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
23028
23065
|
onToolAction: commonProps.onToolAction,
|
|
23029
23066
|
openCanvasView: handleOpenCanvasViewInline,
|
|
23030
23067
|
renderThreadHeader,
|
|
23068
|
+
showWelcome: commonProps.showWelcome,
|
|
23069
|
+
recentSessions: commonProps.recentSessions,
|
|
23070
|
+
onSessionClick: commonProps.onSessionClick,
|
|
23031
23071
|
threadId: commonProps.threadId,
|
|
23032
23072
|
initialModelId: commonProps.initialModelId,
|
|
23033
23073
|
initialFeatures: commonProps.initialFeatures,
|
|
@@ -24743,6 +24783,7 @@ var DocyAssistant = ({
|
|
|
24743
24783
|
enableNavDropdown = false,
|
|
24744
24784
|
enableVoice = false,
|
|
24745
24785
|
enableMicrophone = true,
|
|
24786
|
+
enableWelcomePage = true,
|
|
24746
24787
|
tenantAiAgentId,
|
|
24747
24788
|
onMessageSend,
|
|
24748
24789
|
onVoiceStart,
|
|
@@ -24784,6 +24825,7 @@ var DocyAssistant = ({
|
|
|
24784
24825
|
const { state: projectState, actions: projectActions } = useProjectState();
|
|
24785
24826
|
const { state: worksState, actions: worksActions } = useWorksState();
|
|
24786
24827
|
const [input, setInput] = useState("");
|
|
24828
|
+
const [showWelcome, setShowWelcome] = useState(enableWelcomePage);
|
|
24787
24829
|
const currentUserId = configUser.id;
|
|
24788
24830
|
const [projectSearchQuery, setProjectSearchQuery] = useState("");
|
|
24789
24831
|
const [isInlineFullscreen, setIsInlineFullscreen] = useState(defaultFullscreen);
|
|
@@ -24812,16 +24854,15 @@ var DocyAssistant = ({
|
|
|
24812
24854
|
const apiUrl = deploymentId ? `${baseUrl}${endpointPath.replace("/chat", `/deployments/${deploymentId}/chat`)}` : `${baseUrl}${endpointPath}`;
|
|
24813
24855
|
return new DefaultChatTransport({
|
|
24814
24856
|
api: apiUrl,
|
|
24815
|
-
prepareSendMessagesRequest: ({ messages: messages2,
|
|
24857
|
+
prepareSendMessagesRequest: ({ messages: messages2, ...rest }) => {
|
|
24816
24858
|
const options3 = messageOptionsRef.current;
|
|
24817
24859
|
return {
|
|
24860
|
+
...rest,
|
|
24818
24861
|
body: {
|
|
24819
|
-
...body,
|
|
24862
|
+
...rest.body,
|
|
24820
24863
|
agentId: activeAgentId,
|
|
24821
24864
|
threadId: selectedSessionIdRef.current,
|
|
24822
|
-
// Use ref for immediate access
|
|
24823
24865
|
messages: messages2.slice(-10),
|
|
24824
|
-
// Only send last 10 messages
|
|
24825
24866
|
modelId: options3?.modelId,
|
|
24826
24867
|
supportMultipleModels: options3?.supportMultipleModels,
|
|
24827
24868
|
supportFiles: options3?.supportFiles,
|
|
@@ -24837,7 +24878,6 @@ var DocyAssistant = ({
|
|
|
24837
24878
|
headers: () => {
|
|
24838
24879
|
const token = authTokenRef.current;
|
|
24839
24880
|
return {
|
|
24840
|
-
"Content-Type": "application/json",
|
|
24841
24881
|
...token && { Authorization: `Bearer ${token}` }
|
|
24842
24882
|
};
|
|
24843
24883
|
},
|
|
@@ -25039,6 +25079,7 @@ var DocyAssistant = ({
|
|
|
25039
25079
|
sessionActions.selectSessionId(session.id);
|
|
25040
25080
|
sessionActions.selectSession(session);
|
|
25041
25081
|
uiActions.setActiveTab(0);
|
|
25082
|
+
setShowWelcome(false);
|
|
25042
25083
|
await loadThreadMessages2(session.id);
|
|
25043
25084
|
};
|
|
25044
25085
|
const createNewThread = () => {
|
|
@@ -25046,11 +25087,13 @@ var DocyAssistant = ({
|
|
|
25046
25087
|
sessionActions.selectSession(null);
|
|
25047
25088
|
uiActions.setActiveTab(0);
|
|
25048
25089
|
setMessages([]);
|
|
25090
|
+
setShowWelcome(false);
|
|
25049
25091
|
};
|
|
25050
25092
|
const handleSendMessage = async (e, options3, overrideText) => {
|
|
25051
25093
|
e?.preventDefault();
|
|
25052
25094
|
const messageText = (overrideText ?? input).trim();
|
|
25053
25095
|
if (!messageText) return;
|
|
25096
|
+
setShowWelcome(false);
|
|
25054
25097
|
messageOptionsRef.current = options3;
|
|
25055
25098
|
let currentThreadId = selectedSessionIdRef.current;
|
|
25056
25099
|
if (!currentThreadId) {
|
|
@@ -25332,6 +25375,9 @@ var DocyAssistant = ({
|
|
|
25332
25375
|
isRecording,
|
|
25333
25376
|
recognition,
|
|
25334
25377
|
onMicrophoneClick: handleMicrophoneClick,
|
|
25378
|
+
showWelcome,
|
|
25379
|
+
recentSessions: sessionState.sessions,
|
|
25380
|
+
onSessionClick: handleSessionClick,
|
|
25335
25381
|
isSidebarOpen: uiState.isSidebarOpen,
|
|
25336
25382
|
onToggleSidebar: () => uiActions.setSidebarOpen(!uiState.isSidebarOpen),
|
|
25337
25383
|
renderSidebar: renderSidebarContent,
|