librechat: init at 0.7.7

This commit is contained in:
Niklas Korz 2025-03-25 17:52:11 +01:00
parent 317793389a
commit c41f259917
4 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,20 @@
diff --git a/package.json b/package.json
index 2131951..91e4846 100644
--- a/package.json
+++ b/package.json
@@ -114,5 +114,15 @@
"admin/",
"packages/"
]
+ },
+ "files": [
+ "api",
+ "client/dist",
+ "packages/data-provider",
+ "packages/data-schemas",
+ "packages/mcp"
+ ],
+ "bin": {
+ "librechat-server": "api/server/index.js"
}
}

View File

@ -0,0 +1,26 @@
diff --git a/api/config/meiliLogger.js b/api/config/meiliLogger.js
index 195b387..d445e54 100644
--- a/api/config/meiliLogger.js
+++ b/api/config/meiliLogger.js
@@ -2,7 +2,7 @@ const path = require('path');
const winston = require('winston');
require('winston-daily-rotate-file');
-const logDir = path.join(__dirname, '..', 'logs');
+const logDir = path.join('.', 'logs');
const { NODE_ENV } = process.env;
diff --git a/api/config/winston.js b/api/config/winston.js
index 8f51b99..2ebd041 100644
--- a/api/config/winston.js
+++ b/api/config/winston.js
@@ -3,7 +3,7 @@ const winston = require('winston');
require('winston-daily-rotate-file');
const { redactFormat, redactMessage, debugTraverse, jsonTruncateFormat } = require('./parsers');
-const logDir = path.join(__dirname, '..', 'logs');
+const logDir = path.join('.', 'logs');
const { NODE_ENV, DEBUG_LOGGING = true, DEBUG_CONSOLE = false, CONSOLE_JSON = false } = process.env;

View File

@ -0,0 +1,20 @@
diff --git a/api/config/paths.js b/api/config/paths.js
index 165e9e6..fc85083 100644
--- a/api/config/paths.js
+++ b/api/config/paths.js
@@ -2,13 +2,13 @@ const path = require('path');
module.exports = {
root: path.resolve(__dirname, '..', '..'),
- uploads: path.resolve(__dirname, '..', '..', 'uploads'),
+ uploads: path.resolve('.', 'uploads'),
clientPath: path.resolve(__dirname, '..', '..', 'client'),
dist: path.resolve(__dirname, '..', '..', 'client', 'dist'),
publicPath: path.resolve(__dirname, '..', '..', 'client', 'public'),
fonts: path.resolve(__dirname, '..', '..', 'client', 'public', 'fonts'),
assets: path.resolve(__dirname, '..', '..', 'client', 'public', 'assets'),
- imageOutput: path.resolve(__dirname, '..', '..', 'client', 'public', 'images'),
+ imageOutput: path.resolve('.', 'images'),
structuredTools: path.resolve(__dirname, '..', 'app', 'clients', 'tools', 'structured'),
pluginManifest: path.resolve(__dirname, '..', 'app', 'clients', 'tools', 'manifest.json'),
};

View File

@ -0,0 +1,73 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
pkg-config,
node-gyp,
vips,
nix-update-script,
}:
buildNpmPackage rec {
pname = "librechat";
version = "0.7.7";
src = fetchFromGitHub {
owner = "danny-avila";
repo = "LibreChat";
tag = "v${version}";
hash = "sha256-U0yIoJt7wE4a7WbryN7hheLRFTRVol5qawIrmKte41M=";
};
patches = [
# `buildNpmPackage` relies on `npm pack`, which only includes files explicitly
# listed in the project's package.json `files` array if this property is set.
# LibreChat does not set this property, but we can avoid packaging the whole
# workspace by simply adding the relevant paths here ourselves.
# Also, we set the `bin` property to the server script to benefit from the
# auto-generated wrapper.
./0001-npm-pack.patch
# LibreChat tries writing logs to the package directory, which is immutable
# in our case. We patch the log directory to target the current working directory
# instead, which in case of NixOS will be the service's data directory.
./0002-logs.patch
# Similarly to the logs, user uploads are by default written to the package
# directory as well. Again, we patch this to be relative to the current working
# directory instead.
./0003-upload-paths.patch
];
npmDepsHash = "sha256-r06Hcdxa7pYMqIvNWP4VclJ4woiPd9kJxEmQO88i8J8=";
nativeBuildInputs = [
pkg-config
node-gyp
];
buildInputs = [
vips
];
# required for sharp
makeCacheWritable = true;
npmBuildScript = "frontend";
npmPruneFlags = [ "--omit=dev" ];
passthru = {
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"^v(\\d+\\.\\d+\\.\\d+)$"
];
};
};
meta = {
description = "Open-source app for all your AI conversations, fully customizable and compatible with any AI provider";
homepage = "https://github.com/danny-avila/LibreChat";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ niklaskorz ];
mainProgram = "librechat-server";
};
}