@retrivora-ai/rag-engine 2.3.8 → 2.3.9
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/handlers/index.js +64 -35
- package/dist/handlers/index.mjs +64 -35
- package/dist/index.css +0 -15
- package/dist/index.js +35 -19
- package/dist/index.mjs +35 -19
- package/dist/server.js +64 -35
- package/dist/server.mjs +64 -35
- package/package.json +1 -1
- package/src/components/DocumentUpload.tsx +34 -15
- package/src/config/serverConfig.ts +14 -3
- package/src/core/ConfigFetcher.ts +6 -0
- package/src/handlers/index.ts +2 -0
- package/src/index.css +0 -15
- package/src/llm/providers/UniversalLLMAdapter.ts +18 -2
package/dist/handlers/index.js
CHANGED
|
@@ -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.3.
|
|
320
|
+
version: "2.3.9",
|
|
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",
|
|
@@ -512,6 +512,7 @@ var init_ConfigFetcher = __esm({
|
|
|
512
512
|
for (const baseUrl of controlPlaneUrls) {
|
|
513
513
|
try {
|
|
514
514
|
const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
|
|
515
|
+
console.log(`[ConfigFetcher] Fetching config from: ${url}`);
|
|
515
516
|
const res = await fetch(url, {
|
|
516
517
|
method: "GET",
|
|
517
518
|
headers: __spreadValues({
|
|
@@ -519,6 +520,10 @@ var init_ConfigFetcher = __esm({
|
|
|
519
520
|
"x-sdk-version": SDK_VERSION
|
|
520
521
|
}, licenseKey ? { "x-license-key": licenseKey } : {})
|
|
521
522
|
});
|
|
523
|
+
console.log(`[ConfigFetcher] Response status: ${res.status}`);
|
|
524
|
+
if (!res.ok) {
|
|
525
|
+
console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
|
|
526
|
+
}
|
|
522
527
|
if (res.ok) {
|
|
523
528
|
const data = await res.json();
|
|
524
529
|
if ((data == null ? void 0 : data.success) && (data == null ? void 0 : data.vectorDb)) {
|
|
@@ -3028,7 +3033,7 @@ function readEnum(env, name, fallback, allowed) {
|
|
|
3028
3033
|
throw new Error(`[getRagConfig] ${name} must be one of: ${allowed.join(", ")}`);
|
|
3029
3034
|
}
|
|
3030
3035
|
function getEnvConfig(env = process.env, base) {
|
|
3031
|
-
var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb;
|
|
3036
|
+
var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib;
|
|
3032
3037
|
const licenseKey = (_d = (_c = (_b = (_a3 = readString(env, "RAG_LICENSE_KEY")) != null ? _a3 : readString(env, "RETRIVORA_LICENSE_KEY")) != null ? _b : readString(env, "NEXT_PUBLIC_RETRIVORA_LICENSE_KEY")) != null ? _c : readString(env, "LICENSE_KEY")) != null ? _d : base == null ? void 0 : base.licenseKey;
|
|
3033
3038
|
const jwtProjectId = (() => {
|
|
3034
3039
|
if (!licenseKey) return void 0;
|
|
@@ -3121,14 +3126,15 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3121
3126
|
})();
|
|
3122
3127
|
const tierBasedLLMModel = isFreeTier2 ? "llama-3.1-8b-instant" : "llama-3.3-70b-versatile";
|
|
3123
3128
|
const tierBasedEmbeddingModel = isFreeTier2 ? "text-embedding-004" : "text-embedding-004";
|
|
3124
|
-
const
|
|
3129
|
+
const controlPlaneUrl = (_qa = readString(env, "RETRIVORA_CONTROL_PLANE_URL")) != null ? _qa : readString(env, "NEXT_PUBLIC_RETRIVORA_CONTROL_PLANE_URL");
|
|
3130
|
+
const defaultGatewayUrl = controlPlaneUrl ? `${controlPlaneUrl.replace(/\/$/, "")}/api/v1` : "https://llm.retrivora.com/api/v1";
|
|
3125
3131
|
const rt = _runtimeConfig;
|
|
3126
3132
|
const defaultLlmProvider = "universal_rest";
|
|
3127
|
-
const llmProvider = (
|
|
3128
|
-
const llmBaseUrl = (
|
|
3129
|
-
const llmModel = (
|
|
3130
|
-
const llmApiKey = (
|
|
3131
|
-
const llmProfile = (
|
|
3133
|
+
const llmProvider = (_ta = (_sa = readEnum(env, "LLM_PROVIDER", defaultLlmProvider, LLM_PROVIDERS)) != null ? _sa : (_ra = base == null ? void 0 : base.llm) == null ? void 0 : _ra.provider) != null ? _ta : defaultLlmProvider;
|
|
3134
|
+
const llmBaseUrl = (_ya = (_xa = (_wa = (_ua = readString(env, "LITELLM_BASE_URL")) != null ? _ua : readString(env, "LLM_BASE_URL")) != null ? _wa : (_va = base == null ? void 0 : base.llm) == null ? void 0 : _va.baseUrl) != null ? _xa : rt == null ? void 0 : rt.llmBaseUrl) != null ? _ya : defaultGatewayUrl;
|
|
3135
|
+
const llmModel = (_Ca = (_Ba = (_Aa = readString(env, "LLM_MODEL")) != null ? _Aa : (_za = base == null ? void 0 : base.llm) == null ? void 0 : _za.model) != null ? _Ba : rt == null ? void 0 : rt.llmModel) != null ? _Ca : tierBasedLLMModel;
|
|
3136
|
+
const llmApiKey = (_Ga = (_Fa = (_Da = readString(env, "LITELLM_MASTER_KEY")) != null ? _Da : rt == null ? void 0 : rt.litellmApiKey) != null ? _Fa : (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.apiKey) != null ? _Ga : licenseKey;
|
|
3137
|
+
const llmProfile = (_Ka = (_Ja = readString(env, "LLM_UNIVERSAL_PROFILE")) != null ? _Ja : (_Ia = (_Ha = base == null ? void 0 : base.llm) == null ? void 0 : _Ha.options) == null ? void 0 : _Ia.profile) != null ? _Ka : "litellm";
|
|
3132
3138
|
console.log("[serverConfig] \u{1F527} LLM Configuration:", {
|
|
3133
3139
|
baseUrl: llmBaseUrl,
|
|
3134
3140
|
model: llmModel,
|
|
@@ -3137,17 +3143,24 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3137
3143
|
source: (rt == null ? void 0 : rt.llmModel) ? "runtime-injected" : "env/fallback"
|
|
3138
3144
|
});
|
|
3139
3145
|
const defaultEmbeddingProvider = "universal_rest";
|
|
3140
|
-
const embeddingProvider = (
|
|
3141
|
-
const embeddingBaseUrl = (_Ta = (_Sa = (_Ra = (
|
|
3142
|
-
const embeddingModel = (
|
|
3143
|
-
const embeddingApiKey = (
|
|
3144
|
-
const embeddingProfile = (
|
|
3146
|
+
const embeddingProvider = (_Na = (_Ma = readEnum(env, "EMBEDDING_PROVIDER", defaultEmbeddingProvider, EMBEDDING_PROVIDERS)) != null ? _Ma : (_La = base == null ? void 0 : base.embedding) == null ? void 0 : _La.provider) != null ? _Na : defaultEmbeddingProvider;
|
|
3147
|
+
const embeddingBaseUrl = (_Ua = (_Ta = (_Sa = (_Ra = (_Pa = (_Oa = readString(env, "LITELLM_BASE_URL")) != null ? _Oa : readString(env, "EMBEDDING_BASE_URL")) != null ? _Pa : readString(env, "LLM_BASE_URL")) != null ? _Ra : (_Qa = base == null ? void 0 : base.embedding) == null ? void 0 : _Qa.baseUrl) != null ? _Sa : rt == null ? void 0 : rt.embeddingBaseUrl) != null ? _Ta : rt == null ? void 0 : rt.llmBaseUrl) != null ? _Ua : defaultGatewayUrl;
|
|
3148
|
+
const embeddingModel = (_Ya = (_Xa = (_Wa = readString(env, "EMBEDDING_MODEL")) != null ? _Wa : (_Va = base == null ? void 0 : base.embedding) == null ? void 0 : _Va.model) != null ? _Xa : rt == null ? void 0 : rt.embeddingModel) != null ? _Ya : tierBasedEmbeddingModel;
|
|
3149
|
+
const embeddingApiKey = (_ab = (_$a = (_Za = readString(env, "LITELLM_MASTER_KEY")) != null ? _Za : rt == null ? void 0 : rt.litellmApiKey) != null ? _$a : (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.apiKey) != null ? _ab : licenseKey;
|
|
3150
|
+
const embeddingProfile = (_eb = (_db = readString(env, "EMBEDDING_UNIVERSAL_PROFILE")) != null ? _db : (_cb = (_bb = base == null ? void 0 : base.embedding) == null ? void 0 : _bb.options) == null ? void 0 : _cb.profile) != null ? _eb : "litellm";
|
|
3151
|
+
console.log("[serverConfig] \u{1F527} Embedding Configuration:", {
|
|
3152
|
+
baseUrl: embeddingBaseUrl,
|
|
3153
|
+
model: embeddingModel,
|
|
3154
|
+
provider: embeddingProvider,
|
|
3155
|
+
hasApiKey: !!embeddingApiKey,
|
|
3156
|
+
source: (rt == null ? void 0 : rt.embeddingModel) ? "runtime-injected" : "env/fallback"
|
|
3157
|
+
});
|
|
3145
3158
|
return __spreadProps(__spreadValues({
|
|
3146
3159
|
projectId,
|
|
3147
3160
|
licenseKey,
|
|
3148
3161
|
vectorDb: {
|
|
3149
3162
|
provider: vectorProvider,
|
|
3150
|
-
indexName: (
|
|
3163
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3151
3164
|
options: vectorDbOptions
|
|
3152
3165
|
},
|
|
3153
3166
|
llm: {
|
|
@@ -3177,30 +3190,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3177
3190
|
}
|
|
3178
3191
|
},
|
|
3179
3192
|
ui: {
|
|
3180
|
-
title: (
|
|
3181
|
-
subtitle: (
|
|
3182
|
-
primaryColor: (
|
|
3183
|
-
accentColor: (
|
|
3184
|
-
logoUrl: (
|
|
3185
|
-
placeholder: (
|
|
3186
|
-
showSources: ((
|
|
3187
|
-
welcomeMessage: (
|
|
3188
|
-
visualStyle: (
|
|
3189
|
-
borderRadius: (
|
|
3190
|
-
allowUpload: ((
|
|
3193
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3194
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3195
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3196
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3197
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3198
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3199
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3200
|
+
welcomeMessage: (_vb = (_ub = readString(env, "NEXT_PUBLIC_WELCOME_MESSAGE")) != null ? _ub : readString(env, "UI_WELCOME_MESSAGE")) != null ? _vb : "Hello! I'm your AI assistant. Ask me anything about your documents.",
|
|
3201
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3202
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3203
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3191
3204
|
},
|
|
3192
3205
|
rag: {
|
|
3193
3206
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3194
3207
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3195
3208
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3196
3209
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3197
|
-
filterableFields: (
|
|
3210
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3198
3211
|
// Query pipeline toggles — read from .env.local
|
|
3199
3212
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3200
3213
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3201
3214
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3202
|
-
architecture: (
|
|
3203
|
-
chunkingStrategy: (
|
|
3215
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3216
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3204
3217
|
uiMapping: (() => {
|
|
3205
3218
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3206
3219
|
if (!raw) return void 0;
|
|
@@ -3213,7 +3226,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3213
3226
|
},
|
|
3214
3227
|
telemetry: {
|
|
3215
3228
|
enabled: telemetryEnabled,
|
|
3216
|
-
url: (
|
|
3229
|
+
url: (_Ib = (_Hb = (_Fb = readString(env, "TELEMETRY_URL")) != null ? _Fb : readString(env, "NEXT_PUBLIC_TELEMETRY_URL")) != null ? _Hb : (_Gb = base == null ? void 0 : base.telemetry) == null ? void 0 : _Gb.url) != null ? _Ib : "https://www.retrivora.com/api/telemetry"
|
|
3217
3230
|
}
|
|
3218
3231
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3219
3232
|
graphDb: {
|
|
@@ -4524,6 +4537,12 @@ var UniversalLLMAdapter = class {
|
|
|
4524
4537
|
this.resolvedHeaders = __spreadValues(__spreadValues({
|
|
4525
4538
|
"Content-Type": "application/json"
|
|
4526
4539
|
}, config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}), this.opts.headers || {});
|
|
4540
|
+
console.log("[UniversalLLMAdapter] Initialized with:", {
|
|
4541
|
+
model: this.model,
|
|
4542
|
+
baseUrl: this.baseUrl,
|
|
4543
|
+
hasApiKey: !!this.apiKey,
|
|
4544
|
+
apiKeyPrefix: this.apiKey ? `${this.apiKey.slice(0, 12)}...` : void 0
|
|
4545
|
+
});
|
|
4527
4546
|
this.http = import_axios2.default.create({
|
|
4528
4547
|
baseURL: this.baseUrl,
|
|
4529
4548
|
headers: this.resolvedHeaders,
|
|
@@ -4736,14 +4755,21 @@ ${context != null ? context : "None"}` },
|
|
|
4736
4755
|
});
|
|
4737
4756
|
}
|
|
4738
4757
|
async embed(text) {
|
|
4739
|
-
var _a3, _b, _c, _d, _e, _f, _g2;
|
|
4758
|
+
var _a3, _b, _c, _d, _e, _f, _g2, _h;
|
|
4740
4759
|
const path2 = (_a3 = this.opts.embedPath) != null ? _a3 : "/embeddings";
|
|
4741
4760
|
const payload = this.opts.embedPayloadTemplate ? buildPayload(this.opts.embedPayloadTemplate, { input: text, model: this.model }) : { input: text, model: this.model };
|
|
4742
4761
|
try {
|
|
4762
|
+
console.log(`[UniversalLLMAdapter] Posting to embedding endpoint: ${this.baseUrl}${path2}`, {
|
|
4763
|
+
model: this.model,
|
|
4764
|
+
inputLength: typeof text === "string" ? text.length : "unknown"
|
|
4765
|
+
});
|
|
4743
4766
|
const { data } = await this.http.post(path2, payload);
|
|
4744
4767
|
const extractPath = (_b = this.opts.embedExtractPath) != null ? _b : "data[0].embedding";
|
|
4745
4768
|
const vector = resolvePath(data, extractPath);
|
|
4746
|
-
if (Array.isArray(vector))
|
|
4769
|
+
if (Array.isArray(vector)) {
|
|
4770
|
+
console.log(`[UniversalLLMAdapter] Embedding HTTP request successful. Vector size: ${vector.length}`);
|
|
4771
|
+
return vector;
|
|
4772
|
+
}
|
|
4747
4773
|
console.warn(
|
|
4748
4774
|
`[UniversalLLMAdapter] Embedding API returned unexpected format for path '${extractPath}'. Response:`,
|
|
4749
4775
|
data
|
|
@@ -4751,14 +4777,14 @@ ${context != null ? context : "None"}` },
|
|
|
4751
4777
|
} catch (err) {
|
|
4752
4778
|
console.warn(
|
|
4753
4779
|
`[UniversalLLMAdapter] HTTP embedding request failed: ${(err == null ? void 0 : err.message) || err}`,
|
|
4754
|
-
{ path: path2, model: this.model }
|
|
4780
|
+
{ path: path2, model: this.model, response: (_c = err == null ? void 0 : err.response) == null ? void 0 : _c.data }
|
|
4755
4781
|
);
|
|
4756
4782
|
const _g3 = globalThis;
|
|
4757
4783
|
const dispatchEmbed = _g3.__retrivoraDispatchEmbedding;
|
|
4758
4784
|
if (typeof dispatchEmbed === "function") {
|
|
4759
4785
|
try {
|
|
4760
4786
|
const res = await dispatchEmbed({ input: text, model: this.model }, this.apiKey);
|
|
4761
|
-
if ((
|
|
4787
|
+
if ((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d[0]) == null ? void 0 : _e.embedding) {
|
|
4762
4788
|
return res.data[0].embedding;
|
|
4763
4789
|
}
|
|
4764
4790
|
} catch (dispatchErr) {
|
|
@@ -4767,10 +4793,12 @@ ${context != null ? context : "None"}` },
|
|
|
4767
4793
|
}
|
|
4768
4794
|
}
|
|
4769
4795
|
try {
|
|
4796
|
+
console.log(`[UniversalLLMAdapter] Retrying embedding request to: ${this.baseUrl}${path2}`);
|
|
4770
4797
|
const { data } = await this.http.post(path2, payload);
|
|
4771
|
-
const extractPath = (
|
|
4798
|
+
const extractPath = (_f = this.opts.embedExtractPath) != null ? _f : "data[0].embedding";
|
|
4772
4799
|
const vector = resolvePath(data, extractPath);
|
|
4773
4800
|
if (Array.isArray(vector)) {
|
|
4801
|
+
console.log(`[UniversalLLMAdapter] Retry embedding HTTP request successful. Vector size: ${vector.length}`);
|
|
4774
4802
|
return vector;
|
|
4775
4803
|
}
|
|
4776
4804
|
console.error(
|
|
@@ -4783,7 +4811,7 @@ ${context != null ? context : "None"}` },
|
|
|
4783
4811
|
} catch (err) {
|
|
4784
4812
|
console.error(
|
|
4785
4813
|
`[UniversalLLMAdapter] Both embedding attempts failed. Path: ${path2}, Model: ${this.model}`,
|
|
4786
|
-
{ error: err == null ? void 0 : err.message, statusCode: (
|
|
4814
|
+
{ error: err == null ? void 0 : err.message, statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status, response: (_h = err == null ? void 0 : err.response) == null ? void 0 : _h.data }
|
|
4787
4815
|
);
|
|
4788
4816
|
throw new Error(
|
|
4789
4817
|
`[UniversalLLMAdapter] Failed to generate embedding after 2 attempts: ${(err == null ? void 0 : err.message) || err}`
|
|
@@ -11513,6 +11541,7 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
11513
11541
|
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_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 || "";
|
|
11514
11542
|
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
11515
11543
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "";
|
|
11544
|
+
console.log(`[DEBUG] createLicenseHandler: projectId="${projectId}", body.projectId="${body == null ? void 0 : body.projectId}", config.projectId="${config.projectId}"`);
|
|
11516
11545
|
const payload = await LicenseVerifier.verifyAsync(licenseKey, projectId);
|
|
11517
11546
|
return import_server.NextResponse.json({
|
|
11518
11547
|
valid: true,
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -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.3.
|
|
305
|
+
version: "2.3.9",
|
|
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",
|
|
@@ -497,6 +497,7 @@ var init_ConfigFetcher = __esm({
|
|
|
497
497
|
for (const baseUrl of controlPlaneUrls) {
|
|
498
498
|
try {
|
|
499
499
|
const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
|
|
500
|
+
console.log(`[ConfigFetcher] Fetching config from: ${url}`);
|
|
500
501
|
const res = await fetch(url, {
|
|
501
502
|
method: "GET",
|
|
502
503
|
headers: __spreadValues({
|
|
@@ -504,6 +505,10 @@ var init_ConfigFetcher = __esm({
|
|
|
504
505
|
"x-sdk-version": SDK_VERSION
|
|
505
506
|
}, licenseKey ? { "x-license-key": licenseKey } : {})
|
|
506
507
|
});
|
|
508
|
+
console.log(`[ConfigFetcher] Response status: ${res.status}`);
|
|
509
|
+
if (!res.ok) {
|
|
510
|
+
console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
|
|
511
|
+
}
|
|
507
512
|
if (res.ok) {
|
|
508
513
|
const data = await res.json();
|
|
509
514
|
if ((data == null ? void 0 : data.success) && (data == null ? void 0 : data.vectorDb)) {
|
|
@@ -2992,7 +2997,7 @@ function readEnum(env, name, fallback, allowed) {
|
|
|
2992
2997
|
throw new Error(`[getRagConfig] ${name} must be one of: ${allowed.join(", ")}`);
|
|
2993
2998
|
}
|
|
2994
2999
|
function getEnvConfig(env = process.env, base) {
|
|
2995
|
-
var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb;
|
|
3000
|
+
var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib;
|
|
2996
3001
|
const licenseKey = (_d = (_c = (_b = (_a3 = readString(env, "RAG_LICENSE_KEY")) != null ? _a3 : readString(env, "RETRIVORA_LICENSE_KEY")) != null ? _b : readString(env, "NEXT_PUBLIC_RETRIVORA_LICENSE_KEY")) != null ? _c : readString(env, "LICENSE_KEY")) != null ? _d : base == null ? void 0 : base.licenseKey;
|
|
2997
3002
|
const jwtProjectId = (() => {
|
|
2998
3003
|
if (!licenseKey) return void 0;
|
|
@@ -3085,14 +3090,15 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3085
3090
|
})();
|
|
3086
3091
|
const tierBasedLLMModel = isFreeTier2 ? "llama-3.1-8b-instant" : "llama-3.3-70b-versatile";
|
|
3087
3092
|
const tierBasedEmbeddingModel = isFreeTier2 ? "text-embedding-004" : "text-embedding-004";
|
|
3088
|
-
const
|
|
3093
|
+
const controlPlaneUrl = (_qa = readString(env, "RETRIVORA_CONTROL_PLANE_URL")) != null ? _qa : readString(env, "NEXT_PUBLIC_RETRIVORA_CONTROL_PLANE_URL");
|
|
3094
|
+
const defaultGatewayUrl = controlPlaneUrl ? `${controlPlaneUrl.replace(/\/$/, "")}/api/v1` : "https://llm.retrivora.com/api/v1";
|
|
3089
3095
|
const rt = _runtimeConfig;
|
|
3090
3096
|
const defaultLlmProvider = "universal_rest";
|
|
3091
|
-
const llmProvider = (
|
|
3092
|
-
const llmBaseUrl = (
|
|
3093
|
-
const llmModel = (
|
|
3094
|
-
const llmApiKey = (
|
|
3095
|
-
const llmProfile = (
|
|
3097
|
+
const llmProvider = (_ta = (_sa = readEnum(env, "LLM_PROVIDER", defaultLlmProvider, LLM_PROVIDERS)) != null ? _sa : (_ra = base == null ? void 0 : base.llm) == null ? void 0 : _ra.provider) != null ? _ta : defaultLlmProvider;
|
|
3098
|
+
const llmBaseUrl = (_ya = (_xa = (_wa = (_ua = readString(env, "LITELLM_BASE_URL")) != null ? _ua : readString(env, "LLM_BASE_URL")) != null ? _wa : (_va = base == null ? void 0 : base.llm) == null ? void 0 : _va.baseUrl) != null ? _xa : rt == null ? void 0 : rt.llmBaseUrl) != null ? _ya : defaultGatewayUrl;
|
|
3099
|
+
const llmModel = (_Ca = (_Ba = (_Aa = readString(env, "LLM_MODEL")) != null ? _Aa : (_za = base == null ? void 0 : base.llm) == null ? void 0 : _za.model) != null ? _Ba : rt == null ? void 0 : rt.llmModel) != null ? _Ca : tierBasedLLMModel;
|
|
3100
|
+
const llmApiKey = (_Ga = (_Fa = (_Da = readString(env, "LITELLM_MASTER_KEY")) != null ? _Da : rt == null ? void 0 : rt.litellmApiKey) != null ? _Fa : (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.apiKey) != null ? _Ga : licenseKey;
|
|
3101
|
+
const llmProfile = (_Ka = (_Ja = readString(env, "LLM_UNIVERSAL_PROFILE")) != null ? _Ja : (_Ia = (_Ha = base == null ? void 0 : base.llm) == null ? void 0 : _Ha.options) == null ? void 0 : _Ia.profile) != null ? _Ka : "litellm";
|
|
3096
3102
|
console.log("[serverConfig] \u{1F527} LLM Configuration:", {
|
|
3097
3103
|
baseUrl: llmBaseUrl,
|
|
3098
3104
|
model: llmModel,
|
|
@@ -3101,17 +3107,24 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3101
3107
|
source: (rt == null ? void 0 : rt.llmModel) ? "runtime-injected" : "env/fallback"
|
|
3102
3108
|
});
|
|
3103
3109
|
const defaultEmbeddingProvider = "universal_rest";
|
|
3104
|
-
const embeddingProvider = (
|
|
3105
|
-
const embeddingBaseUrl = (_Ta = (_Sa = (_Ra = (
|
|
3106
|
-
const embeddingModel = (
|
|
3107
|
-
const embeddingApiKey = (
|
|
3108
|
-
const embeddingProfile = (
|
|
3110
|
+
const embeddingProvider = (_Na = (_Ma = readEnum(env, "EMBEDDING_PROVIDER", defaultEmbeddingProvider, EMBEDDING_PROVIDERS)) != null ? _Ma : (_La = base == null ? void 0 : base.embedding) == null ? void 0 : _La.provider) != null ? _Na : defaultEmbeddingProvider;
|
|
3111
|
+
const embeddingBaseUrl = (_Ua = (_Ta = (_Sa = (_Ra = (_Pa = (_Oa = readString(env, "LITELLM_BASE_URL")) != null ? _Oa : readString(env, "EMBEDDING_BASE_URL")) != null ? _Pa : readString(env, "LLM_BASE_URL")) != null ? _Ra : (_Qa = base == null ? void 0 : base.embedding) == null ? void 0 : _Qa.baseUrl) != null ? _Sa : rt == null ? void 0 : rt.embeddingBaseUrl) != null ? _Ta : rt == null ? void 0 : rt.llmBaseUrl) != null ? _Ua : defaultGatewayUrl;
|
|
3112
|
+
const embeddingModel = (_Ya = (_Xa = (_Wa = readString(env, "EMBEDDING_MODEL")) != null ? _Wa : (_Va = base == null ? void 0 : base.embedding) == null ? void 0 : _Va.model) != null ? _Xa : rt == null ? void 0 : rt.embeddingModel) != null ? _Ya : tierBasedEmbeddingModel;
|
|
3113
|
+
const embeddingApiKey = (_ab = (_$a = (_Za = readString(env, "LITELLM_MASTER_KEY")) != null ? _Za : rt == null ? void 0 : rt.litellmApiKey) != null ? _$a : (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.apiKey) != null ? _ab : licenseKey;
|
|
3114
|
+
const embeddingProfile = (_eb = (_db = readString(env, "EMBEDDING_UNIVERSAL_PROFILE")) != null ? _db : (_cb = (_bb = base == null ? void 0 : base.embedding) == null ? void 0 : _bb.options) == null ? void 0 : _cb.profile) != null ? _eb : "litellm";
|
|
3115
|
+
console.log("[serverConfig] \u{1F527} Embedding Configuration:", {
|
|
3116
|
+
baseUrl: embeddingBaseUrl,
|
|
3117
|
+
model: embeddingModel,
|
|
3118
|
+
provider: embeddingProvider,
|
|
3119
|
+
hasApiKey: !!embeddingApiKey,
|
|
3120
|
+
source: (rt == null ? void 0 : rt.embeddingModel) ? "runtime-injected" : "env/fallback"
|
|
3121
|
+
});
|
|
3109
3122
|
return __spreadProps(__spreadValues({
|
|
3110
3123
|
projectId,
|
|
3111
3124
|
licenseKey,
|
|
3112
3125
|
vectorDb: {
|
|
3113
3126
|
provider: vectorProvider,
|
|
3114
|
-
indexName: (
|
|
3127
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3115
3128
|
options: vectorDbOptions
|
|
3116
3129
|
},
|
|
3117
3130
|
llm: {
|
|
@@ -3141,30 +3154,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3141
3154
|
}
|
|
3142
3155
|
},
|
|
3143
3156
|
ui: {
|
|
3144
|
-
title: (
|
|
3145
|
-
subtitle: (
|
|
3146
|
-
primaryColor: (
|
|
3147
|
-
accentColor: (
|
|
3148
|
-
logoUrl: (
|
|
3149
|
-
placeholder: (
|
|
3150
|
-
showSources: ((
|
|
3151
|
-
welcomeMessage: (
|
|
3152
|
-
visualStyle: (
|
|
3153
|
-
borderRadius: (
|
|
3154
|
-
allowUpload: ((
|
|
3157
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3158
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3159
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3160
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3161
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3162
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3163
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3164
|
+
welcomeMessage: (_vb = (_ub = readString(env, "NEXT_PUBLIC_WELCOME_MESSAGE")) != null ? _ub : readString(env, "UI_WELCOME_MESSAGE")) != null ? _vb : "Hello! I'm your AI assistant. Ask me anything about your documents.",
|
|
3165
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3166
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3167
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3155
3168
|
},
|
|
3156
3169
|
rag: {
|
|
3157
3170
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3158
3171
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3159
3172
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3160
3173
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3161
|
-
filterableFields: (
|
|
3174
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3162
3175
|
// Query pipeline toggles — read from .env.local
|
|
3163
3176
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3164
3177
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3165
3178
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3166
|
-
architecture: (
|
|
3167
|
-
chunkingStrategy: (
|
|
3179
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3180
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3168
3181
|
uiMapping: (() => {
|
|
3169
3182
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3170
3183
|
if (!raw) return void 0;
|
|
@@ -3177,7 +3190,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3177
3190
|
},
|
|
3178
3191
|
telemetry: {
|
|
3179
3192
|
enabled: telemetryEnabled,
|
|
3180
|
-
url: (
|
|
3193
|
+
url: (_Ib = (_Hb = (_Fb = readString(env, "TELEMETRY_URL")) != null ? _Fb : readString(env, "NEXT_PUBLIC_TELEMETRY_URL")) != null ? _Hb : (_Gb = base == null ? void 0 : base.telemetry) == null ? void 0 : _Gb.url) != null ? _Ib : "https://www.retrivora.com/api/telemetry"
|
|
3181
3194
|
}
|
|
3182
3195
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3183
3196
|
graphDb: {
|
|
@@ -4488,6 +4501,12 @@ var UniversalLLMAdapter = class {
|
|
|
4488
4501
|
this.resolvedHeaders = __spreadValues(__spreadValues({
|
|
4489
4502
|
"Content-Type": "application/json"
|
|
4490
4503
|
}, config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}), this.opts.headers || {});
|
|
4504
|
+
console.log("[UniversalLLMAdapter] Initialized with:", {
|
|
4505
|
+
model: this.model,
|
|
4506
|
+
baseUrl: this.baseUrl,
|
|
4507
|
+
hasApiKey: !!this.apiKey,
|
|
4508
|
+
apiKeyPrefix: this.apiKey ? `${this.apiKey.slice(0, 12)}...` : void 0
|
|
4509
|
+
});
|
|
4491
4510
|
this.http = axios2.create({
|
|
4492
4511
|
baseURL: this.baseUrl,
|
|
4493
4512
|
headers: this.resolvedHeaders,
|
|
@@ -4700,14 +4719,21 @@ ${context != null ? context : "None"}` },
|
|
|
4700
4719
|
});
|
|
4701
4720
|
}
|
|
4702
4721
|
async embed(text) {
|
|
4703
|
-
var _a3, _b, _c, _d, _e, _f, _g2;
|
|
4722
|
+
var _a3, _b, _c, _d, _e, _f, _g2, _h;
|
|
4704
4723
|
const path2 = (_a3 = this.opts.embedPath) != null ? _a3 : "/embeddings";
|
|
4705
4724
|
const payload = this.opts.embedPayloadTemplate ? buildPayload(this.opts.embedPayloadTemplate, { input: text, model: this.model }) : { input: text, model: this.model };
|
|
4706
4725
|
try {
|
|
4726
|
+
console.log(`[UniversalLLMAdapter] Posting to embedding endpoint: ${this.baseUrl}${path2}`, {
|
|
4727
|
+
model: this.model,
|
|
4728
|
+
inputLength: typeof text === "string" ? text.length : "unknown"
|
|
4729
|
+
});
|
|
4707
4730
|
const { data } = await this.http.post(path2, payload);
|
|
4708
4731
|
const extractPath = (_b = this.opts.embedExtractPath) != null ? _b : "data[0].embedding";
|
|
4709
4732
|
const vector = resolvePath(data, extractPath);
|
|
4710
|
-
if (Array.isArray(vector))
|
|
4733
|
+
if (Array.isArray(vector)) {
|
|
4734
|
+
console.log(`[UniversalLLMAdapter] Embedding HTTP request successful. Vector size: ${vector.length}`);
|
|
4735
|
+
return vector;
|
|
4736
|
+
}
|
|
4711
4737
|
console.warn(
|
|
4712
4738
|
`[UniversalLLMAdapter] Embedding API returned unexpected format for path '${extractPath}'. Response:`,
|
|
4713
4739
|
data
|
|
@@ -4715,14 +4741,14 @@ ${context != null ? context : "None"}` },
|
|
|
4715
4741
|
} catch (err) {
|
|
4716
4742
|
console.warn(
|
|
4717
4743
|
`[UniversalLLMAdapter] HTTP embedding request failed: ${(err == null ? void 0 : err.message) || err}`,
|
|
4718
|
-
{ path: path2, model: this.model }
|
|
4744
|
+
{ path: path2, model: this.model, response: (_c = err == null ? void 0 : err.response) == null ? void 0 : _c.data }
|
|
4719
4745
|
);
|
|
4720
4746
|
const _g3 = globalThis;
|
|
4721
4747
|
const dispatchEmbed = _g3.__retrivoraDispatchEmbedding;
|
|
4722
4748
|
if (typeof dispatchEmbed === "function") {
|
|
4723
4749
|
try {
|
|
4724
4750
|
const res = await dispatchEmbed({ input: text, model: this.model }, this.apiKey);
|
|
4725
|
-
if ((
|
|
4751
|
+
if ((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d[0]) == null ? void 0 : _e.embedding) {
|
|
4726
4752
|
return res.data[0].embedding;
|
|
4727
4753
|
}
|
|
4728
4754
|
} catch (dispatchErr) {
|
|
@@ -4731,10 +4757,12 @@ ${context != null ? context : "None"}` },
|
|
|
4731
4757
|
}
|
|
4732
4758
|
}
|
|
4733
4759
|
try {
|
|
4760
|
+
console.log(`[UniversalLLMAdapter] Retrying embedding request to: ${this.baseUrl}${path2}`);
|
|
4734
4761
|
const { data } = await this.http.post(path2, payload);
|
|
4735
|
-
const extractPath = (
|
|
4762
|
+
const extractPath = (_f = this.opts.embedExtractPath) != null ? _f : "data[0].embedding";
|
|
4736
4763
|
const vector = resolvePath(data, extractPath);
|
|
4737
4764
|
if (Array.isArray(vector)) {
|
|
4765
|
+
console.log(`[UniversalLLMAdapter] Retry embedding HTTP request successful. Vector size: ${vector.length}`);
|
|
4738
4766
|
return vector;
|
|
4739
4767
|
}
|
|
4740
4768
|
console.error(
|
|
@@ -4747,7 +4775,7 @@ ${context != null ? context : "None"}` },
|
|
|
4747
4775
|
} catch (err) {
|
|
4748
4776
|
console.error(
|
|
4749
4777
|
`[UniversalLLMAdapter] Both embedding attempts failed. Path: ${path2}, Model: ${this.model}`,
|
|
4750
|
-
{ error: err == null ? void 0 : err.message, statusCode: (
|
|
4778
|
+
{ error: err == null ? void 0 : err.message, statusCode: (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.status, response: (_h = err == null ? void 0 : err.response) == null ? void 0 : _h.data }
|
|
4751
4779
|
);
|
|
4752
4780
|
throw new Error(
|
|
4753
4781
|
`[UniversalLLMAdapter] Failed to generate embedding after 2 attempts: ${(err == null ? void 0 : err.message) || err}`
|
|
@@ -11477,6 +11505,7 @@ function createLicenseHandler(configOrPlugin, options) {
|
|
|
11477
11505
|
const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_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 || "";
|
|
11478
11506
|
const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
|
|
11479
11507
|
const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "";
|
|
11508
|
+
console.log(`[DEBUG] createLicenseHandler: projectId="${projectId}", body.projectId="${body == null ? void 0 : body.projectId}", config.projectId="${config.projectId}"`);
|
|
11480
11509
|
const payload = await LicenseVerifier.verifyAsync(licenseKey, projectId);
|
|
11481
11510
|
return NextResponse.json({
|
|
11482
11511
|
valid: true,
|
package/dist/index.css
CHANGED
|
@@ -2360,11 +2360,6 @@
|
|
|
2360
2360
|
cursor: not-allowed;
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
.disabled\:text-slate-400 {
|
|
2364
|
-
&:disabled {
|
|
2365
|
-
color: var(--color-slate-400);
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
2363
|
.disabled\:opacity-30 {
|
|
2369
2364
|
&:disabled {
|
|
2370
2365
|
opacity: 30%;
|
|
@@ -3578,16 +3573,6 @@
|
|
|
3578
3573
|
}
|
|
3579
3574
|
}
|
|
3580
3575
|
}
|
|
3581
|
-
.dark\:disabled\:text-white\/30 {
|
|
3582
|
-
@media (prefers-color-scheme: dark) {
|
|
3583
|
-
&:disabled {
|
|
3584
|
-
color: color-mix(in srgb, #fff 30%, transparent);
|
|
3585
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
3586
|
-
color: color-mix(in oklab, var(--color-white) 30%, transparent);
|
|
3587
|
-
}
|
|
3588
|
-
}
|
|
3589
|
-
}
|
|
3590
|
-
}
|
|
3591
3576
|
.dark\:disabled\:hover\:text-white\/40 {
|
|
3592
3577
|
@media (prefers-color-scheme: dark) {
|
|
3593
3578
|
&:disabled {
|