@exulu/backend 1.63.0 → 1.63.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/index.cjs CHANGED
@@ -17121,13 +17121,13 @@ ${style.markdown}` : params.prompt;
17121
17121
  redirect: "manual"
17122
17122
  });
17123
17123
  res.status(upstream.status);
17124
- const upstreamOrigin = `http://${host}:${port}`;
17125
17124
  upstream.headers.forEach((value, name) => {
17126
17125
  const lower = name.toLowerCase();
17127
17126
  if (lower === "content-encoding" || lower === "content-length" || lower === "transfer-encoding" || lower === "connection")
17128
17127
  return;
17129
17128
  if (lower === "location") {
17130
- let loc = value.startsWith(upstreamOrigin) ? value.slice(upstreamOrigin.length) : value;
17129
+ const absolute = value.match(/^https?:\/\/[^/]+(\/.*)?$/);
17130
+ let loc = absolute ? absolute[1] ?? "/" : value;
17131
17131
  if (loc.startsWith("/") && loc !== litellmUiPath && !loc.startsWith(`${litellmUiPath}/`)) {
17132
17132
  loc = `${litellmUiPath}${loc}`;
17133
17133
  }
@@ -23470,9 +23470,20 @@ var initLiteLLMDatabase = async (packageRoot) => {
23470
23470
  }
23471
23471
  const venvBin = (0, import_node_path8.resolve)(packageRoot, "ee/python/.venv/bin");
23472
23472
  const prismaCli = (0, import_node_path8.resolve)(venvBin, "prisma");
23473
+ const venvLibDir = (0, import_node_path8.resolve)(packageRoot, "ee/python/.venv/lib");
23474
+ const pythonVersionDir = (0, import_node_fs7.existsSync)(venvLibDir) ? (0, import_node_fs7.readdirSync)(venvLibDir).find((entry) => /^python3\.\d+$/.test(entry)) : void 0;
23475
+ if (!pythonVersionDir) {
23476
+ warn([
23477
+ `Could not find a python3.* directory under ${venvLibDir}.`,
23478
+ `Run \`npm run python:setup\` to create the venv.`,
23479
+ `Skipping LiteLLM database setup.`
23480
+ ]);
23481
+ return;
23482
+ }
23473
23483
  const litellmProxyDir = (0, import_node_path8.resolve)(
23474
- packageRoot,
23475
- "ee/python/.venv/lib/python3.12/site-packages/litellm/proxy"
23484
+ venvLibDir,
23485
+ pythonVersionDir,
23486
+ "site-packages/litellm/proxy"
23476
23487
  );
23477
23488
  const schemaPath = (0, import_node_path8.resolve)(litellmProxyDir, "schema.prisma");
23478
23489
  if (!(0, import_node_fs7.existsSync)(prismaCli)) {
package/dist/index.js CHANGED
@@ -9117,13 +9117,13 @@ ${style.markdown}` : params.prompt;
9117
9117
  redirect: "manual"
9118
9118
  });
9119
9119
  res.status(upstream.status);
9120
- const upstreamOrigin = `http://${host}:${port}`;
9121
9120
  upstream.headers.forEach((value, name) => {
9122
9121
  const lower = name.toLowerCase();
9123
9122
  if (lower === "content-encoding" || lower === "content-length" || lower === "transfer-encoding" || lower === "connection")
9124
9123
  return;
9125
9124
  if (lower === "location") {
9126
- let loc = value.startsWith(upstreamOrigin) ? value.slice(upstreamOrigin.length) : value;
9125
+ const absolute = value.match(/^https?:\/\/[^/]+(\/.*)?$/);
9126
+ let loc = absolute ? absolute[1] ?? "/" : value;
9127
9127
  if (loc.startsWith("/") && loc !== litellmUiPath && !loc.startsWith(`${litellmUiPath}/`)) {
9128
9128
  loc = `${litellmUiPath}${loc}`;
9129
9129
  }
@@ -14947,7 +14947,7 @@ var execute = async ({ contexts }) => {
14947
14947
  };
14948
14948
 
14949
14949
  // src/exulu/litellm/db-init.ts
14950
- import { existsSync as existsSync4 } from "fs";
14950
+ import { existsSync as existsSync4, readdirSync } from "fs";
14951
14951
  import { resolve as resolve2 } from "path";
14952
14952
  import { spawnSync } from "child_process";
14953
14953
  import { Client } from "pg";
@@ -15157,9 +15157,20 @@ var initLiteLLMDatabase = async (packageRoot) => {
15157
15157
  }
15158
15158
  const venvBin = resolve2(packageRoot, "ee/python/.venv/bin");
15159
15159
  const prismaCli = resolve2(venvBin, "prisma");
15160
+ const venvLibDir = resolve2(packageRoot, "ee/python/.venv/lib");
15161
+ const pythonVersionDir = existsSync4(venvLibDir) ? readdirSync(venvLibDir).find((entry) => /^python3\.\d+$/.test(entry)) : void 0;
15162
+ if (!pythonVersionDir) {
15163
+ warn([
15164
+ `Could not find a python3.* directory under ${venvLibDir}.`,
15165
+ `Run \`npm run python:setup\` to create the venv.`,
15166
+ `Skipping LiteLLM database setup.`
15167
+ ]);
15168
+ return;
15169
+ }
15160
15170
  const litellmProxyDir = resolve2(
15161
- packageRoot,
15162
- "ee/python/.venv/lib/python3.12/site-packages/litellm/proxy"
15171
+ venvLibDir,
15172
+ pythonVersionDir,
15173
+ "site-packages/litellm/proxy"
15163
15174
  );
15164
15175
  const schemaPath = resolve2(litellmProxyDir, "schema.prisma");
15165
15176
  if (!existsSync4(prismaCli)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu Bv.",
4
- "version": "1.63.0",
4
+ "version": "1.63.2",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {