@aigentyc/chat-sdk 0.1.3 → 0.2.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/AGENTS.md +189 -0
- package/bin/doctor.mjs +255 -0
- package/dist/ai-elements.cjs +119 -162
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.js +5 -60
- package/dist/ai-elements.js.map +1 -1
- package/dist/{chunk-PKGD6CTD.js → chunk-2677FDTG.js} +107 -59
- package/dist/chunk-2677FDTG.js.map +1 -0
- package/dist/{chunk-42ARGQXE.js → chunk-7L4FS6G7.js} +7 -3
- package/dist/chunk-7L4FS6G7.js.map +1 -0
- package/dist/{chunk-VS3NZ7FX.js → chunk-A7PCSWIK.js} +60 -5
- package/dist/chunk-A7PCSWIK.js.map +1 -0
- package/dist/{chunk-WZLWAVSS.cjs → chunk-C24QG43M.cjs} +10 -2
- package/dist/chunk-C24QG43M.cjs.map +1 -0
- package/dist/{chunk-NW2ESHRV.js → chunk-KVEJAPWA.js} +4 -8
- package/dist/chunk-KVEJAPWA.js.map +1 -0
- package/dist/{chunk-X5YEOOPK.cjs → chunk-QDFPJJ5Y.cjs} +5 -13
- package/dist/chunk-QDFPJJ5Y.cjs.map +1 -0
- package/dist/{chunk-FQN6OBGN.cjs → chunk-RTVEBPAJ.cjs} +63 -4
- package/dist/chunk-RTVEBPAJ.cjs.map +1 -0
- package/dist/{chunk-IWIGM3RY.cjs → chunk-WQARQ2FJ.cjs} +109 -61
- package/dist/chunk-WQARQ2FJ.cjs.map +1 -0
- package/dist/components.cjs +14 -14
- package/dist/components.d.cts +5 -0
- package/dist/components.d.ts +5 -0
- package/dist/components.js +4 -4
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +769 -0
- package/dist/ui.cjs +51 -51
- package/dist/ui.js +2 -2
- package/llms.txt +323 -0
- package/package.json +10 -2
- package/dist/chunk-42ARGQXE.js.map +0 -1
- package/dist/chunk-FQN6OBGN.cjs.map +0 -1
- package/dist/chunk-IWIGM3RY.cjs.map +0 -1
- package/dist/chunk-NW2ESHRV.js.map +0 -1
- package/dist/chunk-PKGD6CTD.js.map +0 -1
- package/dist/chunk-VS3NZ7FX.js.map +0 -1
- package/dist/chunk-WZLWAVSS.cjs.map +0 -1
- package/dist/chunk-X5YEOOPK.cjs.map +0 -1
package/dist/ui.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkQDFPJJ5Y_cjs = require('./chunk-QDFPJJ5Y.cjs');
|
|
5
|
+
var chunkC24QG43M_cjs = require('./chunk-C24QG43M.cjs');
|
|
6
6
|
var chunkJI5KCSOI_cjs = require('./chunk-JI5KCSOI.cjs');
|
|
7
7
|
var chunkAWAJOSFP_cjs = require('./chunk-AWAJOSFP.cjs');
|
|
8
8
|
var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
|
|
@@ -442,163 +442,163 @@ TableCaption.displayName = "TableCaption";
|
|
|
442
442
|
|
|
443
443
|
Object.defineProperty(exports, "Alert", {
|
|
444
444
|
enumerable: true,
|
|
445
|
-
get: function () { return
|
|
445
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Alert; }
|
|
446
446
|
});
|
|
447
447
|
Object.defineProperty(exports, "AlertDescription", {
|
|
448
448
|
enumerable: true,
|
|
449
|
-
get: function () { return
|
|
449
|
+
get: function () { return chunkQDFPJJ5Y_cjs.AlertDescription; }
|
|
450
450
|
});
|
|
451
451
|
Object.defineProperty(exports, "AlertTitle", {
|
|
452
452
|
enumerable: true,
|
|
453
|
-
get: function () { return
|
|
453
|
+
get: function () { return chunkQDFPJJ5Y_cjs.AlertTitle; }
|
|
454
454
|
});
|
|
455
455
|
Object.defineProperty(exports, "Badge", {
|
|
456
456
|
enumerable: true,
|
|
457
|
-
get: function () { return
|
|
457
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Badge; }
|
|
458
458
|
});
|
|
459
459
|
Object.defineProperty(exports, "Carousel", {
|
|
460
460
|
enumerable: true,
|
|
461
|
-
get: function () { return
|
|
461
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Carousel; }
|
|
462
462
|
});
|
|
463
463
|
Object.defineProperty(exports, "CarouselContent", {
|
|
464
464
|
enumerable: true,
|
|
465
|
-
get: function () { return
|
|
465
|
+
get: function () { return chunkQDFPJJ5Y_cjs.CarouselContent; }
|
|
466
466
|
});
|
|
467
467
|
Object.defineProperty(exports, "CarouselItem", {
|
|
468
468
|
enumerable: true,
|
|
469
|
-
get: function () { return
|
|
469
|
+
get: function () { return chunkQDFPJJ5Y_cjs.CarouselItem; }
|
|
470
470
|
});
|
|
471
471
|
Object.defineProperty(exports, "CarouselNext", {
|
|
472
472
|
enumerable: true,
|
|
473
|
-
get: function () { return
|
|
473
|
+
get: function () { return chunkQDFPJJ5Y_cjs.CarouselNext; }
|
|
474
474
|
});
|
|
475
475
|
Object.defineProperty(exports, "CarouselPrevious", {
|
|
476
476
|
enumerable: true,
|
|
477
|
-
get: function () { return
|
|
478
|
-
});
|
|
479
|
-
Object.defineProperty(exports, "Collapsible", {
|
|
480
|
-
enumerable: true,
|
|
481
|
-
get: function () { return chunkX5YEOOPK_cjs.Collapsible; }
|
|
482
|
-
});
|
|
483
|
-
Object.defineProperty(exports, "CollapsibleContent", {
|
|
484
|
-
enumerable: true,
|
|
485
|
-
get: function () { return chunkX5YEOOPK_cjs.CollapsibleContent; }
|
|
486
|
-
});
|
|
487
|
-
Object.defineProperty(exports, "CollapsibleTrigger", {
|
|
488
|
-
enumerable: true,
|
|
489
|
-
get: function () { return chunkX5YEOOPK_cjs.CollapsibleTrigger; }
|
|
477
|
+
get: function () { return chunkQDFPJJ5Y_cjs.CarouselPrevious; }
|
|
490
478
|
});
|
|
491
479
|
Object.defineProperty(exports, "Dialog", {
|
|
492
480
|
enumerable: true,
|
|
493
|
-
get: function () { return
|
|
481
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Dialog; }
|
|
494
482
|
});
|
|
495
483
|
Object.defineProperty(exports, "DialogClose", {
|
|
496
484
|
enumerable: true,
|
|
497
|
-
get: function () { return
|
|
485
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogClose; }
|
|
498
486
|
});
|
|
499
487
|
Object.defineProperty(exports, "DialogContent", {
|
|
500
488
|
enumerable: true,
|
|
501
|
-
get: function () { return
|
|
489
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogContent; }
|
|
502
490
|
});
|
|
503
491
|
Object.defineProperty(exports, "DialogDescription", {
|
|
504
492
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
493
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogDescription; }
|
|
506
494
|
});
|
|
507
495
|
Object.defineProperty(exports, "DialogFooter", {
|
|
508
496
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
497
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogFooter; }
|
|
510
498
|
});
|
|
511
499
|
Object.defineProperty(exports, "DialogHeader", {
|
|
512
500
|
enumerable: true,
|
|
513
|
-
get: function () { return
|
|
501
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogHeader; }
|
|
514
502
|
});
|
|
515
503
|
Object.defineProperty(exports, "DialogTitle", {
|
|
516
504
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
505
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogTitle; }
|
|
518
506
|
});
|
|
519
507
|
Object.defineProperty(exports, "DialogTrigger", {
|
|
520
508
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
509
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DialogTrigger; }
|
|
522
510
|
});
|
|
523
511
|
Object.defineProperty(exports, "DropdownMenu", {
|
|
524
512
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
513
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DropdownMenu; }
|
|
526
514
|
});
|
|
527
515
|
Object.defineProperty(exports, "DropdownMenuContent", {
|
|
528
516
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
517
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DropdownMenuContent; }
|
|
530
518
|
});
|
|
531
519
|
Object.defineProperty(exports, "DropdownMenuItem", {
|
|
532
520
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
521
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DropdownMenuItem; }
|
|
534
522
|
});
|
|
535
523
|
Object.defineProperty(exports, "DropdownMenuTrigger", {
|
|
536
524
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
525
|
+
get: function () { return chunkQDFPJJ5Y_cjs.DropdownMenuTrigger; }
|
|
538
526
|
});
|
|
539
527
|
Object.defineProperty(exports, "Input", {
|
|
540
528
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
529
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Input; }
|
|
542
530
|
});
|
|
543
531
|
Object.defineProperty(exports, "Progress", {
|
|
544
532
|
enumerable: true,
|
|
545
|
-
get: function () { return
|
|
533
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Progress; }
|
|
546
534
|
});
|
|
547
535
|
Object.defineProperty(exports, "ScrollArea", {
|
|
548
536
|
enumerable: true,
|
|
549
|
-
get: function () { return
|
|
537
|
+
get: function () { return chunkQDFPJJ5Y_cjs.ScrollArea; }
|
|
550
538
|
});
|
|
551
539
|
Object.defineProperty(exports, "ScrollBar", {
|
|
552
540
|
enumerable: true,
|
|
553
|
-
get: function () { return
|
|
541
|
+
get: function () { return chunkQDFPJJ5Y_cjs.ScrollBar; }
|
|
554
542
|
});
|
|
555
543
|
Object.defineProperty(exports, "Select", {
|
|
556
544
|
enumerable: true,
|
|
557
|
-
get: function () { return
|
|
545
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Select; }
|
|
558
546
|
});
|
|
559
547
|
Object.defineProperty(exports, "SelectContent", {
|
|
560
548
|
enumerable: true,
|
|
561
|
-
get: function () { return
|
|
549
|
+
get: function () { return chunkQDFPJJ5Y_cjs.SelectContent; }
|
|
562
550
|
});
|
|
563
551
|
Object.defineProperty(exports, "SelectItem", {
|
|
564
552
|
enumerable: true,
|
|
565
|
-
get: function () { return
|
|
553
|
+
get: function () { return chunkQDFPJJ5Y_cjs.SelectItem; }
|
|
566
554
|
});
|
|
567
555
|
Object.defineProperty(exports, "SelectTrigger", {
|
|
568
556
|
enumerable: true,
|
|
569
|
-
get: function () { return
|
|
557
|
+
get: function () { return chunkQDFPJJ5Y_cjs.SelectTrigger; }
|
|
570
558
|
});
|
|
571
559
|
Object.defineProperty(exports, "SelectValue", {
|
|
572
560
|
enumerable: true,
|
|
573
|
-
get: function () { return
|
|
561
|
+
get: function () { return chunkQDFPJJ5Y_cjs.SelectValue; }
|
|
574
562
|
});
|
|
575
563
|
Object.defineProperty(exports, "Separator", {
|
|
576
564
|
enumerable: true,
|
|
577
|
-
get: function () { return
|
|
565
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Separator; }
|
|
578
566
|
});
|
|
579
567
|
Object.defineProperty(exports, "Textarea", {
|
|
580
568
|
enumerable: true,
|
|
581
|
-
get: function () { return
|
|
569
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Textarea; }
|
|
582
570
|
});
|
|
583
571
|
Object.defineProperty(exports, "Tooltip", {
|
|
584
572
|
enumerable: true,
|
|
585
|
-
get: function () { return
|
|
573
|
+
get: function () { return chunkQDFPJJ5Y_cjs.Tooltip; }
|
|
586
574
|
});
|
|
587
575
|
Object.defineProperty(exports, "TooltipContent", {
|
|
588
576
|
enumerable: true,
|
|
589
|
-
get: function () { return
|
|
577
|
+
get: function () { return chunkQDFPJJ5Y_cjs.TooltipContent; }
|
|
590
578
|
});
|
|
591
579
|
Object.defineProperty(exports, "TooltipProvider", {
|
|
592
580
|
enumerable: true,
|
|
593
|
-
get: function () { return
|
|
581
|
+
get: function () { return chunkQDFPJJ5Y_cjs.TooltipProvider; }
|
|
594
582
|
});
|
|
595
583
|
Object.defineProperty(exports, "TooltipTrigger", {
|
|
596
584
|
enumerable: true,
|
|
597
|
-
get: function () { return
|
|
585
|
+
get: function () { return chunkQDFPJJ5Y_cjs.TooltipTrigger; }
|
|
598
586
|
});
|
|
599
587
|
Object.defineProperty(exports, "Button", {
|
|
600
588
|
enumerable: true,
|
|
601
|
-
get: function () { return
|
|
589
|
+
get: function () { return chunkC24QG43M_cjs.Button; }
|
|
590
|
+
});
|
|
591
|
+
Object.defineProperty(exports, "Collapsible", {
|
|
592
|
+
enumerable: true,
|
|
593
|
+
get: function () { return chunkC24QG43M_cjs.Collapsible; }
|
|
594
|
+
});
|
|
595
|
+
Object.defineProperty(exports, "CollapsibleContent", {
|
|
596
|
+
enumerable: true,
|
|
597
|
+
get: function () { return chunkC24QG43M_cjs.CollapsibleContent; }
|
|
598
|
+
});
|
|
599
|
+
Object.defineProperty(exports, "CollapsibleTrigger", {
|
|
600
|
+
enumerable: true,
|
|
601
|
+
get: function () { return chunkC24QG43M_cjs.CollapsibleTrigger; }
|
|
602
602
|
});
|
|
603
603
|
Object.defineProperty(exports, "Spinner", {
|
|
604
604
|
enumerable: true,
|
package/dist/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Alert, AlertDescription, AlertTitle, Badge, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious,
|
|
3
|
-
export { Button } from './chunk-
|
|
2
|
+
export { Alert, AlertDescription, AlertTitle, Badge, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Progress, ScrollArea, ScrollBar, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './chunk-KVEJAPWA.js';
|
|
3
|
+
export { Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from './chunk-7L4FS6G7.js';
|
|
4
4
|
export { Spinner } from './chunk-4QT25AXI.js';
|
|
5
5
|
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './chunk-NPJKLYLV.js';
|
|
6
6
|
import { cn } from './chunk-3RW7O444.js';
|
package/llms.txt
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# @aigentyc/chat-sdk
|
|
2
|
+
|
|
3
|
+
> React 19 SDK for embedding AI-powered chat UIs connected to the Aigentyc platform. Ships drop-in components, a composable component layer, and a fully headless hook. SSR-safe (Next.js App Router). White-label, themeable, i18n-ready, with backend-driven tool rendering and optional live-chat handoff.
|
|
4
|
+
|
|
5
|
+
## Fastest path — scaffold a starter
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create aigentyc-chat@latest my-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Prompts for template (`vite-react` or `next`) and `projectId`, then produces a working app. Non-interactive:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm create aigentyc-chat@latest my-app -- --template=next --project-id=YOUR_ID
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Installation (add to existing app)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @aigentyc/chat-sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Only `react>=19` and `react-dom>=19` are required peers. Everything else needed for core chat (streaming, tools, transport) is bundled.
|
|
24
|
+
|
|
25
|
+
Optional peers — install only if you use that feature:
|
|
26
|
+
- `socket.io-client` — live chat handoff
|
|
27
|
+
- `recharts` — visualization tool renderer
|
|
28
|
+
- `@json-render/core @json-render/react @json-render/shadcn zod` — json-render tools
|
|
29
|
+
|
|
30
|
+
## Golden-path quick start
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Chat } from "@aigentyc/chat-sdk"
|
|
34
|
+
import "@aigentyc/chat-sdk/theme/styles.css"
|
|
35
|
+
|
|
36
|
+
export function App() {
|
|
37
|
+
return (
|
|
38
|
+
<Chat
|
|
39
|
+
projectId="your-project-id"
|
|
40
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
41
|
+
apiKey="your-api-key"
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Peer deps required: `react>=19`, `react-dom>=19`. The CSS import is required for theming.
|
|
48
|
+
|
|
49
|
+
## Four levels of control
|
|
50
|
+
|
|
51
|
+
1. **Drop-in** — `<Chat projectId apiEndpoint />`
|
|
52
|
+
2. **Customize** — add `theme`, `slots`, event handlers like `onMessageSent`
|
|
53
|
+
3. **Compose** — `<ChatProvider>` + individual components (`ChatInterface`, `ChatInput`)
|
|
54
|
+
4. **Headless** — `useAigentycChat({ projectId, apiEndpoint })` returns `{ messages, sendMessage, status }`
|
|
55
|
+
|
|
56
|
+
## Package entry points
|
|
57
|
+
|
|
58
|
+
- `@aigentyc/chat-sdk` — `Chat`, `ChatWidget`, `ChatProvider` (main)
|
|
59
|
+
- `@aigentyc/chat-sdk/hooks` — `useAigentycChat` and other hooks
|
|
60
|
+
- `@aigentyc/chat-sdk/components` — granular chat components
|
|
61
|
+
- `@aigentyc/chat-sdk/ai-elements` — `Message`, `Conversation`, primitives
|
|
62
|
+
- `@aigentyc/chat-sdk/tools` — `ToolRenderer`, `VisualizationRenderer`
|
|
63
|
+
- `@aigentyc/chat-sdk/json-render` — json-render integration
|
|
64
|
+
- `@aigentyc/chat-sdk/ui` — shadcn-style UI primitives
|
|
65
|
+
- `@aigentyc/chat-sdk/theme` — `ThemeProvider`; CSS at `@aigentyc/chat-sdk/theme/styles.css`
|
|
66
|
+
- `@aigentyc/chat-sdk/i18n` — `addLanguage`, built-in `en`, `he`
|
|
67
|
+
- `@aigentyc/chat-sdk/core` — types, transport, utils
|
|
68
|
+
|
|
69
|
+
## Slots
|
|
70
|
+
|
|
71
|
+
Replace any UI piece via the `slots` prop:
|
|
72
|
+
|
|
73
|
+
`header`, `welcome`, `message`, `input`, `footer`, `loader`, `suggestions`, `tools` (keyed per tool name).
|
|
74
|
+
|
|
75
|
+
## Tool rendering
|
|
76
|
+
|
|
77
|
+
The Aigentyc backend returns a `uiRenderMode` per tool result. The SDK auto-dispatches:
|
|
78
|
+
- `visualization` → recharts
|
|
79
|
+
- `json_render` → `@json-render/shadcn` component spec
|
|
80
|
+
- `legacy` → custom HTML/CSS template
|
|
81
|
+
- `preset` → built-in renderer
|
|
82
|
+
|
|
83
|
+
Override a specific tool:
|
|
84
|
+
```tsx
|
|
85
|
+
<Chat slots={{ tools: { searchProducts: MyProductGrid } }} />
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Theming
|
|
89
|
+
|
|
90
|
+
All tokens are CSS variables scoped under `[data-aigentyc-chat]`. Override via the `theme` prop or plain CSS. No forced branding.
|
|
91
|
+
|
|
92
|
+
## i18n
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { addLanguage } from "@aigentyc/chat-sdk/i18n"
|
|
96
|
+
addLanguage("fr", { welcomeTitle: "Bienvenue" })
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Live chat
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Chat enableLiveChat chatServiceUrl="wss://..." />
|
|
103
|
+
```
|
|
104
|
+
Requires `socket.io-client`.
|
|
105
|
+
|
|
106
|
+
## Next.js / SSR
|
|
107
|
+
|
|
108
|
+
All client components declare `"use client"`. Works in App Router and Pages Router without extra config.
|
|
109
|
+
|
|
110
|
+
## Recipes (copy-paste patterns)
|
|
111
|
+
|
|
112
|
+
### Recipe: brand colors + custom font
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<Chat
|
|
116
|
+
projectId="..."
|
|
117
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
118
|
+
theme={{
|
|
119
|
+
primaryColor: "#eb1d22",
|
|
120
|
+
fontFamily: "Inter, sans-serif",
|
|
121
|
+
userBubbleColor: "#eb1d22",
|
|
122
|
+
assistantBubbleColor: "#f5f5f5",
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Recipe: change welcome message
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<Chat
|
|
131
|
+
projectId="..."
|
|
132
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
133
|
+
language="en"
|
|
134
|
+
translations={{
|
|
135
|
+
en: { welcomeTitle: "Hi! How can I help?", welcomeSubtitle: "Ask me anything." },
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Recipe: track every user message (analytics)
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<Chat
|
|
144
|
+
projectId="..."
|
|
145
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
146
|
+
onMessageSent={(m) => analytics.track("chat_message_sent", { id: m.id, content: m.content })}
|
|
147
|
+
onMessageReceived={(m) => analytics.track("chat_message_received", { id: m.id })}
|
|
148
|
+
onError={(err) => Sentry.captureException(err)}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Recipe: show citation sources under assistant replies
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
<Chat projectId="..." apiEndpoint="https://app.aigentyc.ai" showSources />
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Recipe: replace the input bar with a custom one
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import { Chat } from "@aigentyc/chat-sdk";
|
|
162
|
+
|
|
163
|
+
function MyInput({ DefaultComponent, props }) {
|
|
164
|
+
// Add a button next to the default input, or replace it entirely.
|
|
165
|
+
return (
|
|
166
|
+
<div className="my-composer">
|
|
167
|
+
<DefaultComponent {...props} />
|
|
168
|
+
<button onClick={() => alert("uploaded")}>📎</button>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
<Chat slots={{ input: MyInput }} projectId="..." apiEndpoint="..." />
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Recipe: per-tool custom rendering (e.g. product cards)
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import type { ToolRendererProps } from "@aigentyc/chat-sdk";
|
|
180
|
+
|
|
181
|
+
function ProductGrid({ result }: ToolRendererProps) {
|
|
182
|
+
const products = (result?.data as { items: any[] })?.items ?? [];
|
|
183
|
+
return (
|
|
184
|
+
<div className="grid grid-cols-2 gap-2">
|
|
185
|
+
{products.map((p) => <div key={p.id}>{p.title} — ${p.price}</div>)}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
<Chat
|
|
191
|
+
projectId="..." apiEndpoint="..."
|
|
192
|
+
slots={{ tools: { searchProducts: ProductGrid } }}
|
|
193
|
+
/>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Recipe: Hebrew / RTL
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
<Chat projectId="..." apiEndpoint="..." language="he" />
|
|
200
|
+
```
|
|
201
|
+
RTL direction is set automatically when `language === "he"`.
|
|
202
|
+
|
|
203
|
+
### Recipe: floating widget on an existing site
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
import { ChatWidget } from "@aigentyc/chat-sdk";
|
|
207
|
+
import "@aigentyc/chat-sdk/theme/styles.css";
|
|
208
|
+
|
|
209
|
+
<ChatWidget
|
|
210
|
+
projectId="..."
|
|
211
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
212
|
+
theme={{ primaryColor: "#eb1d22" }}
|
|
213
|
+
/>
|
|
214
|
+
```
|
|
215
|
+
Drop anywhere in your tree — it portals itself to the bottom-right corner.
|
|
216
|
+
|
|
217
|
+
### Recipe: headless (build your own UI)
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
"use client";
|
|
221
|
+
import { useAigentycChat } from "@aigentyc/chat-sdk/hooks";
|
|
222
|
+
|
|
223
|
+
export default function MyChat() {
|
|
224
|
+
const { messages, status, sendMessage } = useAigentycChat({
|
|
225
|
+
projectId: "...",
|
|
226
|
+
apiEndpoint: "https://app.aigentyc.ai",
|
|
227
|
+
});
|
|
228
|
+
return (
|
|
229
|
+
<>
|
|
230
|
+
{messages.map((m) => <div key={m.id}>{m.role}: {m.content}</div>)}
|
|
231
|
+
<button disabled={status === "streaming"} onClick={() => sendMessage("hello")}>
|
|
232
|
+
Send
|
|
233
|
+
</button>
|
|
234
|
+
</>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Recipe: enable live-chat handoff
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
<Chat
|
|
243
|
+
projectId="..."
|
|
244
|
+
apiEndpoint="https://app.aigentyc.ai"
|
|
245
|
+
apiKey="tyco_pk_..." // required for live chat
|
|
246
|
+
enableLiveChat
|
|
247
|
+
/>
|
|
248
|
+
```
|
|
249
|
+
The AI can hand off to a human operator via the `requestHumanChat` tool. UI surfaces a queue + operator panel automatically.
|
|
250
|
+
|
|
251
|
+
### Recipe: Next.js App Router page
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
// app/chat/page.tsx
|
|
255
|
+
import { Chat } from "@aigentyc/chat-sdk";
|
|
256
|
+
import "@aigentyc/chat-sdk/theme/styles.css"; // import once, in layout.tsx is fine too
|
|
257
|
+
|
|
258
|
+
export default function Page() {
|
|
259
|
+
return (
|
|
260
|
+
<main style={{ height: "100dvh" }}>
|
|
261
|
+
<Chat
|
|
262
|
+
projectId={process.env.NEXT_PUBLIC_AIGENTYC_PROJECT_ID!}
|
|
263
|
+
apiEndpoint={process.env.NEXT_PUBLIC_AIGENTYC_API_ENDPOINT!}
|
|
264
|
+
apiKey={process.env.NEXT_PUBLIC_AIGENTYC_API_KEY}
|
|
265
|
+
/>
|
|
266
|
+
</main>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Recipe: persist conversations (default on)
|
|
272
|
+
|
|
273
|
+
Persistence is on by default. To disable:
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
<Chat projectId="..." apiEndpoint="..." persistMessages={false} />
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Storage key: `aigentyc-messages-<projectId>` in `localStorage`.
|
|
280
|
+
|
|
281
|
+
### Recipe: programmatically reset the conversation
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
import { useAigentycChat } from "@aigentyc/chat-sdk/hooks";
|
|
285
|
+
|
|
286
|
+
const { newConversation, clearMessages } = useAigentycChat({ projectId: "...", apiEndpoint: "..." });
|
|
287
|
+
|
|
288
|
+
<button onClick={newConversation}>New conversation</button> // new sessionId + clears
|
|
289
|
+
<button onClick={clearMessages}>Clear messages</button> // clears, keeps session
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Troubleshooting
|
|
293
|
+
|
|
294
|
+
| Symptom | Likely cause | Fix |
|
|
295
|
+
| --- | --- | --- |
|
|
296
|
+
| Unstyled / broken layout | Missing CSS import | `import "@aigentyc/chat-sdk/theme/styles.css"` |
|
|
297
|
+
| 401 / 403 from API | `apiKey` missing or wrong scope | Create key with `Chat: Full` permission |
|
|
298
|
+
| CORS error in browser | Allowed Origins on API key doesn't include current URL | Add `http://localhost:5173` (Vite) or `http://localhost:3000` (Next) to the key's Allowed Origins |
|
|
299
|
+
| `Cannot find module @ai-sdk/react` | Stale install from old SDK version | `rm -rf node_modules package-lock.json && npm install` (peers are bundled now) |
|
|
300
|
+
| Hebrew text shows LTR | Forgot `language="he"` | Pass `language="he"` to `<Chat>` |
|
|
301
|
+
| Tool result shows raw JSON | Custom tool with no renderer | Add `slots.tools[toolName]` or set `uiRenderMode: "hidden"` server-side |
|
|
302
|
+
| Chat doesn't render in Next.js | RSC issue | The SDK sets `"use client"`; if your wrapper is a Server Component, that's fine — don't add `"use client"` yourself |
|
|
303
|
+
| `searchKnowledgeBase` JSON appears | (it shouldn't — hidden by default since 0.1.3) | Upgrade `@aigentyc/chat-sdk` |
|
|
304
|
+
|
|
305
|
+
## Common pitfalls (do not)
|
|
306
|
+
|
|
307
|
+
- Don't forget the CSS import — unstyled UI is almost always a missing `@aigentyc/chat-sdk/theme/styles.css`.
|
|
308
|
+
- Don't import from `dist/` or deep subpaths — use the public entry points above.
|
|
309
|
+
- Don't wrap in `<Chat>` twice; use `<ChatProvider>` + sub-components for layouts, not nested `<Chat>`.
|
|
310
|
+
- React 18 is not supported — peer is `>=19`.
|
|
311
|
+
- `apiKey` is optional for public/anon projects; required for authenticated ones.
|
|
312
|
+
|
|
313
|
+
## Links
|
|
314
|
+
|
|
315
|
+
- Package: https://www.npmjs.com/package/@aigentyc/chat-sdk
|
|
316
|
+
- Scaffolder: `npm create aigentyc-chat@latest my-app`
|
|
317
|
+
- Dashboard: https://app.aigentyc.ai
|
|
318
|
+
|
|
319
|
+
## Files included in this package
|
|
320
|
+
|
|
321
|
+
- `README.md` — install + quickstart
|
|
322
|
+
- `AGENTS.md` — agent-oriented guide (rules, decision tree, troubleshooting)
|
|
323
|
+
- `llms.txt` — this file (LLM-friendly summary)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigentyc/chat-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React SDK for building AI-powered chat interfaces connected to the Aigentyc platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -114,11 +114,19 @@
|
|
|
114
114
|
},
|
|
115
115
|
"files": [
|
|
116
116
|
"dist",
|
|
117
|
+
"bin",
|
|
117
118
|
"README.md",
|
|
119
|
+
"AGENTS.md",
|
|
120
|
+
"llms.txt",
|
|
118
121
|
"LICENSE"
|
|
119
122
|
],
|
|
123
|
+
"bin": {
|
|
124
|
+
"aigentyc": "./bin/doctor.mjs"
|
|
125
|
+
},
|
|
126
|
+
"homepage": "https://www.npmjs.com/package/@aigentyc/chat-sdk",
|
|
120
127
|
"scripts": {
|
|
121
|
-
"build": "tsup && pnpm build:css",
|
|
128
|
+
"build": "tsup && pnpm build:css && pnpm build:llms-full",
|
|
129
|
+
"build:llms-full": "node scripts/build-llms-full.mjs",
|
|
122
130
|
"build:js": "tsup",
|
|
123
131
|
"build:css": "tailwindcss -i ./src/styles/index.css -o ./dist/styles.css --minify || @tailwindcss/cli -i ./src/styles/index.css -o ./dist/styles.css --minify",
|
|
124
132
|
"dev": "tsup --watch",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/button.tsx"],"names":[],"mappings":";;;;;;AAOA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACtB,uSAAA;AAAA,EACA;AAAA,IACC,QAAA,EAAU;AAAA,MACT,OAAA,EAAS;AAAA,QACR,OAAA,EACC,+DAAA;AAAA,QACD,WAAA,EACC,8EAAA;AAAA,QACD,OAAA,EACC,0FAAA;AAAA,QACD,SAAA,EACC,wEAAA;AAAA,QACD,KAAA,EAAO,8CAAA;AAAA,QACP,IAAA,EAAM;AAAA,OACP;AAAA,MACA,IAAA,EAAM;AAAA,QACL,OAAA,EAAS,eAAA;AAAA,QACT,EAAA,EAAI,6BAAA;AAAA,QACJ,EAAA,EAAI,sBAAA;AAAA,QACJ,IAAA,EAAM,SAAA;AAAA,QACN,SAAA,EAAW;AAAA;AACZ,KACD;AAAA,IACA,eAAA,EAAiB;AAAA,MAChB,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACP;AAEF,CAAA;AAQA,IAAM,MAAA,GAAe,KAAA,CAAA,UAAA;AAAA,EACpB,CAAC,EAAE,SAAA,EAAW,OAAA,EAAS,IAAA,EAAM,UAAU,KAAA,EAAO,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACjE,IAAA,MAAM,IAAA,GAAO,UAAU,IAAA,GAAO,QAAA;AAC9B,IAAA,uBACC,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACA,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,QAC1D,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACL;AAAA,EAEF;AACD;AACA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"chunk-42ARGQXE.js","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../core/utils\";\n\nconst buttonVariants = cva(\n\t\"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t\"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n\t\t\t\tdestructive:\n\t\t\t\t\t\"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n\t\t\t\toutline:\n\t\t\t\t\t\"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\tsecondary:\n\t\t\t\t\t\"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n\t\t\t\tghost: \"hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\tlink: \"text-primary underline-offset-4 hover:underline\",\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: \"h-9 px-4 py-2\",\n\t\t\t\tsm: \"h-8 rounded-md px-3 text-xs\",\n\t\t\t\tlg: \"h-10 rounded-md px-8\",\n\t\t\t\ticon: \"h-9 w-9\",\n\t\t\t\t\"icon-sm\": \"h-7 w-7\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: \"default\",\n\t\t\tsize: \"default\",\n\t\t},\n\t},\n);\n\nexport interface ButtonProps\n\textends React.ButtonHTMLAttributes<HTMLButtonElement>,\n\tVariantProps<typeof buttonVariants> {\n\tasChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n\t({ className, variant, size, asChild = false, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"button\";\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ai-elements/conversation.tsx","../src/ai-elements/loader.tsx"],"names":["jsx","StickToBottom","cn","jsxs","Fragment","useStickToBottomContext","useCallback","Button","ArrowDownIcon"],"mappings":";;;;;;;;;AAWO,IAAM,eAAe,CAAC,EAAE,SAAA,EAAW,GAAG,OAAM,qBACjDA,cAAA;AAAA,EAACC,8BAAA;AAAA,EAAA;AAAA,IACC,SAAA,EAAWC,oBAAA,CAAG,mCAAA,EAAqC,SAAS,CAAA;AAAA,IAC5D,OAAA,EAAQ,QAAA;AAAA,IACR,MAAA,EAAO,QAAA;AAAA,IACP,IAAA,EAAK,KAAA;AAAA,IACJ,GAAG;AAAA;AACN;AAOK,IAAM,sBAAsB,CAAC;AAAA,EAClC,SAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACEF,cAAA;AAAA,EAACC,8BAAA,CAAc,OAAA;AAAA,EAAd;AAAA,IACC,SAAA,EAAWC,oBAAA,CA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AAA,EAAM,IAAA,EAAK,GAC5C,CAAA,EACF;AAAA;AAAA;AAAA;AACF;AACF","file":"chunk-FQN6OBGN.cjs","sourcesContent":["\"use client\";\n\nimport { Button } from \"../ui/button\";\nimport { cn } from \"../core/utils\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { useCallback } from \"react\";\nimport { StickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport type ConversationProps = ComponentProps<typeof StickToBottom>;\n\nexport const Conversation = ({ className, ...props }: ConversationProps) => (\n <StickToBottom\n className={cn(\"relative flex-1 overflow-y-hidden\", className)}\n initial=\"smooth\"\n resize=\"smooth\"\n role=\"log\"\n {...props}\n />\n);\n\nexport type ConversationContentProps = ComponentProps<\n typeof StickToBottom.Content\n>;\n\nexport const ConversationContent = ({\n className,\n ...props\n}: ConversationContentProps) => (\n <StickToBottom.Content\n className={cn(\"flex flex-col gap-8\", className)}\n {...props}\n />\n);\n\nexport type ConversationEmptyStateProps = ComponentProps<\"div\"> & {\n title?: string;\n description?: string;\n icon?: React.ReactNode;\n};\n\nexport const ConversationEmptyState = ({\n className,\n title = \"No messages yet\",\n description = \"Start a conversation to see messages here\",\n icon,\n children,\n ...props\n}: ConversationEmptyStateProps) => (\n <div\n className={cn(\n \"flex size-full flex-col items-center justify-center gap-3 p-8 text-center\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon && <div className=\"text-muted-foreground\">{icon}</div>}\n <div className=\"space-y-1\">\n <h3 className=\"font-medium text-sm\">{title}</h3>\n {description && (\n <p className=\"text-muted-foreground text-sm\">{description}</p>\n )}\n </div>\n </>\n )}\n </div>\n);\n\nexport type ConversationScrollButtonProps = ComponentProps<typeof Button>;\n\nexport const ConversationScrollButton = ({\n className,\n ...props\n}: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n const handleScrollToBottom = useCallback(() => {\n scrollToBottom();\n }, [scrollToBottom]);\n\n return (\n !isAtBottom && (\n <Button\n className={cn(\n \"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full\",\n className\n )}\n onClick={handleScrollToBottom}\n size=\"icon\"\n type=\"button\"\n variant=\"outline\"\n {...props}\n >\n <ArrowDownIcon className=\"size-4\" />\n </Button>\n )\n );\n};\n","\"use client\";\n\nimport { cn } from \"../core/utils\";\nimport type { HTMLAttributes } from \"react\";\n\nexport type LoaderProps = HTMLAttributes<HTMLDivElement> & {\n text?: string;\n};\n\nexport const Loader = ({ className, text = \"Thinking...\", ...props }: LoaderProps) => (\n <div\n className={cn(\n \"flex items-center gap-2 w-full py-3\",\n className\n )}\n style={{ color: \"var(--ac-loader-color, var(--ac-primary, #2f80ed))\" }}\n {...props}\n >\n {/* Circular spinner */}\n <svg\n className=\"animate-spin\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n cx=\"10\"\n cy=\"10\"\n r=\"8\"\n stroke=\"#E5E5E5\"\n strokeWidth=\"2\"\n fill=\"none\"\n />\n <path\n d=\"M10 2C14.4183 2 18 5.58172 18 10\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n <span className=\"text-sm text-foreground\">{text}</span>\n </div>\n);\n\n// Spinner loader for other use cases\nexport type SpinnerLoaderProps = HTMLAttributes<HTMLDivElement> & {\n size?: number;\n};\n\nexport const SpinnerLoader = ({ className, size = 16, ...props }: SpinnerLoaderProps) => (\n <div\n className={cn(\n \"inline-flex animate-spin items-center justify-center\",\n className\n )}\n {...props}\n >\n <svg\n height={size}\n strokeLinejoin=\"round\"\n style={{ color: \"currentcolor\" }}\n viewBox=\"0 0 16 16\"\n width={size}\n >\n <title>Loader</title>\n <g clipPath=\"url(#clip0_2393_1490)\">\n <path d=\"M8 0V4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M8 16V12\" opacity=\"0.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M3.29773 1.52783L5.64887 4.7639\" opacity=\"0.9\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M12.7023 1.52783L10.3511 4.7639\" opacity=\"0.1\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M12.7023 14.472L10.3511 11.236\" opacity=\"0.4\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M3.29773 14.472L5.64887 11.236\" opacity=\"0.6\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M15.6085 5.52783L11.8043 6.7639\" opacity=\"0.2\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M0.391602 10.472L4.19583 9.23598\" opacity=\"0.7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M15.6085 10.4722L11.8043 9.2361\" opacity=\"0.3\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M0.391602 5.52783L4.19583 6.7639\" opacity=\"0.8\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n </g>\n <defs>\n <clipPath id=\"clip0_2393_1490\">\n <rect fill=\"white\" height=\"16\" width=\"16\" />\n </clipPath>\n </defs>\n </svg>\n </div>\n);\n"]}
|