kyt-chat 1.0.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 ADDED
@@ -0,0 +1,122 @@
1
+ # kyt-chat
2
+
3
+ Embeddable KYT (Know Your Topic) chat widget. Works in React apps and plain HTML pages.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install kyt-chat
9
+ ```
10
+
11
+ ---
12
+
13
+ ## React usage
14
+
15
+ ### Floating bubble
16
+
17
+ Renders a fixed-position button in the bottom-right corner. Click to open a compact chat window.
18
+
19
+ ```tsx
20
+ import { KytChatBubble } from 'kyt-chat'
21
+
22
+ export default function App() {
23
+ return (
24
+ <>
25
+ {/* your existing app */}
26
+ <KytChatBubble
27
+ config={{
28
+ queryUrl: 'https://your-proxy.example.com/query',
29
+ title: 'Ask anything',
30
+ primaryColor: '#1565c0',
31
+ faqs: ['What is this about?', 'How does it work?'],
32
+ }}
33
+ />
34
+ </>
35
+ )
36
+ }
37
+ ```
38
+
39
+ ### Full-page chat
40
+
41
+ ```tsx
42
+ import { KytChat } from 'kyt-chat'
43
+
44
+ export default function ChatPage() {
45
+ return (
46
+ <KytChat
47
+ config={{
48
+ queryUrl: 'https://your-proxy.example.com/query',
49
+ title: 'Ask anything',
50
+ primaryColor: '#1565c0',
51
+ theme: 'dark',
52
+ avatarLabel: 'AI',
53
+ hint: 'Powered by KYT',
54
+ }}
55
+ style={{ height: '100vh' }}
56
+ />
57
+ )
58
+ }
59
+ ```
60
+
61
+ ### Headless hook (bring your own UI)
62
+
63
+ ```tsx
64
+ import { useKytChat } from 'kyt-chat'
65
+
66
+ function MyChat() {
67
+ const { messages, loading, sendMessage } = useKytChat({
68
+ queryUrl: 'https://your-proxy.example.com/query',
69
+ })
70
+
71
+ return (
72
+ <div>
73
+ {messages.map(m => (
74
+ <div key={m.id}><strong>{m.role}</strong>: {m.text}</div>
75
+ ))}
76
+ <button onClick={() => sendMessage('Hello')} disabled={loading}>Send</button>
77
+ </div>
78
+ )
79
+ }
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Plain HTML / CDN usage
85
+
86
+ No React, no npm, no bundler needed.
87
+
88
+ ```html
89
+ <div id="chat"></div>
90
+
91
+ <script src="https://cdn.jsdelivr.net/npm/kyt-chat/dist/kyt-chat.iife.js"></script>
92
+ <script>
93
+ KytUI.mountBubble({
94
+ queryUrl: 'https://your-proxy.example.com/query',
95
+ title: 'Ask anything',
96
+ primaryColor: '#1565c0',
97
+ }, '#chat')
98
+
99
+ // OR full-page:
100
+ // KytUI.mountChat({ queryUrl: '...' }, '#chat')
101
+ </script>
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Config reference
107
+
108
+ ```ts
109
+ interface KytConfig {
110
+ queryUrl: string // required — your proxy server URL
111
+ title?: string // chat window title
112
+ welcomeMessage?: string // subtitle shown before first message
113
+ placeholder?: string // input placeholder text
114
+ faqs?: string[] // suggested questions
115
+ primaryColor?: string // accent color (any CSS hex, e.g. '#1565c0')
116
+ theme?: 'dark' | 'light' | 'auto'
117
+ avatarLabel?: string // letter shown on AI avatar (default: 'AI')
118
+ hint?: string // small text below input bar
119
+ }
120
+ ```
121
+
122
+ `queryUrl` is the only required field. Point it at your proxy server — never directly at the KYT edge function.