@filigran/chatbot 3.9.1 → 3.11.0
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 +21 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/markdown.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -71,7 +71,9 @@ import { ChatPanel } from '@filigran/chatbot';
|
|
|
71
71
|
| `apiBaseUrl` | `string` | **required** | Base URL for chat API endpoints |
|
|
72
72
|
| `user` | `{ firstName: string }` | **required** | Current user info |
|
|
73
73
|
| `topOffset` | `number` | `0` | Top offset in pixels (for sidebar/fullscreen with fixed headers) |
|
|
74
|
-
| `agentDashboardUrl` | `string` | — | URL for "Browse agents" / "Create agent" links
|
|
74
|
+
| `agentDashboardUrl` | `string` | — | XTM One URL for the "Browse agents" / "Create agent" links and the waiting panel's "Play Space Invaders in XTM One" link (`{url}/chat?arcade=play`, http(s) only) |
|
|
75
|
+
| `miniGameEnabled` | `boolean` | `true` | Show the waiting panel during longer waits: rotating messages and the invitation to play XTM One's arcade (the package ships no game of its own) |
|
|
76
|
+
| `onPlayWaitingGame` | `() => void` | — | Open the arcade in place instead of linking to XTM One, for a host that runs it itself (the XTM One floating assistant) |
|
|
75
77
|
| `t` | `(key: string) => string` | identity | Translation function for i18n |
|
|
76
78
|
| `accentColor` | `string` | `'#7b5cff'` | Primary accent color (hex) |
|
|
77
79
|
| `logoIcon` | `React.ReactNode` | default icon | Custom logo/icon for the assistant |
|
|
@@ -86,6 +88,10 @@ import { ChatPanel } from '@filigran/chatbot';
|
|
|
86
88
|
| `contextUsageEnabled` | `boolean` | `true` | Show how full the model's context window is for the current conversation (ring + percentage in the composer toolbar). Data-driven, so it stays absent until the backend reports occupancy — see [Context usage](#context-usage). |
|
|
87
89
|
| `composerToolbar` | `React.ReactNode` | — | Extra controls appended to the composer toolbar. The escape hatch for host-specific affordances (XTM One's session-tool picker) — the package never learns what they are. Pass nothing and the toolbar simply has none. |
|
|
88
90
|
|
|
91
|
+
Plain-data props (`requestHeaders`, `apiEndpoints`, `pageContext`, `promptSuggestions`) are compared by content and callback props are called
|
|
92
|
+
through a stable wrapper, so building them inline is fine. `t` and `logoIcon` are used as given: keep them stable (`useCallback` / `useMemo`),
|
|
93
|
+
or every render of the host re-renders every message in the thread.
|
|
94
|
+
|
|
89
95
|
#### Resizable Sidebar Example
|
|
90
96
|
|
|
91
97
|
```tsx
|
|
@@ -708,19 +714,19 @@ Every key the package can ask for, grouped by where it appears:
|
|
|
708
714
|
- `'the agent'`
|
|
709
715
|
- `'{tool} (+{count} more)…'`
|
|
710
716
|
|
|
711
|
-
**Waiting
|
|
717
|
+
**Waiting panel**
|
|
712
718
|
|
|
713
719
|
- `'Almost there'`
|
|
714
720
|
- `'Analyzing the details'`
|
|
715
721
|
- `'Connecting the dots'`
|
|
716
722
|
- `'Consulting the sources'`
|
|
717
723
|
- `'Crunching the data'`
|
|
724
|
+
- `'Play Space Invaders'`
|
|
725
|
+
- `'Play Space Invaders in XTM One'`
|
|
718
726
|
- `'Polishing the answer'`
|
|
719
727
|
- `'Putting it together'`
|
|
720
728
|
- `'Reticulating splines'`
|
|
721
729
|
- `'Thinking it through'`
|
|
722
|
-
- `'Turn off the waiting mini-game'`
|
|
723
|
-
- `'Turn on the waiting mini-game'`
|
|
724
730
|
- `'Wrapping things up'`
|
|
725
731
|
|
|
726
732
|
**Reasoning details**
|
|
@@ -945,6 +951,11 @@ returned byte-identical.
|
|
|
945
951
|
- `remark-breaks` >= 4
|
|
946
952
|
- `remark-gfm` >= 4
|
|
947
953
|
|
|
954
|
+
## Dependencies
|
|
955
|
+
|
|
956
|
+
- `unified` ^11 and `remark-parse` ^11 — the ranges react-markdown 10 depends on, so a host resolves them to the copies it already has. The panel
|
|
957
|
+
uses them to find the top-level blocks of a streaming answer, and re-renders only the blocks that can still change.
|
|
958
|
+
|
|
948
959
|
---
|
|
949
960
|
|
|
950
961
|
## Development
|
|
@@ -962,6 +973,12 @@ To build:
|
|
|
962
973
|
yarn build
|
|
963
974
|
```
|
|
964
975
|
|
|
976
|
+
To run the unit tests (Node's built-in test runner, which runs TypeScript natively from Node 22.18 / 23.6):
|
|
977
|
+
|
|
978
|
+
```bash
|
|
979
|
+
yarn test
|
|
980
|
+
```
|
|
981
|
+
|
|
965
982
|
To publish:
|
|
966
983
|
|
|
967
984
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -245,6 +245,11 @@ interface ChatPanelProps {
|
|
|
245
245
|
apiBaseUrl: string;
|
|
246
246
|
/** Custom API endpoint configuration. */
|
|
247
247
|
apiEndpoints?: ApiEndpoints;
|
|
248
|
+
/**
|
|
249
|
+
* The XTM One URL: the header's "Browse agents" / "Create agent" links, and
|
|
250
|
+
* the waiting panel's invitation to play the arcade there
|
|
251
|
+
* (`{agentDashboardUrl}/chat?arcade=play`). Only an http(s) URL is linked.
|
|
252
|
+
*/
|
|
248
253
|
agentDashboardUrl?: string;
|
|
249
254
|
user: {
|
|
250
255
|
firstName: string;
|
|
@@ -314,12 +319,17 @@ interface ChatPanelProps {
|
|
|
314
319
|
*/
|
|
315
320
|
backendType?: BackendType;
|
|
316
321
|
/**
|
|
317
|
-
* Show the waiting
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
322
|
+
* Show the waiting panel during longer waits: rotating status messages and
|
|
323
|
+
* an invitation to play XTM One's Space Invaders arcade, in a new tab
|
|
324
|
+
* through `agentDashboardUrl` or in place through `onPlayWaitingGame`. The
|
|
325
|
+
* package ships no game of its own. Host-level master switch. Default: true.
|
|
321
326
|
*/
|
|
322
327
|
miniGameEnabled?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Opens the arcade in place instead of linking to XTM One, for a host that
|
|
330
|
+
* runs it itself (the XTM One floating assistant). Wins over the link.
|
|
331
|
+
*/
|
|
332
|
+
onPlayWaitingGame?: () => void;
|
|
323
333
|
/**
|
|
324
334
|
* Notify the user when a long-running turn finishes while they are not
|
|
325
335
|
* watching the chat — away (tab hidden / another window) via a document-title
|