@retrivora-ai/rag-engine 2.4.3 → 2.4.5

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 (139) hide show
  1. package/dist/{BatchProcessor-zbQMaZHm.d.mts → BatchProcessor-Csy_K1qQ.d.mts} +2 -0
  2. package/dist/{BatchProcessor-D42E706a.d.ts → BatchProcessor-Dg18zZGk.d.ts} +2 -0
  3. package/dist/handlers/index.js +27 -4
  4. package/dist/handlers/index.mjs +27 -4
  5. package/dist/index.d.mts +3 -3
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +12 -10
  8. package/dist/index.mjs +12 -10
  9. package/dist/server.d.mts +2 -2
  10. package/dist/server.d.ts +2 -2
  11. package/dist/server.js +28 -4
  12. package/dist/server.mjs +28 -4
  13. package/package.json +1 -3
  14. package/src/LicensedRetrivora.ts +0 -278
  15. package/src/app/api/chat/route.ts +0 -4
  16. package/src/app/api/health/route.ts +0 -5
  17. package/src/app/api/ingest/route.ts +0 -27
  18. package/src/app/api/suggestions/route.ts +0 -5
  19. package/src/app/api/upload/route.ts +0 -5
  20. package/src/app/constants.tsx +0 -270
  21. package/src/app/favicon.ico +0 -0
  22. package/src/app/globals.css +0 -449
  23. package/src/app/layout.tsx +0 -22
  24. package/src/app/page.tsx +0 -64
  25. package/src/app/types.ts +0 -30
  26. package/src/browser.tsx +0 -127
  27. package/src/components/ChatWidget.tsx +0 -393
  28. package/src/components/ChatWindow.tsx +0 -952
  29. package/src/components/CodeViewer.tsx +0 -56
  30. package/src/components/ConfigProvider.tsx +0 -141
  31. package/src/components/DocumentUpload.tsx +0 -354
  32. package/src/components/DynamicChart.tsx +0 -297
  33. package/src/components/HourglassLoader.tsx +0 -87
  34. package/src/components/MarkdownComponents.tsx +0 -186
  35. package/src/components/MessageBubble.tsx +0 -498
  36. package/src/components/ObservabilityPanel.tsx +0 -374
  37. package/src/components/ProductCard.tsx +0 -107
  38. package/src/components/ProductCarousel.tsx +0 -97
  39. package/src/components/SourceCard.tsx +0 -61
  40. package/src/components/ThemeProvider.tsx +0 -8
  41. package/src/components/ThemeToggle.tsx +0 -29
  42. package/src/components/ThinkingBlock.tsx +0 -75
  43. package/src/components/UIDispatcher.tsx +0 -342
  44. package/src/components/VisualizationRenderer.tsx +0 -621
  45. package/src/components/constants.tsx +0 -503
  46. package/src/config/ConfigBuilder.ts +0 -285
  47. package/src/config/EmbeddingStrategy.ts +0 -148
  48. package/src/config/LicenseConfigResolver.ts +0 -298
  49. package/src/config/RagConfig.ts +0 -328
  50. package/src/config/UniversalProfiles.ts +0 -82
  51. package/src/config/constants.ts +0 -64
  52. package/src/config/serverConfig.ts +0 -378
  53. package/src/config/uiConstants.ts +0 -47
  54. package/src/core/BatchProcessor.ts +0 -385
  55. package/src/core/CircuitBreaker.ts +0 -118
  56. package/src/core/ConfigFetcher.ts +0 -220
  57. package/src/core/ConfigResolver.ts +0 -165
  58. package/src/core/ConfigValidator.ts +0 -197
  59. package/src/core/DatabaseStorage.ts +0 -526
  60. package/src/core/FreeTierLimitsGuard.ts +0 -281
  61. package/src/core/LLMRouter.ts +0 -79
  62. package/src/core/LangChainAgent.ts +0 -132
  63. package/src/core/LicenseValidator.ts +0 -284
  64. package/src/core/LicenseVerifier.ts +0 -261
  65. package/src/core/MultiAgentCoordinator.ts +0 -239
  66. package/src/core/Pipeline.ts +0 -1279
  67. package/src/core/PluginManager.ts +0 -277
  68. package/src/core/ProjectSettings.ts +0 -247
  69. package/src/core/ProviderHealthCheck.ts +0 -133
  70. package/src/core/ProviderInterfaces.ts +0 -37
  71. package/src/core/ProviderRegistry.ts +0 -156
  72. package/src/core/QueryProcessor.ts +0 -399
  73. package/src/core/Retrivora.ts +0 -98
  74. package/src/core/VectorPlugin.ts +0 -193
  75. package/src/core/mcp.ts +0 -261
  76. package/src/exceptions/index.ts +0 -131
  77. package/src/handlers/index.ts +0 -1625
  78. package/src/hooks/useHydrated.ts +0 -13
  79. package/src/hooks/useProjectSettings.ts +0 -105
  80. package/src/hooks/useRagChat.ts +0 -436
  81. package/src/hooks/useStoredMessages.ts +0 -64
  82. package/src/index.css +0 -4269
  83. package/src/index.ts +0 -137
  84. package/src/lib/plugin.ts +0 -24
  85. package/src/llm/ILLMProvider.ts +0 -60
  86. package/src/llm/LLMFactory.ts +0 -141
  87. package/src/llm/providers/AnthropicProvider.ts +0 -215
  88. package/src/llm/providers/GeminiProvider.ts +0 -311
  89. package/src/llm/providers/GroqProvider.ts +0 -184
  90. package/src/llm/providers/OllamaProvider.ts +0 -232
  91. package/src/llm/providers/OpenAIProvider.ts +0 -188
  92. package/src/llm/providers/QwenProvider.ts +0 -199
  93. package/src/llm/providers/UniversalLLMAdapter.ts +0 -422
  94. package/src/llm/utils.ts +0 -46
  95. package/src/providers/graphdb/BaseGraphProvider.ts +0 -43
  96. package/src/providers/graphdb/SimpleGraphProvider.ts +0 -66
  97. package/src/providers/vectordb/BaseVectorProvider.ts +0 -98
  98. package/src/providers/vectordb/ChromaDBProvider.ts +0 -130
  99. package/src/providers/vectordb/MilvusProvider.ts +0 -134
  100. package/src/providers/vectordb/MongoDBProvider.ts +0 -250
  101. package/src/providers/vectordb/MultiTablePostgresProvider.ts +0 -461
  102. package/src/providers/vectordb/PineconeProvider.ts +0 -295
  103. package/src/providers/vectordb/PostgreSQLProvider.ts +0 -227
  104. package/src/providers/vectordb/QdrantProvider.ts +0 -294
  105. package/src/providers/vectordb/RedisProvider.ts +0 -105
  106. package/src/providers/vectordb/UniversalVectorProvider.ts +0 -221
  107. package/src/providers/vectordb/WeaviateProvider.ts +0 -172
  108. package/src/rag/DocumentChunker.ts +0 -144
  109. package/src/rag/EntityExtractor.ts +0 -90
  110. package/src/rag/LlamaIndexIngestor.ts +0 -60
  111. package/src/rag/Reranker.ts +0 -106
  112. package/src/rendering/IntentClassifier.ts +0 -167
  113. package/src/rendering/RendererRegistry.ts +0 -164
  114. package/src/rendering/RuleEngine.ts +0 -67
  115. package/src/rendering/VisualizationDecisionEngine.ts +0 -164
  116. package/src/rendering/__tests__/VisualizationDecisionEngine.test.ts +0 -237
  117. package/src/rendering/index.ts +0 -12
  118. package/src/rendering/rules/Rule1SpecificInfoRule.ts +0 -28
  119. package/src/rendering/rules/Rule2ComparisonRule.ts +0 -24
  120. package/src/rendering/rules/Rule3ProductDiscoveryRule.ts +0 -28
  121. package/src/rendering/rules/Rule4AnalyticalRule.ts +0 -38
  122. package/src/rendering/rules/Rule5MixedResponseRule.ts +0 -29
  123. package/src/rendering/rules/Rule6SmallResultSetRule.ts +0 -24
  124. package/src/rendering/rules/Rule7LargeTableRule.ts +0 -35
  125. package/src/rendering/types.ts +0 -96
  126. package/src/server.ts +0 -156
  127. package/src/tailwind.css +0 -194
  128. package/src/telemetry/TelemetryService.ts +0 -330
  129. package/src/types/chat.ts +0 -89
  130. package/src/types/index.ts +0 -278
  131. package/src/types/pdf-parse.d.ts +0 -13
  132. package/src/types/props.ts +0 -169
  133. package/src/utils/DocumentParser.ts +0 -111
  134. package/src/utils/ProductExtractor.ts +0 -350
  135. package/src/utils/SchemaMapper.ts +0 -176
  136. package/src/utils/UITransformer.ts +0 -1812
  137. package/src/utils/synonyms.ts +0 -80
  138. package/src/utils/templateUtils.ts +0 -78
  139. package/src/version.ts +0 -6
