goji-search 1.1.4 → 2.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.
Files changed (26) hide show
  1. package/dist/goji-search/assets/avatar1.jpeg +0 -0
  2. package/dist/goji-search/assets/avatar2.jpeg +0 -0
  3. package/dist/goji-search/assets/avatar3.jpeg +0 -0
  4. package/dist/goji-search/assets/chat-logo.png +0 -0
  5. package/dist/goji-search/components/elements/closing-card.d.ts +20 -0
  6. package/dist/goji-search/components/elements/inspiration-menu.d.ts +3 -1
  7. package/dist/goji-search/components/elements/language-selector.d.ts +10 -0
  8. package/dist/goji-search/components/elements/message-list.d.ts +3 -1
  9. package/dist/goji-search/components/elements/search-input.d.ts +3 -1
  10. package/dist/goji-search/components/goji-search-component.d.ts +21 -2
  11. package/dist/goji-search/hooks/useCompanyTheme.d.ts +21 -0
  12. package/dist/goji-search/lib/goji-client.d.ts +24 -4
  13. package/dist/index.js +11767 -4
  14. package/package.json +20 -17
  15. package/dist/goji-search/components/elements/action-buttons.js +0 -164
  16. package/dist/goji-search/components/elements/auto-expanding-textarea.js +0 -46
  17. package/dist/goji-search/components/elements/calendar-integration.js +0 -49
  18. package/dist/goji-search/components/elements/inspiration-menu.js +0 -87
  19. package/dist/goji-search/components/elements/message-list.js +0 -301
  20. package/dist/goji-search/components/elements/search-input.js +0 -136
  21. package/dist/goji-search/components/elements/suggested-questions.js +0 -57
  22. package/dist/goji-search/components/goji-search-component.js +0 -679
  23. package/dist/goji-search/components/goji-search.css +0 -1
  24. package/dist/goji-search/config/company.js +0 -100
  25. package/dist/goji-search/lib/calendar-config.js +0 -10
  26. package/dist/goji-search/lib/goji-client.js +0 -229
