goji-search 1.0.0 → 1.1.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.
@@ -12,7 +12,6 @@ export const companyConfig = {
12
12
  title: "Welcome to GojiSearch",
13
13
  description: "Ask me anything! I'll search through your knowledge base and provide accurate answers with sources.",
14
14
  },
15
- suggestedPrompts: ["Tell me how you engage with prospects", "How do you qualify my leads?", "How long does it take to have Goji on my website?"],
16
15
  headerSubtitleExpanded: "Conversation powered by your docs",
17
16
  headerSubtitleCollapsed: "Start typing to expand",
18
17
  sourcesLabel: "Sources",
@@ -30,7 +29,6 @@ export const companyConfig = {
30
29
  title: "Benvenuto in GojiSearch",
31
30
  description: "Chiedimi qualsiasi cosa! Cercherò nella tua knowledge base e fornirò risposte accurate con citazioni.",
32
31
  },
33
- suggestedPrompts: ["Parlami di come interagisci con i tuoi clienti", "Parlami di come qualifichi i tuoi leads", "Quanto tempo ci vuole per avere Goji sul mio sito?"],
34
32
  headerSubtitleExpanded: "Conversazione alimentata dai tuoi documenti",
35
33
  headerSubtitleCollapsed: "Inizia a digitare per espandere",
36
34
  sourcesLabel: "Fonti",
@@ -48,11 +46,6 @@ export const companyConfig = {
48
46
  title: "Bienvenue sur GojiSearch",
49
47
  description: "Posez-moi vos questions ! Je parcourrai votre base de connaissances et fournirai des réponses précises avec des sources.",
50
48
  },
51
- suggestedPrompts: [
52
- "Qu'est-ce que Deel ?",
53
- "Comment fonctionne la tarification ?",
54
- "Parle-moi des fonctionnalités",
55
- ],
56
49
  headerSubtitleExpanded: "Conversation alimentée par vos contenus",
57
50
  headerSubtitleCollapsed: "Commencez à écrire pour développer",
58
51
  sourcesLabel: "Sources",
@@ -64,5 +57,39 @@ export const companyConfig = {
64
57
  bookDemoDialogDescription: "Planifiez un appel de 30 minutes pour discuter de vos besoins et découvrir nos solutions.",
65
58
  errorMessage: "Une erreur s'est produite. Merci de réessayer.",
66
59
  },
60
+ es: {
61
+ label: "Español",
62
+ welcome: {
63
+ title: "Bienvenido a GojiSearch",
64
+ description: "¡Pregúntame lo que quieras! Buscaré en tu base de conocimientos y proporcionaré respuestas precisas con fuentes.",
65
+ },
66
+ headerSubtitleExpanded: "Conversación impulsada por tus documentos",
67
+ headerSubtitleCollapsed: "Empieza a escribir para expandir",
68
+ sourcesLabel: "Fuentes",
69
+ languageSelectorLabel: "Idioma",
70
+ generatingMessage: "{brand} está generando...",
71
+ inputPlaceholder: "Pregunta cualquier cosa y presiona Enter",
72
+ bookDemoButton: "Reservar una demo",
73
+ bookDemoDialogTitle: "Reservar una demo con Chaimaa",
74
+ bookDemoDialogDescription: "Programa una llamada de 30 minutos para discutir tus necesidades y ver cómo podemos ayudarte.",
75
+ errorMessage: "Lo siento, ocurrió un error. Por favor, inténtalo de nuevo.",
76
+ },
77
+ de: {
78
+ label: "Deutsch",
79
+ welcome: {
80
+ title: "Willkommen bei GojiSearch",
81
+ description: "Frag mich alles! Ich durchsuche deine Wissensdatenbank und liefere präzise Antworten mit Quellen.",
82
+ },
83
+ headerSubtitleExpanded: "Unterhaltung basierend auf deinen Dokumenten",
84
+ headerSubtitleCollapsed: "Beginne zu tippen zum Erweitern",
85
+ sourcesLabel: "Quellen",
86
+ languageSelectorLabel: "Sprache",
87
+ generatingMessage: "{brand} generiert...",
88
+ inputPlaceholder: "Frage alles und drücke Enter",
89
+ bookDemoButton: "Demo buchen",
90
+ bookDemoDialogTitle: "Demo mit Chaimaa buchen",
91
+ bookDemoDialogDescription: "Plane einen 30-minütigen Anruf, um deine Bedürfnisse zu besprechen und zu sehen, wie wir helfen können.",
92
+ errorMessage: "Entschuldigung, es ist ein Fehler aufgetreten. Bitte versuche es erneut.",
93
+ },
67
94
  },
68
95
  };
