@docyrus/ui-pro-ai-assistant 0.6.4 → 0.6.5
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 +3 -0
- package/dist/docy-assistant.d.ts +1 -1
- package/dist/index.js +47 -4
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +11 -0
- package/dist/views/assistant-view.d.ts +8 -0
- package/dist/views/chat-panel.d.ts +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -262,6 +262,9 @@ The main chat interface component.
|
|
|
262
262
|
|------|------|---------|-------------|
|
|
263
263
|
| `apiEndpoint` | `string` | `"/ai/agents/:agentId/chat"` | Chat endpoint template (`:agentId` is replaced at runtime) |
|
|
264
264
|
| `hostEnvironment` | `string` | — | Host environment identifier sent to the chat endpoint as `hostEnvironment`. The backend uses this to filter the tool list bound to the agent so only tools available in the current environment are exposed. Common values: `"web"`, `"desktop"`, `"chrome"`, `"word"`, `"excel"`, `"powerpoint"`, `"outlook"` |
|
|
265
|
+
| `appId` | `string` | — | ID of the host app currently open in the page. Forwarded to the chat endpoint as `appId` so the agent can scope its behavior/tools to it. Renders a dismissable "Talking about <app>" chip above the input; once the user clears it, the id stops being sent |
|
|
266
|
+
| `appName` | `string` | — | Display name for the current host app, shown in the context chip |
|
|
267
|
+
| `appLogo` | `string` | — | Logo URL for the current host app, shown in the context chip |
|
|
265
268
|
|
|
266
269
|
#### Callbacks
|
|
267
270
|
|
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, enableWelcomePage, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, hideExpand, hideCloseButton, hideAgentSelector, hideBorder, showHeader, hideHeaderOnWelcome, agentSelectorUrl, baseAgentSelectorUrl, onAgentChange, enableSharing, onShare: onShareProp, initialPrompt, initialModelId, initialFeatures, initialFiles, hostEnvironment, clientTools, ...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, hideHeaderOnWelcome, agentSelectorUrl, baseAgentSelectorUrl, onAgentChange, enableSharing, onShare: onShareProp, initialPrompt, initialModelId, initialFeatures, initialFiles, hostEnvironment, appId, appName, appLogo, clientTools, ...props }: DocyAssistantProps & {
|
|
4
4
|
ref?: RefObject<HTMLDivElement | null>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -15016,8 +15016,27 @@ function ChatPanel({
|
|
|
15016
15016
|
initialModelId,
|
|
15017
15017
|
initialFeatures,
|
|
15018
15018
|
subagents,
|
|
15019
|
-
onManageMemories
|
|
15019
|
+
onManageMemories,
|
|
15020
|
+
appContext,
|
|
15021
|
+
onClearAppContext
|
|
15020
15022
|
}) {
|
|
15023
|
+
const renderAppContextChip = () => {
|
|
15024
|
+
if (!appContext) return null;
|
|
15025
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2 self-start rounded-full border bg-muted/50 px-2 py-1 text-xs text-foreground", children: [
|
|
15026
|
+
appContext.logo ? /* @__PURE__ */ jsx("img", { src: appContext.logo, alt: "", className: "size-4 rounded" }) : null,
|
|
15027
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[200px] truncate", children: appContext.name ? `Talking about ${appContext.name}` : "App context attached" }),
|
|
15028
|
+
onClearAppContext ? /* @__PURE__ */ jsx(
|
|
15029
|
+
"button",
|
|
15030
|
+
{
|
|
15031
|
+
type: "button",
|
|
15032
|
+
"aria-label": "Remove app context",
|
|
15033
|
+
onClick: onClearAppContext,
|
|
15034
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
15035
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
15036
|
+
}
|
|
15037
|
+
) : null
|
|
15038
|
+
] });
|
|
15039
|
+
};
|
|
15021
15040
|
const renderInputArea = (hideFooter = false) => /* @__PURE__ */ jsx(
|
|
15022
15041
|
AIInputArea,
|
|
15023
15042
|
{
|
|
@@ -15072,7 +15091,10 @@ function ChatPanel({
|
|
|
15072
15091
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 pb-6", 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: [
|
|
15073
15092
|
hasAgentAnimations(tenantAiAgentId) ? /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "opening", agentId: tenantAiAgentId, className: "w-10 h-10" }) : logo ? /* @__PURE__ */ jsx(AIMessageAvatar, { src: logo, name: title || "Assistant", className: "w-10 h-10" }) : /* @__PURE__ */ jsx(AssistantAnimations, { animationType: "opening", className: "w-10 h-10" }),
|
|
15074
15093
|
/* @__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." }) }),
|
|
15075
|
-
/* @__PURE__ */
|
|
15094
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-col", children: [
|
|
15095
|
+
renderAppContextChip(),
|
|
15096
|
+
renderInputArea(true)
|
|
15097
|
+
] })
|
|
15076
15098
|
] }) }),
|
|
15077
15099
|
recentSessions && recentSessions.length > 0 && !isLoadingAgent ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
|
|
15078
15100
|
/* @__PURE__ */ jsx("h2", { className: "shrink-0 text-sm font-medium text-muted-foreground", children: "Recent Sessions" }),
|
|
@@ -15117,7 +15139,10 @@ function ChatPanel({
|
|
|
15117
15139
|
className: messagesClassName
|
|
15118
15140
|
}
|
|
15119
15141
|
),
|
|
15120
|
-
/* @__PURE__ */
|
|
15142
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col px-3 pb-3 pt-2", children: [
|
|
15143
|
+
renderAppContextChip(),
|
|
15144
|
+
renderInputArea()
|
|
15145
|
+
] })
|
|
15121
15146
|
] });
|
|
15122
15147
|
}
|
|
15123
15148
|
var ALLOWED_ORIGINS = ["https://shell.docy.work", "https://shell-docyrus.web.app"];
|
|
@@ -30221,6 +30246,8 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
30221
30246
|
initialModelId: commonProps2.initialModelId,
|
|
30222
30247
|
initialFeatures: commonProps2.initialFeatures,
|
|
30223
30248
|
subagents: commonProps2.subagents,
|
|
30249
|
+
appContext: commonProps2.appContext,
|
|
30250
|
+
onClearAppContext: commonProps2.onClearAppContext,
|
|
30224
30251
|
messagesClassName: "p-4"
|
|
30225
30252
|
}
|
|
30226
30253
|
);
|
|
@@ -30651,6 +30678,8 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
30651
30678
|
initialModelId: commonProps.initialModelId,
|
|
30652
30679
|
initialFeatures: commonProps.initialFeatures,
|
|
30653
30680
|
subagents: commonProps.subagents,
|
|
30681
|
+
appContext: commonProps.appContext,
|
|
30682
|
+
onClearAppContext: commonProps.onClearAppContext,
|
|
30654
30683
|
onManageMemories: onTabChange ? () => onTabChange(4) : void 0,
|
|
30655
30684
|
compactToolbar: !isFullscreen
|
|
30656
30685
|
}
|
|
@@ -31991,6 +32020,9 @@ var DocyAssistant = ({
|
|
|
31991
32020
|
initialFeatures,
|
|
31992
32021
|
initialFiles,
|
|
31993
32022
|
hostEnvironment,
|
|
32023
|
+
appId,
|
|
32024
|
+
appName,
|
|
32025
|
+
appLogo,
|
|
31994
32026
|
clientTools,
|
|
31995
32027
|
...props
|
|
31996
32028
|
}) => {
|
|
@@ -32027,6 +32059,13 @@ var DocyAssistant = ({
|
|
|
32027
32059
|
const [projectSearchQuery, setProjectSearchQuery] = useState("");
|
|
32028
32060
|
const [isInlineFullscreen, setIsInlineFullscreen] = useState(defaultFullscreen);
|
|
32029
32061
|
const [sharingEditorOpen, setSharingEditorOpen] = useState(false);
|
|
32062
|
+
const [appContext, setAppContext] = useState(
|
|
32063
|
+
appId ? { id: appId, name: appName, logo: appLogo } : null
|
|
32064
|
+
);
|
|
32065
|
+
useEffect(() => {
|
|
32066
|
+
setAppContext(appId ? { id: appId, name: appName, logo: appLogo } : null);
|
|
32067
|
+
}, [appId, appName, appLogo]);
|
|
32068
|
+
const clearAppContext = useCallback(() => setAppContext(null), []);
|
|
32030
32069
|
const { isRecording, recognition, handleMicrophoneClick } = useSpeechRecognition({
|
|
32031
32070
|
enabled: enableMicrophone,
|
|
32032
32071
|
onTranscript: (transcript) => setInput((prev) => prev + (prev ? " " : "") + transcript),
|
|
@@ -32079,6 +32118,7 @@ var DocyAssistant = ({
|
|
|
32079
32118
|
supportThinking: options3?.supportThinking,
|
|
32080
32119
|
supportWorkCanvas: options3?.supportWorkCanvas,
|
|
32081
32120
|
...hostEnvironment ? { hostEnvironment } : {},
|
|
32121
|
+
...appContext?.id ? { appId: appContext.id } : {},
|
|
32082
32122
|
...clientToolDefsRef.current.length ? { clientTools: clientToolDefsRef.current } : {},
|
|
32083
32123
|
...options3?.filePaths?.length ? { files: options3.filePaths } : {}
|
|
32084
32124
|
}
|
|
@@ -32100,7 +32140,8 @@ var DocyAssistant = ({
|
|
|
32100
32140
|
apiEndpoint,
|
|
32101
32141
|
activeAgentId,
|
|
32102
32142
|
deploymentId,
|
|
32103
|
-
hostEnvironment
|
|
32143
|
+
hostEnvironment,
|
|
32144
|
+
appContext?.id
|
|
32104
32145
|
]);
|
|
32105
32146
|
const {
|
|
32106
32147
|
messages = [],
|
|
@@ -32618,6 +32659,8 @@ var DocyAssistant = ({
|
|
|
32618
32659
|
deploymentId,
|
|
32619
32660
|
tenantAiAgentId: activeAgentId,
|
|
32620
32661
|
subagents,
|
|
32662
|
+
appContext,
|
|
32663
|
+
onClearAppContext: clearAppContext,
|
|
32621
32664
|
initialModelId,
|
|
32622
32665
|
initialFeatures,
|
|
32623
32666
|
enableMicrophone,
|