@retrivora-ai/rag-engine 1.0.0 → 1.0.2
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/dist/{ChromaDBProvider-APQVJ5F7.mjs → ChromaDBProvider-MIDOR4FW.mjs} +2 -2
- package/dist/{MilvusProvider-35US67MS.mjs → MilvusProvider-U7SKC27V.mjs} +2 -2
- package/dist/{MongoDBProvider-COVYZDP6.mjs → MongoDBProvider-BO2Y5DRR.mjs} +2 -2
- package/dist/{PineconeProvider-AWFJQDZL.mjs → PineconeProvider-QZNRKTN2.mjs} +2 -2
- package/dist/{PostgreSQLProvider-IEYRJ7XJ.mjs → PostgreSQLProvider-BMOETDZA.mjs} +1 -1
- package/dist/{QdrantProvider-M6TQYZRO.mjs → QdrantProvider-YNUNEOZH.mjs} +2 -2
- package/dist/{RedisProvider-3G5PBLZ4.mjs → RedisProvider-SR65SCKV.mjs} +2 -2
- package/dist/{SimpleGraphProvider-UK7DJW37.mjs → SimpleGraphProvider-SLOXO4M7.mjs} +1 -1
- package/dist/{UniversalVectorProvider-FYQ3B2PW.mjs → UniversalVectorProvider-IN67OS56.mjs} +3 -3
- package/dist/{WeaviateProvider-ITHO36IL.mjs → WeaviateProvider-5FWDFITI.mjs} +2 -2
- package/dist/{chunk-4A47RCG2.mjs → chunk-3DSHW676.mjs} +1 -1
- package/dist/{chunk-NXUCKY5L.mjs → chunk-5YGUXK7Z.mjs} +1 -1
- package/dist/{chunk-7SOSCZGS.mjs → chunk-73I6VWU3.mjs} +2 -2
- package/dist/{chunk-WGSZNY3X.mjs → chunk-CFVEZTBJ.mjs} +1 -1
- package/dist/{chunk-U6KHVZLF.mjs → chunk-LR3VMDVK.mjs} +2 -2
- package/dist/{chunk-OOQXNLXD.mjs → chunk-M6JSPGAR.mjs} +1 -1
- package/dist/{chunk-P4HAQ7KB.mjs → chunk-OJNAKSQ2.mjs} +90 -34
- package/dist/{chunk-TYHTZIDP.mjs → chunk-U55XRW3U.mjs} +1 -1
- package/dist/{chunk-ZNBKHNJ4.mjs → chunk-VUQJVIJT.mjs} +1 -1
- package/dist/{chunk-QMIKLALV.mjs → chunk-X4TOT24V.mjs} +32 -0
- package/dist/{chunk-67AJ6SMD.mjs → chunk-YLTMFW4M.mjs} +1 -1
- package/dist/handlers/index.d.mts +1 -1
- package/dist/handlers/index.d.ts +1 -1
- package/dist/handlers/index.js +109 -22
- package/dist/handlers/index.mjs +5 -3
- package/dist/{index-CrGMwXfO.d.ts → index-B2mutkgp.d.ts} +5 -1
- package/dist/{index-v669iV-k.d.mts → index-Bjy0es5a.d.mts} +5 -1
- package/dist/index.d.mts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +325 -380
- package/dist/index.mjs +315 -370
- package/dist/server.d.mts +7 -22
- package/dist/server.d.ts +7 -22
- package/dist/server.js +48 -22
- package/dist/server.mjs +11 -11
- package/package.json +1 -1
- package/src/components/ChatWindow.tsx +4 -3
- package/src/components/MessageBubble.tsx +5 -2
- package/src/core/Pipeline.ts +1 -0
- package/src/core/VectorPlugin.ts +13 -22
- package/src/handlers/index.ts +53 -0
- package/src/hooks/useRagChat.ts +79 -15
- package/src/providers/vectordb/MongoDBProvider.ts +1 -1
- package/src/rag/EntityExtractor.ts +3 -0
package/dist/handlers/index.js
CHANGED
|
@@ -10,6 +10,9 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
10
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
12
|
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
13
|
+
var __typeError = (msg) => {
|
|
14
|
+
throw TypeError(msg);
|
|
15
|
+
};
|
|
13
16
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
17
|
var __spreadValues = (a, b) => {
|
|
15
18
|
for (var prop in b || (b = {}))
|
|
@@ -62,6 +65,34 @@ var __asyncGenerator = (__this, __arguments, generator) => {
|
|
|
62
65
|
}, method = (k, call, wait, clear) => it[k] = (x) => (call = new Promise((yes, no, run) => (run = () => resume(k, x, yes, no), q ? q.then(run) : run())), clear = () => q === wait && (q = 0), q = wait = call.then(clear, clear), call), q, it = {};
|
|
63
66
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
64
67
|
};
|
|
68
|
+
var __yieldStar = (value) => {
|
|
69
|
+
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
70
|
+
if (obj == null) {
|
|
71
|
+
obj = value[__knownSymbol("iterator")]();
|
|
72
|
+
method = (k) => it[k] = (x) => obj[k](x);
|
|
73
|
+
} else {
|
|
74
|
+
obj = obj.call(value);
|
|
75
|
+
method = (k) => it[k] = (v) => {
|
|
76
|
+
if (isAwait) {
|
|
77
|
+
isAwait = false;
|
|
78
|
+
if (k === "throw") throw v;
|
|
79
|
+
return v;
|
|
80
|
+
}
|
|
81
|
+
isAwait = true;
|
|
82
|
+
return {
|
|
83
|
+
done: false,
|
|
84
|
+
value: new __await(new Promise((resolve) => {
|
|
85
|
+
var x = obj[k](v);
|
|
86
|
+
if (!(x instanceof Object)) __typeError("Object expected");
|
|
87
|
+
resolve(x);
|
|
88
|
+
}), 1)
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
93
|
+
throw x;
|
|
94
|
+
}, "return" in obj && method("return"), it;
|
|
95
|
+
};
|
|
65
96
|
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
66
97
|
|
|
67
98
|
// src/utils/templateUtils.ts
|
|
@@ -515,7 +546,7 @@ var init_MongoDBProvider = __esm({
|
|
|
515
546
|
if (!opts.uri || !opts.database || !opts.collection) {
|
|
516
547
|
throw new Error("[MongoDBProvider] options uri, database, and collection are required.");
|
|
517
548
|
}
|
|
518
|
-
this.client = new import_mongodb.MongoClient(opts.uri);
|
|
549
|
+
this.client = new import_mongodb.MongoClient(opts.uri, { serverSelectionTimeoutMS: 5e3 });
|
|
519
550
|
this.dbName = opts.database;
|
|
520
551
|
this.collectionName = opts.collection;
|
|
521
552
|
this.embeddingKey = opts.embeddingKey || "embedding";
|
|
@@ -1476,6 +1507,7 @@ __export(handlers_exports, {
|
|
|
1476
1507
|
createChatHandler: () => createChatHandler,
|
|
1477
1508
|
createHealthHandler: () => createHealthHandler,
|
|
1478
1509
|
createIngestHandler: () => createIngestHandler,
|
|
1510
|
+
createStreamHandler: () => createStreamHandler,
|
|
1479
1511
|
createUploadHandler: () => createUploadHandler
|
|
1480
1512
|
});
|
|
1481
1513
|
module.exports = __toCommonJS(handlers_exports);
|
|
@@ -2825,6 +2857,9 @@ Extract entities and relationships from the following text.
|
|
|
2825
2857
|
Format the output as JSON with two keys: "nodes" (array of {id, label, properties}) and "edges" (array of {source, target, type, properties}).
|
|
2826
2858
|
Use the same ID for the same entity.
|
|
2827
2859
|
|
|
2860
|
+
IMPORTANT: Ensure all property values are valid JSON types (strings, numbers, booleans, or null).
|
|
2861
|
+
DO NOT include mathematical expressions like "4.5/5" as numbers; use strings instead.
|
|
2862
|
+
|
|
2828
2863
|
Text:
|
|
2829
2864
|
"${text}"
|
|
2830
2865
|
|
|
@@ -3399,6 +3434,7 @@ var Pipeline = class {
|
|
|
3399
3434
|
async initialize() {
|
|
3400
3435
|
var _a;
|
|
3401
3436
|
if (this.initialised) return;
|
|
3437
|
+
console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
|
|
3402
3438
|
this.vectorDB = await ProviderRegistry.createVectorProvider(this.config.vectorDb);
|
|
3403
3439
|
const { llmProvider, embeddingProvider } = await EmbeddingStrategyResolver.resolve(
|
|
3404
3440
|
this.config.llm,
|
|
@@ -3783,29 +3819,9 @@ var ProviderHealthCheck = class {
|
|
|
3783
3819
|
|
|
3784
3820
|
// src/core/VectorPlugin.ts
|
|
3785
3821
|
var VectorPlugin = class {
|
|
3786
|
-
/**
|
|
3787
|
-
* Initializes the plugin with the host configuration.
|
|
3788
|
-
* @param hostConfig - Configuration object passed from the host application.
|
|
3789
|
-
* @throws Error if configuration is invalid or providers are unhealthy
|
|
3790
|
-
*
|
|
3791
|
-
* @example
|
|
3792
|
-
* const plugin = new VectorPlugin({
|
|
3793
|
-
* projectId: 'my-app',
|
|
3794
|
-
* vectorDb: {
|
|
3795
|
-
* provider: 'pinecone',
|
|
3796
|
-
* indexName: 'my-index',
|
|
3797
|
-
* options: { apiKey: process.env.PINECONE_API_KEY }
|
|
3798
|
-
* },
|
|
3799
|
-
* llm: {
|
|
3800
|
-
* provider: 'openai',
|
|
3801
|
-
* model: 'gpt-4o',
|
|
3802
|
-
* apiKey: process.env.OPENAI_API_KEY
|
|
3803
|
-
* }
|
|
3804
|
-
* });
|
|
3805
|
-
*/
|
|
3806
3822
|
constructor(hostConfig) {
|
|
3807
3823
|
this.config = ConfigResolver.resolve(hostConfig);
|
|
3808
|
-
ConfigValidator.validateAndThrow(this.config);
|
|
3824
|
+
this.validationPromise = ConfigValidator.validateAndThrow(this.config);
|
|
3809
3825
|
this.pipeline = new Pipeline(this.config);
|
|
3810
3826
|
}
|
|
3811
3827
|
/**
|
|
@@ -3831,12 +3847,23 @@ var VectorPlugin = class {
|
|
|
3831
3847
|
* Run a chat query.
|
|
3832
3848
|
*/
|
|
3833
3849
|
async chat(message, history = [], namespace) {
|
|
3850
|
+
await this.validationPromise;
|
|
3834
3851
|
return this.pipeline.ask(message, history, namespace);
|
|
3835
3852
|
}
|
|
3853
|
+
/**
|
|
3854
|
+
* Run a streaming chat query.
|
|
3855
|
+
*/
|
|
3856
|
+
chatStream(_0) {
|
|
3857
|
+
return __asyncGenerator(this, arguments, function* (message, history = [], namespace) {
|
|
3858
|
+
yield new __await(this.validationPromise);
|
|
3859
|
+
yield* __yieldStar(this.pipeline.askStream(message, history, namespace));
|
|
3860
|
+
});
|
|
3861
|
+
}
|
|
3836
3862
|
/**
|
|
3837
3863
|
* Ingest documents into the vector database.
|
|
3838
3864
|
*/
|
|
3839
3865
|
async ingest(documents, namespace) {
|
|
3866
|
+
await this.validationPromise;
|
|
3840
3867
|
return this.pipeline.ingest(documents, namespace);
|
|
3841
3868
|
}
|
|
3842
3869
|
};
|
|
@@ -3918,6 +3945,65 @@ function createChatHandler(config) {
|
|
|
3918
3945
|
}
|
|
3919
3946
|
};
|
|
3920
3947
|
}
|
|
3948
|
+
function createStreamHandler(config) {
|
|
3949
|
+
const plugin = new VectorPlugin(config);
|
|
3950
|
+
return async function POST(req) {
|
|
3951
|
+
try {
|
|
3952
|
+
const body = await req.json();
|
|
3953
|
+
const { message, history = [], namespace } = body;
|
|
3954
|
+
const encoder = new TextEncoder();
|
|
3955
|
+
const stream = new ReadableStream({
|
|
3956
|
+
async start(controller) {
|
|
3957
|
+
try {
|
|
3958
|
+
const pipelineStream = plugin.chatStream(message, history, namespace);
|
|
3959
|
+
try {
|
|
3960
|
+
for (var iter = __forAwait(pipelineStream), more, temp, error; more = !(temp = await iter.next()).done; more = false) {
|
|
3961
|
+
const chunk = temp.value;
|
|
3962
|
+
if (typeof chunk === "string") {
|
|
3963
|
+
controller.enqueue(encoder.encode(chunk));
|
|
3964
|
+
} else {
|
|
3965
|
+
controller.enqueue(encoder.encode(`
|
|
3966
|
+
|
|
3967
|
+
__METADATA__${JSON.stringify(chunk)}`));
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
} catch (temp) {
|
|
3971
|
+
error = [temp];
|
|
3972
|
+
} finally {
|
|
3973
|
+
try {
|
|
3974
|
+
more && (temp = iter.return) && await temp.call(iter);
|
|
3975
|
+
} finally {
|
|
3976
|
+
if (error)
|
|
3977
|
+
throw error[0];
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
controller.close();
|
|
3981
|
+
} catch (streamError) {
|
|
3982
|
+
console.error("[createStreamHandler] Stream processing error:", streamError);
|
|
3983
|
+
const errorMessage = streamError instanceof Error ? streamError.message : String(streamError);
|
|
3984
|
+
controller.enqueue(encoder.encode(`
|
|
3985
|
+
|
|
3986
|
+
__ERROR__${JSON.stringify({ error: errorMessage })}`));
|
|
3987
|
+
controller.close();
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
3991
|
+
return new Response(stream, {
|
|
3992
|
+
headers: {
|
|
3993
|
+
"Content-Type": "text/event-stream",
|
|
3994
|
+
"Cache-Control": "no-cache",
|
|
3995
|
+
"Connection": "keep-alive"
|
|
3996
|
+
}
|
|
3997
|
+
});
|
|
3998
|
+
} catch (err) {
|
|
3999
|
+
const message = err instanceof Error ? err.message : "Internal server error";
|
|
4000
|
+
return new Response(JSON.stringify({ error: message }), {
|
|
4001
|
+
status: 500,
|
|
4002
|
+
headers: { "Content-Type": "application/json" }
|
|
4003
|
+
});
|
|
4004
|
+
}
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
3921
4007
|
function createIngestHandler(config) {
|
|
3922
4008
|
const plugin = new VectorPlugin(config);
|
|
3923
4009
|
return async function POST(req) {
|
|
@@ -3990,5 +4076,6 @@ function createUploadHandler(config) {
|
|
|
3990
4076
|
createChatHandler,
|
|
3991
4077
|
createHealthHandler,
|
|
3992
4078
|
createIngestHandler,
|
|
4079
|
+
createStreamHandler,
|
|
3993
4080
|
createUploadHandler
|
|
3994
4081
|
});
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -2,13 +2,15 @@ import {
|
|
|
2
2
|
createChatHandler,
|
|
3
3
|
createHealthHandler,
|
|
4
4
|
createIngestHandler,
|
|
5
|
+
createStreamHandler,
|
|
5
6
|
createUploadHandler
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-OJNAKSQ2.mjs";
|
|
8
|
+
import "../chunk-YLTMFW4M.mjs";
|
|
9
|
+
import "../chunk-X4TOT24V.mjs";
|
|
9
10
|
export {
|
|
10
11
|
createChatHandler,
|
|
11
12
|
createHealthHandler,
|
|
12
13
|
createIngestHandler,
|
|
14
|
+
createStreamHandler,
|
|
13
15
|
createUploadHandler
|
|
14
16
|
};
|
|
@@ -71,6 +71,10 @@ interface IProviderHealthChecker {
|
|
|
71
71
|
declare function createChatHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
72
72
|
error: string;
|
|
73
73
|
}> | NextResponse<ChatResponse>>;
|
|
74
|
+
/**
|
|
75
|
+
* createStreamHandler — factory that returns a streaming Next.js App Router POST handler
|
|
76
|
+
*/
|
|
77
|
+
declare function createStreamHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<Response>;
|
|
74
78
|
/**
|
|
75
79
|
* createIngestHandler — factory for the document ingestion endpoint.
|
|
76
80
|
*/
|
|
@@ -109,4 +113,4 @@ declare function createUploadHandler(config?: Partial<RagConfig>): (req: NextReq
|
|
|
109
113
|
}[];
|
|
110
114
|
}>>;
|
|
111
115
|
|
|
112
|
-
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, createHealthHandler as b, createChatHandler as c, createIngestHandler as d, createUploadHandler as e };
|
|
116
|
+
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, createHealthHandler as b, createChatHandler as c, createIngestHandler as d, createUploadHandler as e, createStreamHandler as f };
|
|
@@ -71,6 +71,10 @@ interface IProviderHealthChecker {
|
|
|
71
71
|
declare function createChatHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<NextResponse<{
|
|
72
72
|
error: string;
|
|
73
73
|
}> | NextResponse<ChatResponse>>;
|
|
74
|
+
/**
|
|
75
|
+
* createStreamHandler — factory that returns a streaming Next.js App Router POST handler
|
|
76
|
+
*/
|
|
77
|
+
declare function createStreamHandler(config?: Partial<RagConfig>): (req: NextRequest) => Promise<Response>;
|
|
74
78
|
/**
|
|
75
79
|
* createIngestHandler — factory for the document ingestion endpoint.
|
|
76
80
|
*/
|
|
@@ -109,4 +113,4 @@ declare function createUploadHandler(config?: Partial<RagConfig>): (req: NextReq
|
|
|
109
113
|
}[];
|
|
110
114
|
}>>;
|
|
111
115
|
|
|
112
|
-
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, createHealthHandler as b, createChatHandler as c, createIngestHandler as d, createUploadHandler as e };
|
|
116
|
+
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, createHealthHandler as b, createChatHandler as c, createIngestHandler as d, createUploadHandler as e, createStreamHandler as f };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React$1, { ReactNode } from 'react';
|
|
3
2
|
import { C as ChatMessage } from './DocumentChunker-C-sCZPhi.mjs';
|
|
4
3
|
export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-C-sCZPhi.mjs';
|
|
@@ -9,7 +8,7 @@ interface ChatWidgetProps {
|
|
|
9
8
|
/** Position of the floating button. Defaults to bottom-right. */
|
|
10
9
|
position?: 'bottom-right' | 'bottom-left';
|
|
11
10
|
}
|
|
12
|
-
declare function ChatWidget({ position }: ChatWidgetProps):
|
|
11
|
+
declare function ChatWidget({ position }: ChatWidgetProps): React$1.JSX.Element | null;
|
|
13
12
|
|
|
14
13
|
interface ChatWindowProps {
|
|
15
14
|
/** Additional className for the wrapper div */
|
|
@@ -21,7 +20,7 @@ interface ChatWindowProps {
|
|
|
21
20
|
/** Whether to show a close (X) button in the header */
|
|
22
21
|
showClose?: boolean;
|
|
23
22
|
}
|
|
24
|
-
declare function ChatWindow({ className, style, onClose, showClose }: ChatWindowProps):
|
|
23
|
+
declare function ChatWindow({ className, style, onClose, showClose }: ChatWindowProps): React$1.JSX.Element;
|
|
25
24
|
|
|
26
25
|
interface DocumentUploadProps {
|
|
27
26
|
/** Optional namespace for the upload */
|
|
@@ -31,7 +30,7 @@ interface DocumentUploadProps {
|
|
|
31
30
|
/** Additional className */
|
|
32
31
|
className?: string;
|
|
33
32
|
}
|
|
34
|
-
declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps):
|
|
33
|
+
declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): React$1.JSX.Element;
|
|
35
34
|
|
|
36
35
|
interface MessageBubbleProps {
|
|
37
36
|
message: ChatMessage;
|
|
@@ -40,13 +39,20 @@ interface MessageBubbleProps {
|
|
|
40
39
|
primaryColor?: string;
|
|
41
40
|
accentColor?: string;
|
|
42
41
|
}
|
|
43
|
-
declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, }: MessageBubbleProps):
|
|
42
|
+
declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, }: MessageBubbleProps): React$1.JSX.Element;
|
|
44
43
|
|
|
45
44
|
interface SourceCardProps {
|
|
46
45
|
source: VectorMatch;
|
|
47
46
|
index: number;
|
|
48
47
|
}
|
|
49
|
-
declare function SourceCard({ source, index }: SourceCardProps):
|
|
48
|
+
declare function SourceCard({ source, index }: SourceCardProps): React$1.JSX.Element;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* ConfigProvider — React Context that makes RagConfig (UI subset) available
|
|
52
|
+
* to all child components without prop drilling.
|
|
53
|
+
*
|
|
54
|
+
* Only the UI-safe portions of RagConfig are exposed to the client.
|
|
55
|
+
*/
|
|
50
56
|
|
|
51
57
|
interface ClientConfig {
|
|
52
58
|
projectId: string;
|
|
@@ -58,7 +64,7 @@ declare function ConfigProvider({ config, children, }: {
|
|
|
58
64
|
ui?: Partial<UIConfig>;
|
|
59
65
|
};
|
|
60
66
|
children: ReactNode;
|
|
61
|
-
}):
|
|
67
|
+
}): React$1.JSX.Element;
|
|
62
68
|
declare function useConfig(): ClientConfig;
|
|
63
69
|
|
|
64
70
|
type MessageRole = 'user' | 'assistant';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React$1, { ReactNode } from 'react';
|
|
3
2
|
import { C as ChatMessage } from './DocumentChunker-C-sCZPhi.js';
|
|
4
3
|
export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-C-sCZPhi.js';
|
|
@@ -9,7 +8,7 @@ interface ChatWidgetProps {
|
|
|
9
8
|
/** Position of the floating button. Defaults to bottom-right. */
|
|
10
9
|
position?: 'bottom-right' | 'bottom-left';
|
|
11
10
|
}
|
|
12
|
-
declare function ChatWidget({ position }: ChatWidgetProps):
|
|
11
|
+
declare function ChatWidget({ position }: ChatWidgetProps): React$1.JSX.Element | null;
|
|
13
12
|
|
|
14
13
|
interface ChatWindowProps {
|
|
15
14
|
/** Additional className for the wrapper div */
|
|
@@ -21,7 +20,7 @@ interface ChatWindowProps {
|
|
|
21
20
|
/** Whether to show a close (X) button in the header */
|
|
22
21
|
showClose?: boolean;
|
|
23
22
|
}
|
|
24
|
-
declare function ChatWindow({ className, style, onClose, showClose }: ChatWindowProps):
|
|
23
|
+
declare function ChatWindow({ className, style, onClose, showClose }: ChatWindowProps): React$1.JSX.Element;
|
|
25
24
|
|
|
26
25
|
interface DocumentUploadProps {
|
|
27
26
|
/** Optional namespace for the upload */
|
|
@@ -31,7 +30,7 @@ interface DocumentUploadProps {
|
|
|
31
30
|
/** Additional className */
|
|
32
31
|
className?: string;
|
|
33
32
|
}
|
|
34
|
-
declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps):
|
|
33
|
+
declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): React$1.JSX.Element;
|
|
35
34
|
|
|
36
35
|
interface MessageBubbleProps {
|
|
37
36
|
message: ChatMessage;
|
|
@@ -40,13 +39,20 @@ interface MessageBubbleProps {
|
|
|
40
39
|
primaryColor?: string;
|
|
41
40
|
accentColor?: string;
|
|
42
41
|
}
|
|
43
|
-
declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, }: MessageBubbleProps):
|
|
42
|
+
declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, }: MessageBubbleProps): React$1.JSX.Element;
|
|
44
43
|
|
|
45
44
|
interface SourceCardProps {
|
|
46
45
|
source: VectorMatch;
|
|
47
46
|
index: number;
|
|
48
47
|
}
|
|
49
|
-
declare function SourceCard({ source, index }: SourceCardProps):
|
|
48
|
+
declare function SourceCard({ source, index }: SourceCardProps): React$1.JSX.Element;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* ConfigProvider — React Context that makes RagConfig (UI subset) available
|
|
52
|
+
* to all child components without prop drilling.
|
|
53
|
+
*
|
|
54
|
+
* Only the UI-safe portions of RagConfig are exposed to the client.
|
|
55
|
+
*/
|
|
50
56
|
|
|
51
57
|
interface ClientConfig {
|
|
52
58
|
projectId: string;
|
|
@@ -58,7 +64,7 @@ declare function ConfigProvider({ config, children, }: {
|
|
|
58
64
|
ui?: Partial<UIConfig>;
|
|
59
65
|
};
|
|
60
66
|
children: ReactNode;
|
|
61
|
-
}):
|
|
67
|
+
}): React$1.JSX.Element;
|
|
62
68
|
declare function useConfig(): ClientConfig;
|
|
63
69
|
|
|
64
70
|
type MessageRole = 'user' | 'assistant';
|