@@ -1 +0,0 @@
1
- @property --a{syntax: "<angle>"; inherits: true; initial-value: 0deg;}@property --l{syntax: "<number>"; inherits: true; initial-value: 0;}@property --x{syntax: "<length>"; inherits: false; initial-value: 0;}@property --y{syntax: "<length>"; inherits: false; initial-value: 0;}@property --o{syntax: "<number>"; inherits: false; initial-value: 0;}@property --value{syntax: "<angle>"; inherits: true; initial-value: 0deg;}@property --width-ratio{syntax: "<number>"; inherits: true; initial-value: 0;}@property --scale{syntax: "<number>"; inherits: true; initial-value: 0;}:root{--count: 4;--radius: .75rem;--width: .125rem;--duration: 8s}.ai{--s: 3.3rem;--p: calc(var(--s) / 4);width:var(--s);aspect-ratio:1;--bg-color: color-mix(in srgb, #4654F7, transparent 90%);background:radial-gradient(60% 75% at center,var(--bg-color) 50%,transparent 50%),radial-gradient(75% 60% at center,var(--bg-color) 50%,transparent 50%);padding:var(--p);display:grid;place-items:center;position:relative;border-radius:50%}@keyframes ai{0%{--a: 360deg;--l: .35;--o: 1}30%{--l: 1.5}70%{--o: .4;--l: .05}98%{--o: .7}to{--a: 0deg;--l: .35;--o: 1}}.c{opacity:.9;position:absolute;width:1.25rem;aspect-ratio:1;border-radius:50%;--offset-per-item: calc(360deg / var(--count));--current-angle-offset: calc(var(--offset-per-item) * var(--i) + var(--a));translate:calc(cos(var(--current-angle-offset)) * var(--radius) + var(--x, 0)) calc(sin(var(--current-angle-offset)) * var(--radius) * -1);scale:calc(.6 + var(--l));animation:ai 5.5s cubic-bezier(.45,-.35,.68,.24) infinite;transition:opacity .3s linear;opacity:var(--o, 1)}.c:nth-child(1){--i: 0}.c:nth-child(2){--i: 1}.c:nth-child(3){--i: 2}.c:nth-child(4){--i: 3}.c1{background:radial-gradient(50% 50% at center,#6d8cfb,#5bb2e0);--x: .125rem;width:2rem;animation-timing-function:cubic-bezier(.12,.32,.68,.24)}.c2{background:radial-gradient(50% 50% at center,#6ea2f8,#e7eaff);width:1.875rem}.c3{background:radial-gradient(50% 50% at center,#688ef7,transparent);width:.625rem;opacity:.6;--x: -.125rem}.c4{background:#3c48d1;animation-timing-function:cubic-bezier(.39,-.03,.75,.47)}.container-ai{overflow:hidden;background:#3c48d1;width:100%;border-radius:50%;aspect-ratio:1;position:relative;display:grid;place-items:center}.glass-ai{overflow:hidden;position:absolute;--w: .0625rem;inset:calc(var(--p) - var(--w));border-radius:50%;-webkit-backdrop-filter:blur(.1625rem);backdrop-filter:blur(.1625rem);box-shadow:0 0 1rem color-mix(in srgb,black,transparent 70%);background:radial-gradient(1.25rem at 70% 30%,rgba(255,255,255,.7),transparent)}.glass-ai:after{content:"";position:absolute;inset:0;--c: rgba(255, 255, 255, .03);--w: .0625rem;--g: .1875rem;background:repeating-linear-gradient(var(--c),var(--c),var(--w),transparent var(--w),transparent calc(var(--w) + var(--g)));border-radius:inherit;border:.125rem rgba(255,255,255,.1) solid}.rings-ai{aspect-ratio:1;border-radius:50%;position:absolute;inset:0;perspective:11rem;opacity:.9}.rings-ai:before,.rings-ai:after{content:"";position:absolute;inset:0;background:red;border-radius:50%;--width-ratio: 1;border:calc(var(--width) * var(--width-ratio)) solid transparent;mask:linear-gradient(#fff 0 0) padding-box,linear-gradient(#fff 0 0);background:linear-gradient(#fff,#00f,#f0f,violet,#ffffe0) border-box;mask-composite:exclude;-webkit-mask-composite:xor;animation:ring-ai var(--duration) ease-in-out infinite;--start: 180deg;--value: var(--start);--scale: 1;transform:rotateY(var(--value)) rotateX(var(--value)) rotate(var(--value)) scale(var(--scale))}.rings-ai:before{--start: 180deg}.rings-ai:after{--start: 90deg}.rings-ai>.rings-ai:before{--start: 360deg}.rings-ai>.rings-ai:after{--start: 270deg}@keyframes ring-ai{0%{--value: var(--start);--scale: 1}50%{--scale: 1.2;--width-ratio: 1.5}70%{--scale: 1;--value: calc(var(--start) + 180deg);--width-ratio: 1}80%{--scale: 1.2;--width-ratio: 1.5}to{--value: calc(var(--start) + 360deg);--scale: 1;--width-ratio: 1}}@keyframes fadeIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes pulse{0%,to{opacity:.4}50%{opacity:1}}@keyframes slideUp{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes slideUpMenu{0%{opacity:0;transform:translateY(12px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes eqPulse{0%{transform:scaleY(.4);opacity:.7}20%{transform:scaleY(1);opacity:1}40%{transform:scaleY(.6);opacity:.85}60%{transform:scaleY(.9);opacity:.95}80%{transform:scaleY(.5);opacity:.8}to{transform:scaleY(.4);opacity:.7}}
@@ -1,100 +0,0 @@
1
- /**
2
- * Company-specific configuration for GojiSearch chat interface.
3
- * Update these values to customize the chat for different clients.
4
- */
5
- export const companyConfig = {
6
- brandName: "GojiSearch",
7
- defaultLanguage: "en",
8
- languages: {
9
- en: {
10
- label: "English",
11
- welcome: {
12
- title: "Welcome to GojiSearch",
13
- description: "Ask me anything! I'll search through your knowledge base and provide accurate answers with sources.",
14
- },
15
- headerSubtitleExpanded: "Conversation powered by your docs",
16
- headerSubtitleCollapsed: "Start typing to expand",
17
- sourcesLabel: "Sources",
18
- languageSelectorLabel: "Language",
19
- generatingMessage: "{brand} is generating...",
20
- inputPlaceholder: "Ask anything and press Enter",
21
- bookDemoButton: "Book a Demo",
22
- bookDemoDialogTitle: "Book a Demo with Chaimaa",
23
- bookDemoDialogDescription: "Schedule a 30-minute call to discuss your needs and see how we can help.",
24
- errorMessage: "I'm sorry, I encountered an error. Please try again.",
25
- suggested: "Suggested",
26
- },
27
- it: {
28
- label: "Italiano",
29
- welcome: {
30
- title: "Benvenuto in GojiSearch",
31
- description: "Chiedimi qualsiasi cosa! Cercherò nella tua knowledge base e fornirò risposte accurate con citazioni.",
32
- },
33
- headerSubtitleExpanded: "Conversazione alimentata dai tuoi documenti",
34
- headerSubtitleCollapsed: "Inizia a digitare per espandere",
35
- sourcesLabel: "Fonti",
36
- languageSelectorLabel: "Lingua",
37
- generatingMessage: "{brand} sta generando...",
38
- inputPlaceholder: "Chiedi qualsiasi cosa e premi Invio",
39
- bookDemoButton: "Prenota una demo",
40
- bookDemoDialogTitle: "Prenota una demo con Chaimaa",
41
- bookDemoDialogDescription: "Pianifica una chiamata di 30 minuti per discutere le tue esigenze e vedere come possiamo aiutarti.",
42
- errorMessage: "Si è verificato un errore. Riprova più tardi.",
43
- suggested: "Suggerito",
44
- },
45
- fr: {
46
- label: "Français",
47
- welcome: {
48
- title: "Bienvenue sur GojiSearch",
49
- description: "Posez-moi vos questions ! Je parcourrai votre base de connaissances et fournirai des réponses précises avec des sources.",
50
- },
51
- headerSubtitleExpanded: "Conversation alimentée par vos contenus",
52
- headerSubtitleCollapsed: "Commencez à écrire pour développer",
53
- sourcesLabel: "Sources",
54
- languageSelectorLabel: "Langue",
55
- generatingMessage: "{brand} génère une réponse...",
56
- inputPlaceholder: "Posez votre question et appuyez sur Entrée",
57
- bookDemoButton: "Réserver une démo",
58
- bookDemoDialogTitle: "Réserver une démo avec Chaimaa",
59
- bookDemoDialogDescription: "Planifiez un appel de 30 minutes pour discuter de vos besoins et découvrir nos solutions.",
60
- errorMessage: "Une erreur s'est produite. Merci de réessayer.",
61
- suggested: "Suggéré",
62
- },
63
- es: {
64
- label: "Español",
65
- welcome: {
66
- title: "Bienvenido a GojiSearch",
67
- description: "¡Pregúntame lo que quieras! Buscaré en tu base de conocimientos y proporcionaré respuestas precisas con fuentes.",
68
- },
69
- headerSubtitleExpanded: "Conversación impulsada por tus documentos",
70
- headerSubtitleCollapsed: "Empieza a escribir para expandir",
71
- sourcesLabel: "Fuentes",
72
- languageSelectorLabel: "Idioma",
73
- generatingMessage: "{brand} está generando...",
74
- inputPlaceholder: "Pregunta cualquier cosa y presiona Enter",
75
- bookDemoButton: "Reservar una demo",
76
- bookDemoDialogTitle: "Reservar una demo con Chaimaa",
77
- bookDemoDialogDescription: "Programa una llamada de 30 minutos para discutir tus necesidades y ver cómo podemos ayudarte.",
78
- errorMessage: "Lo siento, ocurrió un error. Por favor, inténtalo de nuevo.",
79
- suggested: "Sugerido",
80
- },
81
- de: {
82
- label: "Deutsch",
83
- welcome: {
84
- title: "Willkommen bei GojiSearch",
85
- description: "Frag mich alles! Ich durchsuche deine Wissensdatenbank und liefere präzise Antworten mit Quellen.",
86
- },
87
- headerSubtitleExpanded: "Unterhaltung basierend auf deinen Dokumenten",
88
- headerSubtitleCollapsed: "Beginne zu tippen zum Erweitern",
89
- sourcesLabel: "Quellen",
90
- languageSelectorLabel: "Sprache",
91
- generatingMessage: "{brand} generiert...",
92
- inputPlaceholder: "Frage alles und drücke Enter",
93
- bookDemoButton: "Demo buchen",
94
- bookDemoDialogTitle: "Demo mit Chaimaa buchen",
95
- bookDemoDialogDescription: "Plane einen 30-minütigen Anruf, um deine Bedürfnisse zu besprechen und zu sehen, wie wir helfen können.",
96
- errorMessage: "Entschuldigung, es ist ein Fehler aufgetreten. Bitte versuche es erneut.",
97
- suggested: "Vorgeschlagen",
98
- },
99
- },
100
- };
@@ -1,10 +0,0 @@
1
- export const calendarConfig = {
2
- provider: "calcom",
3
- link: "chaimaahrk/30min",
4
- namespace: "30min",
5
- theme: "light",
6
- layout: "month_view",
7
- };
8
- export function getCalendarConfig() {
9
- return calendarConfig;
10
- }
@@ -1,229 +0,0 @@
1
- /**
2
- * GojiSearch API Client
3
- * Handles both HTTP and WebSocket connections to the GojiSearch backend
4
- */
5
- export class GojiSearchClient {
6
- baseUrl;
7
- wsUrl;
8
- ws = null;
9
- currentHandler = null;
10
- reconnectAttempts = 0;
11
- maxReconnectAttempts = 3;
12
- constructor(baseUrl = "http://localhost:8000") {
13
- this.baseUrl = baseUrl;
14
- this.wsUrl = baseUrl.replace(/^http/, "ws");
15
- }
16
- ensureWebSocketConnection() {
17
- if (this.ws && this.ws.readyState === WebSocket.OPEN) {
18
- return Promise.resolve();
19
- }
20
- return new Promise((resolve, reject) => {
21
- this.ws = new WebSocket(`${this.wsUrl}/ws/chat`);
22
- this.ws.onopen = () => {
23
- console.log("[GojiSearch] WebSocket connected");
24
- this.reconnectAttempts = 0;
25
- resolve();
26
- };
27
- this.ws.onmessage = (event) => {
28
- try {
29
- const data = JSON.parse(event.data);
30
- console.log("[GojiSearch] WebSocket message:", data.type, data);
31
- if (data.type === "ready") {
32
- console.log("[GojiSearch] WebSocket ready");
33
- }
34
- else if (data.type === "chat_delta") {
35
- if (this.currentHandler) {
36
- console.log("[GojiSearch] Delta:", data.delta);
37
- this.currentHandler.onDelta(data.delta);
38
- }
39
- }
40
- else if (data.type === "chat_done") {
41
- console.log("[GojiSearch] Chat done, answer length:", data.answer?.length, "sources:", data.sources?.length);
42
- if (this.currentHandler) {
43
- this.currentHandler.onDone({
44
- session_id: data.session_id,
45
- answer: data.answer,
46
- sources: data.sources,
47
- suggested_questions: data.suggested_questions,
48
- });
49
- // Clear handler after completion
50
- this.currentHandler = null;
51
- }
52
- }
53
- else if (data.type === "error") {
54
- if (this.currentHandler) {
55
- this.currentHandler.onError(new Error(data.error || "Unknown error"));
56
- this.currentHandler = null;
57
- }
58
- }
59
- }
60
- catch (error) {
61
- console.error("[GojiSearch] Parse error:", error);
62
- if (this.currentHandler) {
63
- this.currentHandler.onError(error);
64
- this.currentHandler = null;
65
- }
66
- }
67
- };
68
- this.ws.onerror = (event) => {
69
- console.error("[GojiSearch] WebSocket error");
70
- reject(new Error("WebSocket connection failed"));
71
- };
72
- this.ws.onclose = (event) => {
73
- console.log("[GojiSearch] WebSocket closed");
74
- this.ws = null;
75
- // Attempt reconnect if not a clean close
76
- if (!event.wasClean && this.reconnectAttempts < this.maxReconnectAttempts) {
77
- this.reconnectAttempts++;
78
- console.log(`[GojiSearch] Reconnecting (${this.reconnectAttempts}/${this.maxReconnectAttempts})...`);
79
- setTimeout(() => this.ensureWebSocketConnection(), 1000 * this.reconnectAttempts);
80
- }
81
- };
82
- });
83
- }
84
- closeWebSocket() {
85
- if (this.ws) {
86
- this.ws.close();
87
- this.ws = null;
88
- }
89
- this.currentHandler = null;
90
- }
91
- /**
92
- * Send a chat message (non-streaming)
93
- */
94
- async chat(params) {
95
- const response = await fetch(`${this.baseUrl}/chat`, {
96
- method: "POST",
97
- headers: {
98
- "Content-Type": "application/json",
99
- },
100
- body: JSON.stringify({
101
- message: params.message,
102
- session_id: params.sessionId,
103
- limit: params.limit || 5,
104
- language: params.language,
105
- }),
106
- });
107
- if (!response.ok) {
108
- throw new Error(`Chat request failed: ${response.statusText}`);
109
- }
110
- return response.json();
111
- }
112
- /**
113
- * Send a chat message with streaming (WebSocket)
114
- * Reuses existing WebSocket connection
115
- */
116
- async streamChat(params) {
117
- try {
118
- // Ensure WebSocket is connected
119
- await this.ensureWebSocketConnection();
120
- // Set current handler (only one message at a time)
121
- this.currentHandler = {
122
- onDelta: params.onDelta,
123
- onDone: params.onDone,
124
- onError: params.onError,
125
- };
126
- console.log("[GojiSearch] Sending message:", params.message);
127
- // Send message
128
- this.ws.send(JSON.stringify({
129
- message: params.message,
130
- session_id: params.sessionId,
131
- limit: params.limit || 5,
132
- stream: true,
133
- language: params.language,
134
- }));
135
- // Return cleanup function
136
- return () => {
137
- if (this.currentHandler === params) {
138
- this.currentHandler = null;
139
- }
140
- };
141
- }
142
- catch (error) {
143
- params.onError(error);
144
- return () => { }; // No-op cleanup
145
- }
146
- }
147
- /**
148
- * Get chat history for a session
149
- */
150
- async getHistory(sessionId) {
151
- const response = await fetch(`${this.baseUrl}/chat/history/${sessionId}`);
152
- if (!response.ok) {
153
- throw new Error(`Failed to get history: ${response.statusText}`);
154
- }
155
- return response.json();
156
- }
157
- /**
158
- * Clear a chat session
159
- */
160
- async clearSession(sessionId) {
161
- const response = await fetch(`${this.baseUrl}/chat/clear/${sessionId}`, {
162
- method: "DELETE",
163
- });
164
- if (!response.ok) {
165
- throw new Error(`Failed to clear session: ${response.statusText}`);
166
- }
167
- }
168
- /**
169
- * Health check
170
- */
171
- async health() {
172
- const response = await fetch(`${this.baseUrl}/health`);
173
- return response.json();
174
- }
175
- /**
176
- * Transcribe audio via backend (/transcribe)
177
- */
178
- async transcribeAudio(params) {
179
- const form = new FormData();
180
- form.append("file", params.file, params.filename || "audio.webm");
181
- if (params.model)
182
- form.append("model", params.model);
183
- if (params.language)
184
- form.append("language", params.language);
185
- if (params.prompt)
186
- form.append("prompt", params.prompt);
187
- const response = await fetch(`${this.baseUrl}/transcribe`, {
188
- method: "POST",
189
- body: form,
190
- });
191
- if (!response.ok) {
192
- throw new Error(`Transcription failed: ${response.statusText}`);
193
- }
194
- return response.json();
195
- }
196
- /**
197
- * Get initial suggested questions from backend
198
- */
199
- async getSuggestions(params) {
200
- const url = new URL(`${this.baseUrl}/chat/suggestions`);
201
- if (params?.language) {
202
- url.searchParams.set("language", params.language);
203
- }
204
- const response = await fetch(url.toString());
205
- if (!response.ok) {
206
- throw new Error(`Failed to get suggestions: ${response.statusText}`);
207
- }
208
- return response.json();
209
- }
210
- }
211
- /**
212
- * Create a GojiSearch client instance with custom API URL
213
- *
214
- * @param apiUrl - Backend API URL (default: http://localhost:8000)
215
- * @returns GojiSearchClient instance
216
- *
217
- * @example
218
- * ```tsx
219
- * const client = createGojiClient("https://api.myapp.com")
220
- * ```
221
- */
222
- export function createGojiClient(apiUrl) {
223
- return new GojiSearchClient(apiUrl || "http://localhost:8000");
224
- }
225
- /**
226
- * Default client instance for convenience (points to localhost)
227
- * For production use, create your own instance with createGojiClient()
228
- */
229
- export const gojiClient = createGojiClient();