@@ -19,6 +19,7 @@ export interface ChatResponse {
19
19
  session_id: string;
20
20
  answer: string;
21
21
  sources: ChatSource[];
22
+ suggested_questions?: string[];
22
23
  }
23
24
  export interface StreamDeltaMessage {
24
25
  type: "chat_delta";
@@ -29,6 +30,7 @@ export interface StreamDoneMessage {
29
30
  session_id: string;
30
31
  answer: string;
31
32
  sources: ChatSource[];
33
+ suggested_questions?: string[];
32
34
  }
33
35
  export type StreamMessage = StreamDeltaMessage | StreamDoneMessage;
34
36
  export declare class GojiSearchClient {
@@ -77,5 +79,42 @@ export declare class GojiSearchClient {
77
79
  * Health check
78
80
  */
79
81
  health(): Promise<any>;
82
+ /**
83
+ * Transcribe audio via backend (/transcribe)
84
+ */
85
+ transcribeAudio(params: {
86
+ file: Blob;
87
+ filename?: string;
88
+ model?: string;
89
+ language?: string;
90
+ prompt?: string;
91
+ }): Promise<{
92
+ text: string;
93
+ }>;
94
+ /**
95
+ * Get initial suggested questions from backend
96
+ */
97
+ getSuggestions(params?: {
98
+ language?: string;
99
+ }): Promise<{
100
+ suggestions: string[];
101
+ default_language?: string;
102
+ }>;
80
103
  }
104
+ /**
105
+ * Create a GojiSearch client instance with custom API URL
106
+ *
107
+ * @param apiUrl - Backend API URL (default: http://localhost:8000)
108
+ * @returns GojiSearchClient instance
109
+ *
110
+ * @example
111
+ * ```tsx
112
+ * const client = createGojiClient("https://api.myapp.com")
113
+ * ```
114
+ */
115
+ export declare function createGojiClient(apiUrl?: string): GojiSearchClient;
116
+ /**
117
+ * Default client instance for convenience (points to localhost)
118
+ * For production use, create your own instance with createGojiClient()
119
+ */
81
120
  export declare const gojiClient: GojiSearchClient;
@@ -44,6 +44,7 @@ export class GojiSearchClient {
44
44
  session_id: data.session_id,
45
45
  answer: data.answer,
46
46
  sources: data.sources,
47
+ suggested_questions: data.suggested_questions,
47
48
  });
48
49
  // Clear handler after completion
49
50
  this.currentHandler = null;
@@ -171,6 +172,58 @@ export class GojiSearchClient {
171
172
  const response = await fetch(`${this.baseUrl}/health`);
172
173
  return response.json();
173
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
+ }
174
210
  }
175
- // Global instance
176
- export const gojiClient = new GojiSearchClient(process.env.NEXT_PUBLIC_GOJI_API_URL || "http://localhost:8000");
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();
@@ -1 +1 @@
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, #7b7bf4, 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,#c979ee,#74bcd6);--x: .125rem;width:2rem;animation-timing-function:cubic-bezier(.12,.32,.68,.24)}.c2{background:radial-gradient(50% 50% at center,#ef788c,#e7e7fb);width:1.875rem}.c3{background:radial-gradient(50% 50% at center,#eb7fc6,transparent);width:.625rem;opacity:.6;--x: -.125rem}.c4{background:#6d67c8;animation-timing-function:cubic-bezier(.39,-.03,.75,.47)}.container-ai{overflow:hidden;background:#b6a9f8;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)}}
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, #EEB164, 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,#ffd37f,#f1b76b);--x: .125rem;width:2rem;animation-timing-function:cubic-bezier(.12,.32,.68,.24)}.c2{background:radial-gradient(50% 50% at center,#ffc888,#fff3e1);width:1.875rem}.c3{background:radial-gradient(50% 50% at center,#ffcf7a,transparent);width:.625rem;opacity:.6;--x: -.125rem}.c4{background:#d49a4f;animation-timing-function:cubic-bezier(.39,-.03,.75,.47)}.container-ai{overflow:hidden;background:#d49a4f;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,#139c18,#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}}
package/dist/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export { GojiSearchComponent } from './goji-search/components/goji-search-component';
2
+ export type { GojiSearchComponentProps } from './goji-search/components/goji-search-component';
3
+ export { GojiSearchClient, createGojiClient } from './goji-search/lib/goji-client';
4
+ export type { ChatSource, ChatResponse } from './goji-search/lib/goji-client';
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  // Export React components for React users
2
2
  export { GojiSearchComponent } from './goji-search/components/goji-search-component';
3
+ // Export API client utilities
4
+ export { GojiSearchClient, createGojiClient } from './goji-search/lib/goji-client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goji-search",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Embeddable GojiSearch components for both React and vanilla JS",
5
5
  "private": false,
6
6
  "type": "module",