@@ -91,6 +91,8 @@ interface MessageBubbleProps {
91
91
  accentColor: string;
92
92
  onAddToCart?: (product: Product) => void;
93
93
  viewportSize?: ChatViewportSize;
94
+ /** Whether to show the sources toggle and cards (respects dashboard citations setting) */
95
+ showSources?: boolean;
94
96
  /** Called when the user clicks thumbs up or thumbs down on an assistant message */
95
97
  onFeedback?: (messageId: string, rating: 'thumbs_up' | 'thumbs_down') => void;
96
98
  }
@@ -91,6 +91,8 @@ interface MessageBubbleProps {
91
91
  accentColor: string;
92
92
  onAddToCart?: (product: Product) => void;
93
93
  viewportSize?: ChatViewportSize;
94
+ /** Whether to show the sources toggle and cards (respects dashboard citations setting) */
95
+ showSources?: boolean;
94
96
  /** Called when the user clicks thumbs up or thumbs down on an assistant message */
95
97
  onFeedback?: (messageId: string, rating: 'thumbs_up' | 'thumbs_down') => void;
96
98
  }
@@ -317,7 +317,7 @@ var init_package = __esm({
317
317
  "package.json"() {
318
318
  package_default = {
319
319
  name: "@retrivora-ai/rag-engine",
320
- version: "2.4.3",
320
+ version: "2.4.5",
321
321
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
322
322
  author: "Abhinav Alkuchi",
323
323
  license: "UNLICENSED",
@@ -389,8 +389,6 @@ var init_package = __esm({
389
389
  },
390
390
  files: [
391
391
  "dist",
392
- "src",
393
- ".env.example",
394
392
  "README.md",
395
393
  "FREE_TIER_ARCHITECTURE.md"
396
394
  ],
@@ -10961,10 +10959,35 @@ function resolveLicenseKey(req, config, bodyLicenseKey) {
10961
10959
  var _a3;
10962
10960
  return req.headers.get("x-license-key") || bodyLicenseKey || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.RAG_LICENSE_KEY || "";
10963
10961
  }
10962
+ function extractProjectIdFromLicenseKey(licenseKey) {
10963
+ try {
10964
+ const sanitizedKey = licenseKey.trim().replace(/^["']|["']$/g, "").trim();
10965
+ const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
10966
+ const parts = rawToken.split(".");
10967
+ if (parts.length === 3) {
10968
+ const decodedPayload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
10969
+ return decodedPayload.projectId;
10970
+ }
10971
+ } catch (e) {
10972
+ }
10973
+ return void 0;
10974
+ }
10964
10975
  async function enforceLicense(req, config, bodyLicenseKey) {
10965
10976
  const rawKey = resolveLicenseKey(req, config, bodyLicenseKey);
10966
10977
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
10967
- const projectId = config.projectId || "";
10978
+ const url = new URL(req.url);
10979
+ const queryProjectId = url.searchParams.get("projectId") || url.searchParams.get("project-id");
10980
+ const headerProjectId = req.headers.get("x-project-id") || req.headers.get("X-Project-Id");
10981
+ const jwtProjectId = extractProjectIdFromLicenseKey(licenseKey);
10982
+ let bodyProjectId = "";
10983
+ if (req.method === "POST") {
10984
+ try {
10985
+ const body = await req.clone().json();
10986
+ bodyProjectId = (body == null ? void 0 : body.projectId) || "";
10987
+ } catch (e) {
10988
+ }
10989
+ }
10990
+ const projectId = queryProjectId || headerProjectId || bodyProjectId || jwtProjectId || config.projectId || "";
10968
10991
  try {
10969
10992
  let payload;
10970
10993
  try {
@@ -302,7 +302,7 @@ var init_package = __esm({
302
302
  "package.json"() {
303
303
  package_default = {
304
304
  name: "@retrivora-ai/rag-engine",
305
- version: "2.4.3",
305
+ version: "2.4.5",
306
306
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
307
307
  author: "Abhinav Alkuchi",
308
308
  license: "UNLICENSED",
@@ -374,8 +374,6 @@ var init_package = __esm({
374
374
  },
375
375
  files: [
376
376
  "dist",
377
- "src",
378
- ".env.example",
379
377
  "README.md",
380
378
  "FREE_TIER_ARCHITECTURE.md"
381
379
  ],
@@ -10925,10 +10923,35 @@ function resolveLicenseKey(req, config, bodyLicenseKey) {
10925
10923
  var _a3;
10926
10924
  return req.headers.get("x-license-key") || bodyLicenseKey || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.RAG_LICENSE_KEY || "";
10927
10925
  }
10926
+ function extractProjectIdFromLicenseKey(licenseKey) {
10927
+ try {
10928
+ const sanitizedKey = licenseKey.trim().replace(/^["']|["']$/g, "").trim();
10929
+ const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
10930
+ const parts = rawToken.split(".");
10931
+ if (parts.length === 3) {
10932
+ const decodedPayload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
10933
+ return decodedPayload.projectId;
10934
+ }
10935
+ } catch (e) {
10936
+ }
10937
+ return void 0;
10938
+ }
10928
10939
  async function enforceLicense(req, config, bodyLicenseKey) {
10929
10940
  const rawKey = resolveLicenseKey(req, config, bodyLicenseKey);
10930
10941
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
10931
- const projectId = config.projectId || "";
10942
+ const url = new URL(req.url);
10943
+ const queryProjectId = url.searchParams.get("projectId") || url.searchParams.get("project-id");
10944
+ const headerProjectId = req.headers.get("x-project-id") || req.headers.get("X-Project-Id");
10945
+ const jwtProjectId = extractProjectIdFromLicenseKey(licenseKey);
10946
+ let bodyProjectId = "";
10947
+ if (req.method === "POST") {
10948
+ try {
10949
+ const body = await req.clone().json();
10950
+ bodyProjectId = (body == null ? void 0 : body.projectId) || "";
10951
+ } catch (e) {
10952
+ }
10953
+ }
10954
+ const projectId = queryProjectId || headerProjectId || bodyProjectId || jwtProjectId || config.projectId || "";
10932
10955
  try {
10933
10956
  let payload;
10934
10957
  try {
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, R as RemoteConfig } from './BatchProcessor-zbQMaZHm.mjs';
3
- export { A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, h as Chunk, i as ChunkOptions, j as ConfigFetcher, k as ConfigurationException, l as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, m as IRendererStrategy, n as IntentCategory, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, s as ProviderCredentials, t as ProviderNotFoundException, u as RateLimitException, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, y as RenderDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, O as isTransientError } from './BatchProcessor-zbQMaZHm.mjs';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, R as RemoteConfig } from './BatchProcessor-Csy_K1qQ.mjs';
3
+ export { A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, h as Chunk, i as ChunkOptions, j as ConfigFetcher, k as ConfigurationException, l as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, m as IRendererStrategy, n as IntentCategory, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, s as ProviderCredentials, t as ProviderNotFoundException, u as RateLimitException, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, y as RenderDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, O as isTransientError } from './BatchProcessor-Csy_K1qQ.mjs';
4
4
  import { O as ObservabilityTrace, U as UseRagChatOptions, a as UseRagChatReturn, P as ProjectChatSettings } from './ILLMProvider-Y6aL5N8J.mjs';
5
5
  export { A as AuthMode, C as ChatMessage, b as ChatOptions, c as ChatResponse, E as EmbedOptions, d as EmbeddingConfig, e as EmbeddingProvider, I as ILLMProvider, f as IngestDocument, L as LLMConfig, g as LLMProvider, h as LatencyBreakdown, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, R as RAGConfig, n as RagConfig, o as RagMessage, p as RetrievalConfig, q as RetrievedChunk, T as ThemeMode, r as TokenUsage, s as UIConfig, t as UniversalRagConfig, u as UpsertDocument, V as VectorDBConfig, v as VectorDBProvider, w as VectorMatch, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-Y6aL5N8J.mjs';
6
6
  import 'react';
@@ -47,7 +47,7 @@ declare function ChatWindow({ className, style, onClose, showClose, onResizeStar
47
47
 
48
48
  declare function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
49
49
 
50
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
50
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, showSources: showSourcesProp, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
51
51
 
52
52
  declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
53
53
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, R as RemoteConfig } from './BatchProcessor-D42E706a.js';
3
- export { A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, h as Chunk, i as ChunkOptions, j as ConfigFetcher, k as ConfigurationException, l as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, m as IRendererStrategy, n as IntentCategory, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, s as ProviderCredentials, t as ProviderNotFoundException, u as RateLimitException, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, y as RenderDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, O as isTransientError } from './BatchProcessor-D42E706a.js';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, R as RemoteConfig } from './BatchProcessor-Dg18zZGk.js';
3
+ export { A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, h as Chunk, i as ChunkOptions, j as ConfigFetcher, k as ConfigurationException, l as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, m as IRendererStrategy, n as IntentCategory, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, s as ProviderCredentials, t as ProviderNotFoundException, u as RateLimitException, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, y as RenderDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, O as isTransientError } from './BatchProcessor-Dg18zZGk.js';
4
4
  import { O as ObservabilityTrace, U as UseRagChatOptions, a as UseRagChatReturn, P as ProjectChatSettings } from './ILLMProvider-Y6aL5N8J.js';
5
5
  export { A as AuthMode, C as ChatMessage, b as ChatOptions, c as ChatResponse, E as EmbedOptions, d as EmbeddingConfig, e as EmbeddingProvider, I as ILLMProvider, f as IngestDocument, L as LLMConfig, g as LLMProvider, h as LatencyBreakdown, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, R as RAGConfig, n as RagConfig, o as RagMessage, p as RetrievalConfig, q as RetrievedChunk, T as ThemeMode, r as TokenUsage, s as UIConfig, t as UniversalRagConfig, u as UpsertDocument, V as VectorDBConfig, v as VectorDBProvider, w as VectorMatch, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-Y6aL5N8J.js';
6
6
  import 'react';
@@ -47,7 +47,7 @@ declare function ChatWindow({ className, style, onClose, showClose, onResizeStar
47
47
 
48
48
  declare function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
49
49
 
50
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
50
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, showSources: showSourcesProp, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
51
51
 
52
52
  declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
53
53
 
package/dist/index.js CHANGED
@@ -345,6 +345,7 @@ function projectSettingsToUiConfig(settings) {
345
345
  welcomeMessage: settings.branding.welcomeMessage,
346
346
  poweredBy: settings.widget.showRetrivoraBranding ? "Retrivora AI" : "",
347
347
  allowUpload: settings.ai.fileUploadEnabled,
348
+ showSources: settings.ai.citationsEnabled,
348
349
  borderRadius: settings.branding.borderRadius <= 4 ? "sm" : settings.branding.borderRadius <= 8 ? "md" : settings.branding.borderRadius <= 16 ? "xl" : "full"
349
350
  };
350
351
  }
@@ -352,7 +353,7 @@ function projectSettingsToUiConfig(settings) {
352
353
  // package.json
353
354
  var package_default = {
354
355
  name: "@retrivora-ai/rag-engine",
355
- version: "2.4.3",
356
+ version: "2.4.5",
356
357
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
357
358
  author: "Abhinav Alkuchi",
358
359
  license: "UNLICENSED",
@@ -424,8 +425,6 @@ var package_default = {
424
425
  },
425
426
  files: [
426
427
  "dist",
427
- "src",
428
- ".env.example",
429
428
  "README.md",
430
429
  "FREE_TIER_ARCHITECTURE.md"
431
430
  ],
@@ -811,7 +810,7 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
811
810
  const targetNs = namespace || projectId || "default";
812
811
  if (targetNs) formData.append("namespace", targetNs);
813
812
  formData.append("dimension", dimension.toString());
814
- const apiBase = retrivoraApiBase || configuredApiBase || "/api/retrivora";
813
+ const apiBase = retrivoraApiBase || configuredApiBase || "https://www.retrivora.com/api/retrivora";
815
814
  const primaryUrl = uploadUrl || `${apiBase.replace(/\/$/, "")}/upload`;
816
815
  const uploadHeaders = __spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {});
817
816
  try {
@@ -2974,6 +2973,7 @@ function MessageBubble({
2974
2973
  accentColor = "#8b5cf6",
2975
2974
  onAddToCart,
2976
2975
  viewportSize = "large",
2976
+ showSources: showSourcesProp = true,
2977
2977
  onFeedback
2978
2978
  }) {
2979
2979
  var _a;
@@ -3179,7 +3179,7 @@ ${match.trim()}
3179
3179
  }
3180
3180
  ) }),
3181
3181
  !isUser && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex items-center gap-3 mt-1.5 w-full flex-wrap ${isCompact ? "gap-2" : "gap-3"}`, children: [
3182
- sources && sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3182
+ showSourcesProp && sources && sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3183
3183
  "button",
3184
3184
  {
3185
3185
  onClick: () => setShowSources((s) => !s),
@@ -3218,7 +3218,7 @@ ${match.trim()}
3218
3218
  )
3219
3219
  ] }),
3220
3220
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w-full flex flex-col gap-2 min-w-0", children: [
3221
- showSources && sources && sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SourceCard, { source: src, index: i }, src.id)) }),
3221
+ showSourcesProp && showSources && sources && sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SourceCard, { source: src, index: i }, src.id)) }),
3222
3222
  showTrace && message.trace && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ObservabilityPanel, { trace: message.trace, primaryColor })
3223
3223
  ] })
3224
3224
  ] })
@@ -3290,7 +3290,7 @@ function parseSseChunk(raw) {
3290
3290
  function useRagChat(projectId, options = {}) {
3291
3291
  const {
3292
3292
  apiUrl,
3293
- retrivoraApiBase = "/api/retrivora",
3293
+ retrivoraApiBase = "https://www.retrivora.com/api/retrivora",
3294
3294
  namespace,
3295
3295
  persist = true,
3296
3296
  onReply,
@@ -4084,7 +4084,7 @@ function ChatWindow({
4084
4084
  const [sessions, setSessions] = (0, import_react12.useState)([]);
4085
4085
  const fetchSessions = (0, import_react12.useCallback)(async () => {
4086
4086
  try {
4087
- const base = effectiveApiBase || "/api/retrivora";
4087
+ const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4088
4088
  const res = await fetch(`${base}/sessions`);
4089
4089
  if (res.ok) {
4090
4090
  const data = await res.json();
@@ -4296,7 +4296,7 @@ function ChatWindow({
4296
4296
  const timer = setTimeout(async () => {
4297
4297
  setIsSuggesting(true);
4298
4298
  try {
4299
- const base = effectiveApiBase || "/api/retrivora";
4299
+ const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4300
4300
  const primaryUrl = `${base}/suggestions`;
4301
4301
  const suggestionHeaders = __spreadValues(__spreadValues({
4302
4302
  "Content-Type": "application/json"
@@ -4584,6 +4584,7 @@ function ChatWindow({
4584
4584
  accentColor: ui.accentColor,
4585
4585
  onAddToCart,
4586
4586
  viewportSize,
4587
+ showSources: ui.showSources,
4587
4588
  onFeedback: submitFeedback
4588
4589
  }
4589
4590
  )
@@ -4598,7 +4599,8 @@ function ChatWindow({
4598
4599
  primaryColor: ui.primaryColor,
4599
4600
  accentColor: ui.accentColor,
4600
4601
  onAddToCart,
4601
- viewportSize
4602
+ viewportSize,
4603
+ showSources: ui.showSources
4602
4604
  }
4603
4605
  ),
4604
4606
  error && !licenseError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3", children: [
package/dist/index.mjs CHANGED
@@ -304,6 +304,7 @@ function projectSettingsToUiConfig(settings) {
304
304
  welcomeMessage: settings.branding.welcomeMessage,
305
305
  poweredBy: settings.widget.showRetrivoraBranding ? "Retrivora AI" : "",
306
306
  allowUpload: settings.ai.fileUploadEnabled,
307
+ showSources: settings.ai.citationsEnabled,
307
308
  borderRadius: settings.branding.borderRadius <= 4 ? "sm" : settings.branding.borderRadius <= 8 ? "md" : settings.branding.borderRadius <= 16 ? "xl" : "full"
308
309
  };
309
310
  }
@@ -311,7 +312,7 @@ function projectSettingsToUiConfig(settings) {
311
312
  // package.json
312
313
  var package_default = {
313
314
  name: "@retrivora-ai/rag-engine",
314
- version: "2.4.3",
315
+ version: "2.4.5",
315
316
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
316
317
  author: "Abhinav Alkuchi",
317
318
  license: "UNLICENSED",
@@ -383,8 +384,6 @@ var package_default = {
383
384
  },
384
385
  files: [
385
386
  "dist",
386
- "src",
387
- ".env.example",
388
387
  "README.md",
389
388
  "FREE_TIER_ARCHITECTURE.md"
390
389
  ],
@@ -770,7 +769,7 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
770
769
  const targetNs = namespace || projectId || "default";
771
770
  if (targetNs) formData.append("namespace", targetNs);
772
771
  formData.append("dimension", dimension.toString());
773
- const apiBase = retrivoraApiBase || configuredApiBase || "/api/retrivora";
772
+ const apiBase = retrivoraApiBase || configuredApiBase || "https://www.retrivora.com/api/retrivora";
774
773
  const primaryUrl = uploadUrl || `${apiBase.replace(/\/$/, "")}/upload`;
775
774
  const uploadHeaders = __spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {});
776
775
  try {
@@ -2979,6 +2978,7 @@ function MessageBubble({
2979
2978
  accentColor = "#8b5cf6",
2980
2979
  onAddToCart,
2981
2980
  viewportSize = "large",
2981
+ showSources: showSourcesProp = true,
2982
2982
  onFeedback
2983
2983
  }) {
2984
2984
  var _a;
@@ -3184,7 +3184,7 @@ ${match.trim()}
3184
3184
  }
3185
3185
  ) }),
3186
3186
  !isUser && /* @__PURE__ */ jsxs11("div", { className: `flex items-center gap-3 mt-1.5 w-full flex-wrap ${isCompact ? "gap-2" : "gap-3"}`, children: [
3187
- sources && sources.length > 0 && /* @__PURE__ */ jsxs11(
3187
+ showSourcesProp && sources && sources.length > 0 && /* @__PURE__ */ jsxs11(
3188
3188
  "button",
3189
3189
  {
3190
3190
  onClick: () => setShowSources((s) => !s),
@@ -3223,7 +3223,7 @@ ${match.trim()}
3223
3223
  )
3224
3224
  ] }),
3225
3225
  /* @__PURE__ */ jsxs11("div", { className: "w-full flex flex-col gap-2 min-w-0", children: [
3226
- showSources && sources && sources.length > 0 && /* @__PURE__ */ jsx12("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ jsx12(SourceCard, { source: src, index: i }, src.id)) }),
3226
+ showSourcesProp && showSources && sources && sources.length > 0 && /* @__PURE__ */ jsx12("div", { className: "mt-1 flex flex-col gap-2", children: sources.map((src, i) => /* @__PURE__ */ jsx12(SourceCard, { source: src, index: i }, src.id)) }),
3227
3227
  showTrace && message.trace && /* @__PURE__ */ jsx12(ObservabilityPanel, { trace: message.trace, primaryColor })
3228
3228
  ] })
3229
3229
  ] })
@@ -3295,7 +3295,7 @@ function parseSseChunk(raw) {
3295
3295
  function useRagChat(projectId, options = {}) {
3296
3296
  const {
3297
3297
  apiUrl,
3298
- retrivoraApiBase = "/api/retrivora",
3298
+ retrivoraApiBase = "https://www.retrivora.com/api/retrivora",
3299
3299
  namespace,
3300
3300
  persist = true,
3301
3301
  onReply,
@@ -4089,7 +4089,7 @@ function ChatWindow({
4089
4089
  const [sessions, setSessions] = useState7([]);
4090
4090
  const fetchSessions = useCallback2(async () => {
4091
4091
  try {
4092
- const base = effectiveApiBase || "/api/retrivora";
4092
+ const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4093
4093
  const res = await fetch(`${base}/sessions`);
4094
4094
  if (res.ok) {
4095
4095
  const data = await res.json();
@@ -4301,7 +4301,7 @@ function ChatWindow({
4301
4301
  const timer = setTimeout(async () => {
4302
4302
  setIsSuggesting(true);
4303
4303
  try {
4304
- const base = effectiveApiBase || "/api/retrivora";
4304
+ const base = effectiveApiBase || "https://www.retrivora.com/api/retrivora";
4305
4305
  const primaryUrl = `${base}/suggestions`;
4306
4306
  const suggestionHeaders = __spreadValues(__spreadValues({
4307
4307
  "Content-Type": "application/json"
@@ -4589,6 +4589,7 @@ function ChatWindow({
4589
4589
  accentColor: ui.accentColor,
4590
4590
  onAddToCart,
4591
4591
  viewportSize,
4592
+ showSources: ui.showSources,
4592
4593
  onFeedback: submitFeedback
4593
4594
  }
4594
4595
  )
@@ -4603,7 +4604,8 @@ function ChatWindow({
4603
4604
  primaryColor: ui.primaryColor,
4604
4605
  accentColor: ui.accentColor,
4605
4606
  onAddToCart,
4606
- viewportSize
4607
+ viewportSize,
4608
+ showSources: ui.showSources
4607
4609
  }
4608
4610
  ),
4609
4611
  error && !licenseError && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 text-rose-500 dark:text-rose-400 text-sm bg-rose-50 dark:bg-rose-400/10 border border-rose-200 dark:border-rose-400/20 rounded-xl px-4 py-3", children: [
package/dist/server.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, n as RagConfig, t as UniversalRagConfig, u as UpsertDocument, w as VectorMatch, G as GraphDBConfig, D as GraphNode, F as Edge, H as GraphSearchResult, I as ILLMProvider, v as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, s as UIConfig, J as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions, f as IngestDocument, c as ChatResponse } from './ILLMProvider-Y6aL5N8J.mjs';
2
2
  export { A as AuthMode, K as BarChartData, M as CarouselProduct, N as IRetriever, h as LatencyBreakdown, Q as LineChartDataPoint, S as MessageRole, X as MetricCardData, O as ObservabilityTrace, Y as PieChartData, Z as Product, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, P as ProjectChatSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, o as RagMessage, p as RetrievalConfig, _ as RetrievalResult, q as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, r as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-Y6aL5N8J.mjs';
3
- import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-zbQMaZHm.mjs';
4
- export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-zbQMaZHm.mjs';
3
+ import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-Csy_K1qQ.mjs';
4
+ export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-Csy_K1qQ.mjs';
5
5
  import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-59CHg0V3.mjs';
6
6
  export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-59CHg0V3.mjs';
7
7
  import 'react';
package/dist/server.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, n as RagConfig, t as UniversalRagConfig, u as UpsertDocument, w as VectorMatch, G as GraphDBConfig, D as GraphNode, F as Edge, H as GraphSearchResult, I as ILLMProvider, v as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, s as UIConfig, J as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions, f as IngestDocument, c as ChatResponse } from './ILLMProvider-Y6aL5N8J.js';
2
2
  export { A as AuthMode, K as BarChartData, M as CarouselProduct, N as IRetriever, h as LatencyBreakdown, Q as LineChartDataPoint, S as MessageRole, X as MetricCardData, O as ObservabilityTrace, Y as PieChartData, Z as Product, i as ProjectAiSettings, j as ProjectAuthSettings, k as ProjectBrandingSettings, P as ProjectChatSettings, l as ProjectTelemetrySettings, m as ProjectWidgetSettings, o as RagMessage, p as RetrievalConfig, _ as RetrievalResult, q as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, r as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, x as WorkflowConfig, y as createDefaultProjectSettings, z as normalizeProjectSettings, B as projectSettingsToUiConfig } from './ILLMProvider-Y6aL5N8J.js';
3
- import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-D42E706a.js';
4
- export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-D42E706a.js';
3
+ import { l as DecisionContext, n as IntentCategory, I as IRenderRule, y as RenderDecision, m as IRendererStrategy } from './BatchProcessor-Dg18zZGk.js';
4
+ export { Q as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, T as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, j as ConfigFetcher, b as ConfigProviderProps, k as ConfigurationException, U as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, V as LicenseConfigResolver, L as LicenseTierConfig, o as LicenseValidationError, p as LicenseValidationRequest, q as LicenseValidationResponse, r as LicenseValidator, M as MessageBubbleProps, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, s as ProviderCredentials, t as ProviderNotFoundException, Y as ProviderPill, u as RateLimitException, R as RemoteConfig, v as RemoteEmbeddingConfig, w as RemoteLLMConfig, x as RemoteVectorConfig, Z as RenderSectionDecision, z as RenderType, F as RetrievalException, G as Retrivora, H as RetrivoraError, J as RetrivoraErrorCode, K as SDKVersionUnsupportedError, N as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as wrapError } from './BatchProcessor-Dg18zZGk.js';
5
5
  import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BgKRInpa.js';
6
6
  export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-BgKRInpa.js';
7
7
  import 'react';
package/dist/server.js CHANGED
@@ -290,6 +290,7 @@ function projectSettingsToUiConfig(settings) {
290
290
  welcomeMessage: settings.branding.welcomeMessage,
291
291
  poweredBy: settings.widget.showRetrivoraBranding ? "Retrivora AI" : "",
292
292
  allowUpload: settings.ai.fileUploadEnabled,
293
+ showSources: settings.ai.citationsEnabled,
293
294
  borderRadius: settings.branding.borderRadius <= 4 ? "sm" : settings.branding.borderRadius <= 8 ? "md" : settings.branding.borderRadius <= 16 ? "xl" : "full"
294
295
  };
295
296
  }
@@ -330,7 +331,7 @@ var init_package = __esm({
330
331
  "package.json"() {
331
332
  package_default = {
332
333
  name: "@retrivora-ai/rag-engine",
333
- version: "2.4.3",
334
+ version: "2.4.5",
334
335
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
335
336
  author: "Abhinav Alkuchi",
336
337
  license: "UNLICENSED",
@@ -402,8 +403,6 @@ var init_package = __esm({
402
403
  },
403
404
  files: [
404
405
  "dist",
405
- "src",
406
- ".env.example",
407
406
  "README.md",
408
407
  "FREE_TIER_ARCHITECTURE.md"
409
408
  ],
@@ -11425,10 +11424,35 @@ function resolveLicenseKey(req, config, bodyLicenseKey) {
11425
11424
  var _a3;
11426
11425
  return req.headers.get("x-license-key") || bodyLicenseKey || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.RAG_LICENSE_KEY || "";
11427
11426
  }
11427
+ function extractProjectIdFromLicenseKey(licenseKey) {
11428
+ try {
11429
+ const sanitizedKey = licenseKey.trim().replace(/^["']|["']$/g, "").trim();
11430
+ const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
11431
+ const parts = rawToken.split(".");
11432
+ if (parts.length === 3) {
11433
+ const decodedPayload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
11434
+ return decodedPayload.projectId;
11435
+ }
11436
+ } catch (e) {
11437
+ }
11438
+ return void 0;
11439
+ }
11428
11440
  async function enforceLicense(req, config, bodyLicenseKey) {
11429
11441
  const rawKey = resolveLicenseKey(req, config, bodyLicenseKey);
11430
11442
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
11431
- const projectId = config.projectId || "";
11443
+ const url = new URL(req.url);
11444
+ const queryProjectId = url.searchParams.get("projectId") || url.searchParams.get("project-id");
11445
+ const headerProjectId = req.headers.get("x-project-id") || req.headers.get("X-Project-Id");
11446
+ const jwtProjectId = extractProjectIdFromLicenseKey(licenseKey);
11447
+ let bodyProjectId = "";
11448
+ if (req.method === "POST") {
11449
+ try {
11450
+ const body = await req.clone().json();
11451
+ bodyProjectId = (body == null ? void 0 : body.projectId) || "";
11452
+ } catch (e) {
11453
+ }
11454
+ }
11455
+ const projectId = queryProjectId || headerProjectId || bodyProjectId || jwtProjectId || config.projectId || "";
11432
11456
  try {
11433
11457
  let payload;
11434
11458
  try {
package/dist/server.mjs CHANGED
@@ -275,6 +275,7 @@ function projectSettingsToUiConfig(settings) {
275
275
  welcomeMessage: settings.branding.welcomeMessage,
276
276
  poweredBy: settings.widget.showRetrivoraBranding ? "Retrivora AI" : "",
277
277
  allowUpload: settings.ai.fileUploadEnabled,
278
+ showSources: settings.ai.citationsEnabled,
278
279
  borderRadius: settings.branding.borderRadius <= 4 ? "sm" : settings.branding.borderRadius <= 8 ? "md" : settings.branding.borderRadius <= 16 ? "xl" : "full"
279
280
  };
280
281
  }
@@ -315,7 +316,7 @@ var init_package = __esm({
315
316
  "package.json"() {
316
317
  package_default = {
317
318
  name: "@retrivora-ai/rag-engine",
318
- version: "2.4.3",
319
+ version: "2.4.5",
319
320
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
320
321
  author: "Abhinav Alkuchi",
321
322
  license: "UNLICENSED",
@@ -387,8 +388,6 @@ var init_package = __esm({
387
388
  },
388
389
  files: [
389
390
  "dist",
390
- "src",
391
- ".env.example",
392
391
  "README.md",
393
392
  "FREE_TIER_ARCHITECTURE.md"
394
393
  ],
@@ -11311,10 +11310,35 @@ function resolveLicenseKey(req, config, bodyLicenseKey) {
11311
11310
  var _a3;
11312
11311
  return req.headers.get("x-license-key") || bodyLicenseKey || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.RAG_LICENSE_KEY || "";
11313
11312
  }
11313
+ function extractProjectIdFromLicenseKey(licenseKey) {
11314
+ try {
11315
+ const sanitizedKey = licenseKey.trim().replace(/^["']|["']$/g, "").trim();
11316
+ const rawToken = sanitizedKey.replace(/^rtv_/i, "").trim();
11317
+ const parts = rawToken.split(".");
11318
+ if (parts.length === 3) {
11319
+ const decodedPayload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
11320
+ return decodedPayload.projectId;
11321
+ }
11322
+ } catch (e) {
11323
+ }
11324
+ return void 0;
11325
+ }
11314
11326
  async function enforceLicense(req, config, bodyLicenseKey) {
11315
11327
  const rawKey = resolveLicenseKey(req, config, bodyLicenseKey);
11316
11328
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
11317
- const projectId = config.projectId || "";
11329
+ const url = new URL(req.url);
11330
+ const queryProjectId = url.searchParams.get("projectId") || url.searchParams.get("project-id");
11331
+ const headerProjectId = req.headers.get("x-project-id") || req.headers.get("X-Project-Id");
11332
+ const jwtProjectId = extractProjectIdFromLicenseKey(licenseKey);
11333
+ let bodyProjectId = "";
11334
+ if (req.method === "POST") {
11335
+ try {
11336
+ const body = await req.clone().json();
11337
+ bodyProjectId = (body == null ? void 0 : body.projectId) || "";
11338
+ } catch (e) {
11339
+ }
11340
+ }
11341
+ const projectId = queryProjectId || headerProjectId || bodyProjectId || jwtProjectId || config.projectId || "";
11318
11342
  try {
11319
11343
  let payload;
11320
11344
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "UNLICENSED",
@@ -72,8 +72,6 @@
72
72
  },
73
73
  "files": [
74
74
  "dist",
75
- "src",
76
- ".env.example",
77
75
  "README.md",
78
76
  "FREE_TIER_ARCHITECTURE.md"
79
77
  ],