Skip to content

Commit df1dfa7

Browse files
authoredDec 11, 2023
refactor: Use librechat-data-provider app-wide 🔄 (danny-avila#1326)
* chore: bump vite, vitejs/plugin-react, mark client package as esm, move react-query as a peer dep in data-provider * chore: import changes due to new data-provider export strategy, also fix type imports where applicable * chore: export react-query services as separate to avoid react dependencies in /api/ * chore: suppress sourcemap warnings and polyfill node:path which is used by filenamify TODO: replace filenamify with an alternative and REMOVE polyfill * chore: /api/ changes to support `librechat-data-provider` * refactor: rewrite Dockerfile.multi in light of /api/ changes to support `librechat-data-provider` * chore: remove volume mapping to node_modules directories in default compose file * chore: remove schemas from /api/ as is no longer needed with use of `librechat-data-provider` * fix(ci): jest `librechat-data-provider/react-query` module resolution
1 parent d4c846b commit df1dfa7

File tree

97 files changed

+1830
-1342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1830
-1342
lines changed
 

‎Dockerfile.multi

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
# Build API, Client and Data Provider
2-
FROM node:19-alpine AS base
2+
FROM node:20-alpine AS base
33

4-
# WORKDIR /app
5-
# COPY config/loader.js ./config/
6-
# RUN touch .env
7-
# RUN npm install dotenv
8-
9-
WORKDIR /app/api
10-
COPY api/package*.json ./
11-
COPY api/ ./
12-
RUN touch .env
4+
# Build data-provider
5+
FROM base AS data-provider-build
6+
WORKDIR /app/packages/data-provider
7+
COPY ./packages/data-provider ./
138
RUN npm install
9+
RUN npm run build
1410

1511
# React client build
16-
FROM base AS client-build
12+
FROM data-provider-build AS client-build
1713
WORKDIR /app/client
1814
COPY ./client/ ./
19-
20-
WORKDIR /app/packages/data-provider
21-
COPY ./packages/data-provider ./
22-
RUN npm install
23-
RUN npm run build
15+
# Copy data-provider to client's node_modules
2416
RUN mkdir -p /app/client/node_modules/librechat-data-provider/
2517
RUN cp -R /app/packages/data-provider/* /app/client/node_modules/librechat-data-provider/
26-
27-
WORKDIR /app/client
2818
RUN npm install
2919
ENV NODE_OPTIONS="--max-old-space-size=2048"
3020
RUN npm run build
3121

3222
# Node API setup
33-
FROM base AS api-build
23+
FROM data-provider-build AS api-build
24+
WORKDIR /app/api
25+
COPY api/package*.json ./
26+
COPY api/ ./
27+
# Copy data-provider to API's node_modules
28+
RUN mkdir -p /app/api/node_modules/librechat-data-provider/
29+
RUN cp -R /app/packages/data-provider/* /app/api/node_modules/librechat-data-provider/
30+
RUN npm install
3431
COPY --from=client-build /app/client/dist /app/client/dist
3532
EXPOSE 3080
3633
ENV HOST=0.0.0.0

‎api/app/clients/AnthropicClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const Anthropic = require('@anthropic-ai/sdk');
22
const { encoding_for_model: encodingForModel, get_encoding: getEncoding } = require('tiktoken');
3-
const { getResponseSender, EModelEndpoint } = require('~/server/services/Endpoints');
3+
const { getResponseSender, EModelEndpoint } = require('librechat-data-provider');
44
const { getModelMaxTokens } = require('~/utils');
55
const BaseClient = require('./BaseClient');
66

0 commit comments

Comments
 (0)
Please sign in to comment.