@docyrus/ui-pro-ai-assistant 0.3.3 → 0.3.4
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 +16 -2
- package/dist/components/agent-trigger-widget/agent-trigger-prompt.d.ts +0 -1
- package/dist/components/input-area.d.ts +2 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -3
- package/dist/types/index.d.ts +8 -8
- package/dist/views/assistant-view.d.ts +2 -8
- package/dist/views/chat-panel.d.ts +2 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,7 @@ import type {
|
|
|
139
139
|
AssistantConfig,
|
|
140
140
|
AssistantUser,
|
|
141
141
|
AgentTriggerWidgetProps,
|
|
142
|
+
InitialFeatureFlags,
|
|
142
143
|
PromptFeatureFlags,
|
|
143
144
|
Project,
|
|
144
145
|
Work,
|
|
@@ -270,7 +271,7 @@ The main chat interface component.
|
|
|
270
271
|
|------|------|---------|-------------|
|
|
271
272
|
| `initialPrompt` | `string` | — | When provided, the assistant auto-sends this message on mount. Useful when launching the assistant from an agent trigger widget or deep link |
|
|
272
273
|
| `initialModelId` | `string` | — | Model ID to pre-select when auto-sending the initial prompt |
|
|
273
|
-
| `initialFeatures` | `
|
|
274
|
+
| `initialFeatures` | `InitialFeatureFlags` | — | Feature flags to enable when auto-sending the initial prompt |
|
|
274
275
|
| `initialFiles` | `File[]` | — | Files to attach when auto-sending the initial prompt |
|
|
275
276
|
|
|
276
277
|
---
|
|
@@ -312,7 +313,20 @@ interface PromptFeatureFlags {
|
|
|
312
313
|
deepResearch: boolean;
|
|
313
314
|
documentSearch: boolean;
|
|
314
315
|
workCanvas: boolean;
|
|
315
|
-
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### `InitialFeatureFlags`
|
|
320
|
+
|
|
321
|
+
Used by `DocyAssistant.initialFeatures` — all fields are optional since you only need to set the ones you want enabled:
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
interface InitialFeatureFlags {
|
|
325
|
+
webSearch?: boolean;
|
|
326
|
+
thinking?: boolean;
|
|
327
|
+
deepResearch?: boolean;
|
|
328
|
+
documentSearch?: boolean;
|
|
329
|
+
workCanvas?: boolean;
|
|
316
330
|
}
|
|
317
331
|
```
|
|
318
332
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChangeEvent, type FC, type FormEvent } from 'react';
|
|
2
|
+
import { type InitialFeatureFlags } from '../types';
|
|
2
3
|
interface SubmitOptions {
|
|
3
4
|
modelId?: string;
|
|
4
5
|
supportMultipleModels?: boolean;
|
|
@@ -45,13 +46,7 @@ interface AIInputAreaProps {
|
|
|
45
46
|
hasMessages?: boolean;
|
|
46
47
|
tenantAiProjectId?: string;
|
|
47
48
|
initialModelId?: string;
|
|
48
|
-
initialFeatures?:
|
|
49
|
-
webSearch?: boolean;
|
|
50
|
-
thinking?: boolean;
|
|
51
|
-
deepResearch?: boolean;
|
|
52
|
-
documentSearch?: boolean;
|
|
53
|
-
workCanvas?: boolean;
|
|
54
|
-
};
|
|
49
|
+
initialFeatures?: InitialFeatureFlags;
|
|
55
50
|
}
|
|
56
51
|
export declare const AIInputArea: FC<AIInputAreaProps>;
|
|
57
52
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { type AssistantConfig, AssistantProvider, type AssistantUser, useAssista
|
|
|
3
3
|
export { AssistantI18nProvider, useAssistantTranslation } from './i18n';
|
|
4
4
|
export { AgentTriggerWidget, type AgentTriggerWidgetProps } from './components/agent-trigger-widget';
|
|
5
5
|
export { type PromptFeatureFlags } from './components/agent-trigger-widget/agent-trigger-prompt';
|
|
6
|
-
export type { Project, Work, WorkTypes } from './types';
|
|
6
|
+
export type { InitialFeatureFlags, Project, Work, WorkTypes } from './types';
|
package/dist/index.js
CHANGED
|
@@ -22770,7 +22770,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22770
22770
|
variant: "ghost",
|
|
22771
22771
|
size: "icon",
|
|
22772
22772
|
onClick: onToggleSidebar,
|
|
22773
|
-
className: "h-8 w-8 text-
|
|
22773
|
+
className: "h-8 w-8 text-foreground hover:bg-accent hover:text-accent-foreground rounded-md shadow-sm",
|
|
22774
22774
|
title: t("tabs.sessions"),
|
|
22775
22775
|
children: /* @__PURE__ */ jsx(PanelLeft, { className: "w-4 h-4" })
|
|
22776
22776
|
}
|
|
@@ -22782,7 +22782,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22782
22782
|
size: "icon",
|
|
22783
22783
|
onClick: () => onTabChange(activeTab === 4 ? 0 : 4),
|
|
22784
22784
|
className: cn(
|
|
22785
|
-
"h-8 w-8 text-
|
|
22785
|
+
"h-8 w-8 text-foreground hover:bg-accent hover:text-accent-foreground rounded-md shadow-sm",
|
|
22786
22786
|
activeTab === 4 && "bg-background text-foreground shadow"
|
|
22787
22787
|
),
|
|
22788
22788
|
title: t("tabs.memories"),
|
|
@@ -22795,7 +22795,7 @@ var AssistantView = ({ ref, ...props }) => {
|
|
|
22795
22795
|
variant: "ghost",
|
|
22796
22796
|
size: "icon",
|
|
22797
22797
|
onClick: onNewChat,
|
|
22798
|
-
className: "h-8 w-8 text-
|
|
22798
|
+
className: "h-8 w-8 text-foreground hover:bg-accent hover:text-accent-foreground rounded-md shadow-sm",
|
|
22799
22799
|
title: t("buttons.start_new_thread"),
|
|
22800
22800
|
children: /* @__PURE__ */ jsx(Edit, { className: "w-4 h-4" })
|
|
22801
22801
|
}
|
|
@@ -25075,7 +25075,6 @@ var DocyAssistant = ({
|
|
|
25075
25075
|
initialOptions.supportDeepResearch = initialFeatures.deepResearch;
|
|
25076
25076
|
initialOptions.supportDocumentSearch = initialFeatures.documentSearch;
|
|
25077
25077
|
initialOptions.supportWorkCanvas = initialFeatures.workCanvas;
|
|
25078
|
-
initialOptions.supportFiles = initialFeatures.files;
|
|
25079
25078
|
}
|
|
25080
25079
|
if (initialFiles && initialFiles.length > 0) {
|
|
25081
25080
|
const fileData = [];
|
|
@@ -25767,9 +25766,9 @@ function computeVisibleSlots(agents, index) {
|
|
|
25767
25766
|
}
|
|
25768
25767
|
var SLOT_OUTER_CLASS = {
|
|
25769
25768
|
0: "z-0 mx-2",
|
|
25770
|
-
1: "z-5 mx-4",
|
|
25769
|
+
1: "z-[5] mx-4",
|
|
25771
25770
|
2: "z-10 mx-6",
|
|
25772
|
-
3: "z-5 mx-4",
|
|
25771
|
+
3: "z-[5] mx-4",
|
|
25773
25772
|
4: "z-0 mx-2"
|
|
25774
25773
|
};
|
|
25775
25774
|
var SLOT_CIRCLE_CLASS = {
|
|
@@ -25917,12 +25916,6 @@ var CAPABILITY_TOGGLES = [
|
|
|
25917
25916
|
capKey: "supportWorkCanvas",
|
|
25918
25917
|
icon: PenTool,
|
|
25919
25918
|
labelKey: "tools.work_canvas"
|
|
25920
|
-
},
|
|
25921
|
-
{
|
|
25922
|
-
key: "files",
|
|
25923
|
-
capKey: "supportFiles",
|
|
25924
|
-
icon: FileUp,
|
|
25925
|
-
labelKey: "tools.file_upload"
|
|
25926
25919
|
}
|
|
25927
25920
|
];
|
|
25928
25921
|
var ACCEPTED_FILE_TYPES = ".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.json,.xml,.png,.jpg,.jpeg,.gif,.webp";
|
|
@@ -25958,13 +25951,20 @@ function ToggleSwitch({
|
|
|
25958
25951
|
function useClickOutside(ref, open, onClose) {
|
|
25959
25952
|
useEffect(() => {
|
|
25960
25953
|
if (!open) return;
|
|
25961
|
-
const
|
|
25954
|
+
const handleClick = (e) => {
|
|
25962
25955
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
25963
25956
|
onClose();
|
|
25964
25957
|
}
|
|
25965
25958
|
};
|
|
25966
|
-
|
|
25967
|
-
|
|
25959
|
+
const handleEscape = (e) => {
|
|
25960
|
+
if (e.key === "Escape") onClose();
|
|
25961
|
+
};
|
|
25962
|
+
document.addEventListener("mousedown", handleClick);
|
|
25963
|
+
document.addEventListener("keydown", handleEscape);
|
|
25964
|
+
return () => {
|
|
25965
|
+
document.removeEventListener("mousedown", handleClick);
|
|
25966
|
+
document.removeEventListener("keydown", handleEscape);
|
|
25967
|
+
};
|
|
25968
25968
|
}, [ref, open, onClose]);
|
|
25969
25969
|
}
|
|
25970
25970
|
function AgentTriggerPrompt({
|
|
@@ -25987,8 +25987,7 @@ function AgentTriggerPrompt({
|
|
|
25987
25987
|
thinking: false,
|
|
25988
25988
|
deepResearch: false,
|
|
25989
25989
|
documentSearch: false,
|
|
25990
|
-
workCanvas: false
|
|
25991
|
-
files: false
|
|
25990
|
+
workCanvas: false
|
|
25992
25991
|
});
|
|
25993
25992
|
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
25994
25993
|
const [modelDropdownOpen, setModelDropdownOpen] = useState(false);
|
|
@@ -26010,6 +26009,11 @@ function AgentTriggerPrompt({
|
|
|
26010
26009
|
useClickOutside(settingsRef, settingsOpen, () => setSettingsOpen(false));
|
|
26011
26010
|
useClickOutside(modelRef, modelDropdownOpen, () => setModelDropdownOpen(false));
|
|
26012
26011
|
useClickOutside(reasoningRef, reasoningDropdownOpen, () => setReasoningDropdownOpen(false));
|
|
26012
|
+
useEffect(() => () => {
|
|
26013
|
+
if (mediaRecorderRef.current && mediaRecorderRef.current.state === "recording") {
|
|
26014
|
+
mediaRecorderRef.current.stop();
|
|
26015
|
+
}
|
|
26016
|
+
}, []);
|
|
26013
26017
|
useEffect(() => {
|
|
26014
26018
|
if (models.length > 0 && !models.find((m) => m.id === selectedModel?.id)) {
|
|
26015
26019
|
setSelectedModel(models[0]);
|
|
@@ -26414,7 +26418,8 @@ function AgentTriggerWidget({
|
|
|
26414
26418
|
} = useAgentsData(agentIds);
|
|
26415
26419
|
const [carouselIndex, setCarouselIndex] = useState(0);
|
|
26416
26420
|
const containerRef = useRef(null);
|
|
26417
|
-
const
|
|
26421
|
+
const safeIndex = agents.length > 0 ? Math.min(carouselIndex, agents.length - 1) : 0;
|
|
26422
|
+
const currentAgent = agents[safeIndex] ?? null;
|
|
26418
26423
|
const navigateCarousel = useCallback(
|
|
26419
26424
|
(direction) => {
|
|
26420
26425
|
if (agents.length <= 1) return;
|
|
@@ -26431,10 +26436,7 @@ function AgentTriggerWidget({
|
|
|
26431
26436
|
},
|
|
26432
26437
|
[currentAgent, onSubmit]
|
|
26433
26438
|
);
|
|
26434
|
-
const welcomeText =
|
|
26435
|
-
if (!currentAgent?.welcomeMessage) return "";
|
|
26436
|
-
return currentAgent.welcomeMessage;
|
|
26437
|
-
}, [currentAgent?.welcomeMessage]);
|
|
26439
|
+
const welcomeText = currentAgent?.welcomeMessage ?? "";
|
|
26438
26440
|
if (isLoading) {
|
|
26439
26441
|
return /* @__PURE__ */ jsxs(
|
|
26440
26442
|
"div",
|
|
@@ -26501,7 +26503,7 @@ function AgentTriggerWidget({
|
|
|
26501
26503
|
AgentCarousel,
|
|
26502
26504
|
{
|
|
26503
26505
|
agents,
|
|
26504
|
-
selectedIndex:
|
|
26506
|
+
selectedIndex: safeIndex,
|
|
26505
26507
|
onSelect: setCarouselIndex,
|
|
26506
26508
|
onNavigate: navigateCarousel
|
|
26507
26509
|
}
|