@docyrus/ui-pro-ai-assistant 0.2.4 → 0.2.6
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 +85 -1
- package/dist/components/agent-trigger-widget/agent-carousel.d.ts +8 -0
- package/dist/components/agent-trigger-widget/agent-trigger-prompt.d.ts +18 -0
- package/dist/components/agent-trigger-widget/index.d.ts +8 -0
- package/dist/docy-assistant.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-agents-data.d.ts +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +716 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/plate-editor/editor/plugins/block-menu-kit.d.ts +8 -8
- package/dist/internal/plate-editor/editor/plugins/block-selection-kit.d.ts +8 -8
- package/dist/stub.d.ts +7 -0
- package/dist/stub.js +10 -0
- package/dist/stub.js.map +1 -0
- package/dist/styles.css +194 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/vite.js +165 -1
- package/dist/vite.js.map +1 -1
- package/dist/worker.js +163 -1
- package/dist/worker.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-VSTHZ22Q.js +0 -165
- package/dist/chunk-VSTHZ22Q.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ A full-featured, drop-in AI assistant chat UI for React. Ships with multi-turn c
|
|
|
12
12
|
- **AI memories** — Persistent memory management across sessions.
|
|
13
13
|
- **Voice input** — Browser-native speech-to-text.
|
|
14
14
|
- **File uploads** — Attach files to messages with configurable format restrictions.
|
|
15
|
+
- **Agent trigger widget** — Standalone agent carousel with prompt input, per-agent capabilities, model/reasoning selection, and suggestion chips. Decoupled from the chat UI — wire it to any destination.
|
|
15
16
|
- **Chromeless mode** — Optionally hide the header and/or border for seamless embedding.
|
|
16
17
|
- **i18n** — English, German, Spanish, French, Italian, Portuguese, Greek, Slovenian, Turkish.
|
|
17
18
|
- **Vite plugin** — Optional dev-server middleware for Plate editor AI commands.
|
|
@@ -119,7 +120,7 @@ function ModalExample() {
|
|
|
119
120
|
|
|
120
121
|
```ts
|
|
121
122
|
// Components
|
|
122
|
-
import { DocyAssistant } from "@docyrus/ui-pro-ai-assistant";
|
|
123
|
+
import { DocyAssistant, AgentTriggerWidget } from "@docyrus/ui-pro-ai-assistant";
|
|
123
124
|
|
|
124
125
|
// Provider & config
|
|
125
126
|
import {
|
|
@@ -137,6 +138,8 @@ import {
|
|
|
137
138
|
import type {
|
|
138
139
|
AssistantConfig,
|
|
139
140
|
AssistantUser,
|
|
141
|
+
AgentTriggerWidgetProps,
|
|
142
|
+
PromptFeatureFlags,
|
|
140
143
|
Project,
|
|
141
144
|
Work,
|
|
142
145
|
WorkTypes,
|
|
@@ -261,6 +264,87 @@ The main chat interface component.
|
|
|
261
264
|
| `onVoiceStart` | `() => void` | Fires when voice recording starts |
|
|
262
265
|
| `onVoiceEnd` | `() => void` | Fires when voice recording ends |
|
|
263
266
|
|
|
267
|
+
#### Initial prompt
|
|
268
|
+
|
|
269
|
+
| Prop | Type | Default | Description |
|
|
270
|
+
|------|------|---------|-------------|
|
|
271
|
+
| `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
|
+
---
|
|
274
|
+
|
|
275
|
+
### `<AgentTriggerWidget>`
|
|
276
|
+
|
|
277
|
+
A standalone agent discovery and prompt input component. Displays agents in a carousel with per-agent capabilities, model selection, reasoning levels, and suggestion chips. Fully decoupled from `DocyAssistant` — the consumer decides what happens on submit.
|
|
278
|
+
|
|
279
|
+
```tsx
|
|
280
|
+
import { AssistantProvider, AgentTriggerWidget } from "@docyrus/ui-pro-ai-assistant";
|
|
281
|
+
|
|
282
|
+
<AssistantProvider config={config}>
|
|
283
|
+
<AgentTriggerWidget
|
|
284
|
+
agentIds={["agent-id-1", "agent-id-2"]}
|
|
285
|
+
onSubmit={(agentId, prompt, features, modelId) => {
|
|
286
|
+
// Open DocyAssistant, navigate to a chat page, call an API, etc.
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
</AssistantProvider>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### Props
|
|
293
|
+
|
|
294
|
+
| Prop | Type | Default | Description |
|
|
295
|
+
|------|------|---------|-------------|
|
|
296
|
+
| `agentIds` | `string[]` | — | **Required.** Agent IDs to display in the carousel |
|
|
297
|
+
| `className` | `string` | — | CSS class on the root element |
|
|
298
|
+
| `placeholder` | `string` | — | Prompt input placeholder text |
|
|
299
|
+
| `onSubmit` | `(agentId, prompt, features, modelId?) => void` | — | Fires when the user submits a prompt. Receives the selected agent ID, prompt text, feature flags, and optional model ID |
|
|
300
|
+
|
|
301
|
+
#### `PromptFeatureFlags`
|
|
302
|
+
|
|
303
|
+
The `features` object passed to `onSubmit`:
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
interface PromptFeatureFlags {
|
|
307
|
+
webSearch: boolean;
|
|
308
|
+
thinking: boolean;
|
|
309
|
+
deepResearch: boolean;
|
|
310
|
+
documentSearch: boolean;
|
|
311
|
+
workCanvas: boolean;
|
|
312
|
+
files: boolean;
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
#### Combining with DocyAssistant
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
function MyPage() {
|
|
320
|
+
const [assistantOpen, setAssistantOpen] = useState(false);
|
|
321
|
+
const [agentId, setAgentId] = useState<string | null>(null);
|
|
322
|
+
const [initialPrompt, setInitialPrompt] = useState<string>();
|
|
323
|
+
|
|
324
|
+
return (
|
|
325
|
+
<AssistantProvider config={config}>
|
|
326
|
+
<AgentTriggerWidget
|
|
327
|
+
agentIds={agentIds}
|
|
328
|
+
onSubmit={(id, prompt) => {
|
|
329
|
+
setAgentId(id);
|
|
330
|
+
setInitialPrompt(prompt);
|
|
331
|
+
setAssistantOpen(true);
|
|
332
|
+
}}
|
|
333
|
+
/>
|
|
334
|
+
{assistantOpen && agentId && (
|
|
335
|
+
<DocyAssistant
|
|
336
|
+
isOpen
|
|
337
|
+
onClose={() => setAssistantOpen(false)}
|
|
338
|
+
tenantAiAgentId={agentId}
|
|
339
|
+
initialPrompt={initialPrompt}
|
|
340
|
+
renderMode="modal"
|
|
341
|
+
/>
|
|
342
|
+
)}
|
|
343
|
+
</AssistantProvider>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
264
348
|
---
|
|
265
349
|
|
|
266
350
|
### `useAssistantConfig()`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AgentTriggerData } from '../../hooks/use-agents-data';
|
|
2
|
+
export interface AgentCarouselProps {
|
|
3
|
+
agents: AgentTriggerData[];
|
|
4
|
+
selectedIndex: number;
|
|
5
|
+
onSelect: (index: number) => void;
|
|
6
|
+
onNavigate: (direction: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AgentCarousel({ agents, selectedIndex, onSelect, onNavigate }: AgentCarouselProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AgentCapabilities } from '../../hooks/use-deployment-data';
|
|
2
|
+
import { type Model } from '../../types';
|
|
3
|
+
export interface PromptFeatureFlags {
|
|
4
|
+
webSearch: boolean;
|
|
5
|
+
thinking: boolean;
|
|
6
|
+
deepResearch: boolean;
|
|
7
|
+
documentSearch: boolean;
|
|
8
|
+
workCanvas: boolean;
|
|
9
|
+
files: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentTriggerPromptProps {
|
|
12
|
+
capabilities: AgentCapabilities | null;
|
|
13
|
+
models: Model[];
|
|
14
|
+
suggestions: string[];
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
onSubmit: (prompt: string, features: PromptFeatureFlags, modelId?: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function AgentTriggerPrompt({ capabilities, models, suggestions, placeholder, onSubmit }: AgentTriggerPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PromptFeatureFlags } from './agent-trigger-prompt';
|
|
2
|
+
export interface AgentTriggerWidgetProps {
|
|
3
|
+
agentIds: string[];
|
|
4
|
+
className?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
onSubmit?: (agentId: string, prompt: string, features: PromptFeatureFlags, modelId?: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AgentTriggerWidget({ agentIds, className, placeholder, onSubmit }: AgentTriggerWidgetProps): import("react/jsx-runtime").JSX.Element;
|
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, ...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, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, hideExpand, hideCloseButton, hideAgentSelector, hideBorder, showHeader, agentSelectorUrl, baseAgentSelectorUrl, onAgentChange, initialPrompt, ...props }: DocyAssistantProps & {
|
|
4
4
|
ref?: RefObject<HTMLDivElement | null>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { useAgentsData, type AgentTriggerData, type UseAgentsDataResult } from './use-agents-data';
|
|
1
2
|
export { useAssistantApi } from './use-assistant-api';
|
|
2
3
|
export { useDeploymentData } from './use-deployment-data';
|
|
3
4
|
export { type ProjectState, useProjectState } from './use-project-state';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AgentCapabilities } from './use-deployment-data';
|
|
2
|
+
import { type Model } from '../types';
|
|
3
|
+
export interface AgentTriggerData {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
avatar: string | null;
|
|
7
|
+
welcomeMessage: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
capabilities: AgentCapabilities;
|
|
10
|
+
models: Model[];
|
|
11
|
+
standardSuggestions: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface UseAgentsDataResult {
|
|
14
|
+
agents: AgentTriggerData[];
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
retry: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function useAgentsData(agentIds: string[]): UseAgentsDataResult;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { DocyAssistant } from './docy-assistant';
|
|
2
2
|
export { type AssistantConfig, AssistantProvider, type AssistantUser, useAssistantConfig } from './lib/assistant-config';
|
|
3
3
|
export { AssistantI18nProvider, useAssistantTranslation } from './i18n';
|
|
4
|
+
export { AgentTriggerWidget, type AgentTriggerWidgetProps } from './components/agent-trigger-widget';
|
|
5
|
+
export { type PromptFeatureFlags } from './components/agent-trigger-widget/agent-trigger-prompt';
|
|
4
6
|
export type { Project, Work, WorkTypes } from './types';
|