@kite-copilot/chat-panel 0.2.2 → 0.2.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 +103 -32
- package/dist/auto.cjs +3 -18
- package/dist/auto.js +1 -1
- package/dist/{chunk-R73Y24JS.js → chunk-6BQ6C2XU.js} +4 -19
- package/dist/embed.global.js +12 -13
- package/dist/index.cjs +3 -18
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,24 +74,115 @@ chat.setCurrentPage('settings');
|
|
|
74
74
|
chat.unmount();
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
###
|
|
77
|
+
### Vue.js
|
|
78
|
+
|
|
79
|
+
Create a composable for reusable chat functionality:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// composables/useKiteChat.ts
|
|
83
|
+
import { ref, onMounted, onUnmounted } from 'vue';
|
|
84
|
+
import { createKiteChat, type KiteChatInstance, type KiteChatConfig } from '@kite-copilot/chat-panel';
|
|
85
|
+
import '@kite-copilot/chat-panel/style.css';
|
|
86
|
+
|
|
87
|
+
export function useKiteChat(config: KiteChatConfig) {
|
|
88
|
+
const chat = ref<KiteChatInstance | null>(null);
|
|
89
|
+
const isOpen = ref(false);
|
|
90
|
+
|
|
91
|
+
onMounted(() => {
|
|
92
|
+
chat.value = createKiteChat({
|
|
93
|
+
...config,
|
|
94
|
+
onNavigate: config.onNavigate,
|
|
95
|
+
});
|
|
96
|
+
chat.value.mount(document.body);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
onUnmounted(() => {
|
|
100
|
+
chat.value?.unmount();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const open = () => {
|
|
104
|
+
chat.value?.open();
|
|
105
|
+
isOpen.value = true;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const close = () => {
|
|
109
|
+
chat.value?.close();
|
|
110
|
+
isOpen.value = false;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const toggle = () => {
|
|
114
|
+
chat.value?.toggle();
|
|
115
|
+
isOpen.value = !isOpen.value;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const setCurrentPage = (page: string) => {
|
|
119
|
+
chat.value?.setCurrentPage(page);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return { isOpen, open, close, toggle, setCurrentPage };
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Use in your App.vue or any component:
|
|
127
|
+
|
|
128
|
+
```vue
|
|
129
|
+
<!-- App.vue -->
|
|
130
|
+
<script setup lang="ts">
|
|
131
|
+
import { useKiteChat } from './composables/useKiteChat';
|
|
132
|
+
import { useRouter } from 'vue-router';
|
|
133
|
+
|
|
134
|
+
const router = useRouter();
|
|
78
135
|
|
|
79
|
-
|
|
80
|
-
<!-- No special container or layout needed! -->
|
|
81
|
-
<script>
|
|
82
|
-
window.KiteChatConfig = {
|
|
136
|
+
const { open, close, toggle, setCurrentPage } = useKiteChat({
|
|
83
137
|
userId: 'user-123',
|
|
84
138
|
orgId: 'org-456',
|
|
85
|
-
agentUrl: 'https://your-api.example.com'
|
|
86
|
-
|
|
139
|
+
agentUrl: 'https://your-api.example.com',
|
|
140
|
+
onNavigate: (page, subtab) => {
|
|
141
|
+
router.push(`/${page}${subtab ? `?tab=${subtab}` : ''}`);
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Update context when route changes
|
|
146
|
+
router.afterEach((to) => {
|
|
147
|
+
setCurrentPage(to.name as string);
|
|
148
|
+
});
|
|
87
149
|
</script>
|
|
88
|
-
|
|
150
|
+
|
|
151
|
+
<template>
|
|
152
|
+
<div>
|
|
153
|
+
<button @click="toggle">Toggle Help Panel</button>
|
|
154
|
+
<!-- Your app content -->
|
|
155
|
+
<router-view />
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
89
158
|
```
|
|
90
159
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
160
|
+
Or initialize directly in main.ts for app-wide availability:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
// main.ts
|
|
164
|
+
import { createApp } from 'vue';
|
|
165
|
+
import { createKiteChat } from '@kite-copilot/chat-panel';
|
|
166
|
+
import '@kite-copilot/chat-panel/style.css';
|
|
167
|
+
import App from './App.vue';
|
|
168
|
+
import router from './router';
|
|
169
|
+
|
|
170
|
+
const app = createApp(App);
|
|
171
|
+
app.use(router);
|
|
172
|
+
app.mount('#app');
|
|
173
|
+
|
|
174
|
+
// Initialize chat after Vue app is mounted
|
|
175
|
+
const chat = createKiteChat({
|
|
176
|
+
userId: 'user-123',
|
|
177
|
+
orgId: 'org-456',
|
|
178
|
+
agentUrl: 'https://your-api.example.com',
|
|
179
|
+
onNavigate: (page) => router.push(`/${page}`),
|
|
180
|
+
});
|
|
181
|
+
chat.mount(document.body);
|
|
182
|
+
|
|
183
|
+
// Expose globally if needed
|
|
184
|
+
window.kiteChat = chat;
|
|
185
|
+
```
|
|
95
186
|
|
|
96
187
|
### React Component
|
|
97
188
|
|
|
@@ -265,26 +356,6 @@ function CustomPanel() {
|
|
|
265
356
|
|
|
266
357
|
## Framework Examples
|
|
267
358
|
|
|
268
|
-
### Vue.js
|
|
269
|
-
|
|
270
|
-
```ts
|
|
271
|
-
import { createKiteChat } from '@kite-copilot/chat-panel';
|
|
272
|
-
import '@kite-copilot/chat-panel/style.css';
|
|
273
|
-
|
|
274
|
-
const chat = createKiteChat({
|
|
275
|
-
userId: 'user-123',
|
|
276
|
-
orgId: 'org-456',
|
|
277
|
-
onNavigate: (page) => router.push(`/${page}`),
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// Mount after Vue app is ready
|
|
281
|
-
app.mount('#app');
|
|
282
|
-
chat.mount(document.body);
|
|
283
|
-
|
|
284
|
-
// Open programmatically
|
|
285
|
-
chat.open();
|
|
286
|
-
```
|
|
287
|
-
|
|
288
359
|
### Angular
|
|
289
360
|
|
|
290
361
|
```ts
|
package/dist/auto.cjs
CHANGED
|
@@ -1020,19 +1020,19 @@ var defaultStartingQuestions = [
|
|
|
1020
1020
|
{
|
|
1021
1021
|
id: "changing-layouts",
|
|
1022
1022
|
label: "Changing layouts",
|
|
1023
|
-
prompt: "How
|
|
1023
|
+
prompt: "How do I change the layout of my profiles or folders?",
|
|
1024
1024
|
icon: "layout"
|
|
1025
1025
|
},
|
|
1026
1026
|
{
|
|
1027
1027
|
id: "bulk-uploads",
|
|
1028
1028
|
label: "Bulk uploads",
|
|
1029
|
-
prompt: "How do I
|
|
1029
|
+
prompt: "How do I bulk upload profiles using a CSV file?",
|
|
1030
1030
|
icon: "upload"
|
|
1031
1031
|
},
|
|
1032
1032
|
{
|
|
1033
1033
|
id: "example-setups",
|
|
1034
1034
|
label: "Example setups",
|
|
1035
|
-
prompt: "Can you show me some example
|
|
1035
|
+
prompt: "Can you show me some example folder setups?",
|
|
1036
1036
|
icon: "setup"
|
|
1037
1037
|
}
|
|
1038
1038
|
];
|
|
@@ -2376,21 +2376,6 @@ ${userText}`
|
|
|
2376
2376
|
] }),
|
|
2377
2377
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4", children: [
|
|
2378
2378
|
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2379
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Quick Start" }),
|
|
2380
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2381
|
-
Button,
|
|
2382
|
-
{
|
|
2383
|
-
type: "button",
|
|
2384
|
-
size: "sm",
|
|
2385
|
-
variant: "secondary",
|
|
2386
|
-
className: "w-full justify-start rounded-xl border border-primary/20 bg-primary/5 px-3 py-2.5 text-xs font-medium text-primary shadow-none transition-all hover:bg-primary/10 hover:border-primary/30 h-auto mb-4",
|
|
2387
|
-
onClick: () => startGuide("getting-started"),
|
|
2388
|
-
children: [
|
|
2389
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Play, { className: "mr-2 h-3.5 w-3.5" }),
|
|
2390
|
-
"Getting started"
|
|
2391
|
-
]
|
|
2392
|
-
}
|
|
2393
|
-
),
|
|
2394
2379
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Suggested Questions" }),
|
|
2395
2380
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2396
2381
|
const iconColors = ["bg-blue-400", "bg-green-400", "bg-purple-400", "bg-orange-400", "bg-pink-400"];
|
package/dist/auto.js
CHANGED
|
@@ -883,7 +883,7 @@ function DataRenderer({ type, data }) {
|
|
|
883
883
|
|
|
884
884
|
// src/ChatPanel.tsx
|
|
885
885
|
import * as React4 from "react";
|
|
886
|
-
import { ArrowLeft, ArrowUp,
|
|
886
|
+
import { ArrowLeft, ArrowUp, Command, CornerDownLeft, CheckCircle2 as CheckCircle23, SquarePen, Paperclip, X, FileSpreadsheet, Loader2 as Loader22, ChevronLeft, ChevronRight } from "lucide-react";
|
|
887
887
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
888
888
|
var DEFAULT_AGENT_URL = "http://localhost:5002";
|
|
889
889
|
var PANEL_WIDTH = 400;
|
|
@@ -1019,19 +1019,19 @@ var defaultStartingQuestions = [
|
|
|
1019
1019
|
{
|
|
1020
1020
|
id: "changing-layouts",
|
|
1021
1021
|
label: "Changing layouts",
|
|
1022
|
-
prompt: "How
|
|
1022
|
+
prompt: "How do I change the layout of my profiles or folders?",
|
|
1023
1023
|
icon: "layout"
|
|
1024
1024
|
},
|
|
1025
1025
|
{
|
|
1026
1026
|
id: "bulk-uploads",
|
|
1027
1027
|
label: "Bulk uploads",
|
|
1028
|
-
prompt: "How do I
|
|
1028
|
+
prompt: "How do I bulk upload profiles using a CSV file?",
|
|
1029
1029
|
icon: "upload"
|
|
1030
1030
|
},
|
|
1031
1031
|
{
|
|
1032
1032
|
id: "example-setups",
|
|
1033
1033
|
label: "Example setups",
|
|
1034
|
-
prompt: "Can you show me some example
|
|
1034
|
+
prompt: "Can you show me some example folder setups?",
|
|
1035
1035
|
icon: "setup"
|
|
1036
1036
|
}
|
|
1037
1037
|
];
|
|
@@ -2375,21 +2375,6 @@ ${userText}`
|
|
|
2375
2375
|
] }),
|
|
2376
2376
|
/* @__PURE__ */ jsxs5("div", { className: "pb-4", children: [
|
|
2377
2377
|
panelView === "landing" && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2378
|
-
/* @__PURE__ */ jsx9("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Quick Start" }),
|
|
2379
|
-
/* @__PURE__ */ jsxs5(
|
|
2380
|
-
Button,
|
|
2381
|
-
{
|
|
2382
|
-
type: "button",
|
|
2383
|
-
size: "sm",
|
|
2384
|
-
variant: "secondary",
|
|
2385
|
-
className: "w-full justify-start rounded-xl border border-primary/20 bg-primary/5 px-3 py-2.5 text-xs font-medium text-primary shadow-none transition-all hover:bg-primary/10 hover:border-primary/30 h-auto mb-4",
|
|
2386
|
-
onClick: () => startGuide("getting-started"),
|
|
2387
|
-
children: [
|
|
2388
|
-
/* @__PURE__ */ jsx9(Play, { className: "mr-2 h-3.5 w-3.5" }),
|
|
2389
|
-
"Getting started"
|
|
2390
|
-
]
|
|
2391
|
-
}
|
|
2392
|
-
),
|
|
2393
2378
|
/* @__PURE__ */ jsx9("div", { className: "mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400", children: "Suggested Questions" }),
|
|
2394
2379
|
/* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx9(Loader22, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2395
2380
|
const iconColors = ["bg-blue-400", "bg-green-400", "bg-purple-400", "bg-orange-400", "bg-pink-400"];
|