Skip to content

Commit b49f963

Browse files
paychex-ssmithrandfuegoviceburnettedanny-avilaberry-13
authored
Merge upstream (#9)
* documentation update: mongodb (danny-avila#1347) * update dotenv.md add details about the MONGO_URI connection string format * update mongodb.md add details about the MONGO_URI connection string format * chore: Get the latest of all github actions (danny-avila#1335) * refactor(api): Central Logging 📜 (danny-avila#1348) * WIP: initial logging changes add several transports in ~/config/winston omit messages in logs, truncate long strings add short blurb in dotenv for debug logging GoogleClient: using logger OpenAIClient: using logger, handleOpenAIErrors Adding typedef for payload message bumped winston and using winston-daily-rotate-file moved config for server paths to ~/config dir Added `DEBUG_LOGGING=true` to .env.example * WIP: Refactor logging statements in code * WIP: Refactor logging statements and import configurations * WIP: Refactor logging statements and import configurations * refactor: broadcast Redis initialization message with `info` not `debug` * refactor: complete Refactor logging statements and import configurations * chore: delete unused tools * fix: circular dependencies due to accessing logger * refactor(handleText): handle booleans and write tests * refactor: redact sensitive values, better formatting * chore: improve log formatting, avoid passing strings to 2nd arg * fix(ci): fix jest tests due to logger changes * refactor(getAvailablePluginsController): cache plugins as they are static and avoids async addOpenAPISpecs call every time * chore: update docs * chore: update docs * chore: create separate meiliSync logger, clean up logs to avoid being unnecessarily verbose * chore: spread objects where they are commonly logged to allow string truncation * chore: improve error log formatting * fix: Add error handling for missing role in OpenAIClient.js (danny-avila#1352) * feat: Google Gemini ❇️ (danny-avila#1355) * refactor: add gemini-pro to google Models list; use defaultModels for central model listing * refactor(SetKeyDialog): create useMultipleKeys hook to use for Azure, export `isJson` from utils, use EModelEndpoint * refactor(useUserKey): change variable names to make keyName setting more clear * refactor(FileUpload): allow passing container className string * feat(GoogleClient): Gemini support * refactor(GoogleClient): alternate stream speed for Gemini models * feat(Gemini): styling/settings configuration for Gemini * refactor(GoogleClient): substract max response tokens from max context tokens if context is above 32k (I/O max is combined between the two) * refactor(tokens): correct google max token counts and subtract max response tokens when input/output count are combined towards max context count * feat(google/initializeClient): handle both local and user_provided credentials and write tests * fix(GoogleClient): catch if credentials are undefined, handle if serviceKey is string or object correctly, handle no examples passed, throw error if not a Generative Language model and no service account JSON key is provided, throw error if it is a Generative m odel, but not google API key was provided * refactor(loadAsyncEndpoints/google): activate Google endpoint if either the service key JSON file is provided in /api/data, or a GOOGLE_KEY is defined. * docs: updated Google configuration * fix(ci): Mock import of Service Account Key JSON file (auth.json) * Update apis_and_tokens.md * feat: increase max output tokens slider for gemini pro * refactor(GoogleSettings): handle max and default maxOutputTokens on model change * chore: add sensitive redact regex * docs: add warning about data privacy * Update apis_and_tokens.md * fix: Avoid Throwing Errors for Unsupported Token Count Endpoints 🪙 (danny-avila#1356) * update: docker-compose.yaml 🐋 (danny-avila#1341) * fix: Enhance Test Coverage and Fix Compatibility Issues 👷‍♂️ (danny-avila#1363) * refactor: only remove conversation states from localStorage on login/logout but not on refresh * chore: add debugging log for azure completion url * chore: add api-key to redact regex * fix: do not show endpoint selector if endpoint is falsy * chore: remove logger from genAzureChatCompletion * feat(ci): mock fetchEventSource * refactor(ci): mock all model methods in BaseClient.test, as well as mock the implementation for getCompletion in FakeClient * fix(OpenAIClient): consider chatCompletion if model name includes `gpt` as opposed to `gpt-` * fix(ChatGPTClient/azureOpenAI): Remove 'model' option for Azure compatibility (cannot be sent in payload body) * feat(ci): write new test suite that significantly increase test coverage for OpenAIClient and BaseClient by covering most of the real implementation of the `sendMessage` method - test for the azure edge case where model option is appended to modelOptions, ensuring removal before sent to the azure endpoint - test for expected azure url being passed to SSE POST request - test for AZURE_OPENAI_DEFAULT_MODEL being set, but is not included in the URL deployment name as expected - test getCompletion method to have correct payload fix(ci/OpenAIClient.test.js): correctly mock hanging/async methods * refactor(addTitle): allow azure to title as it aborts signal on completion * 🔄 refactor: Consolidate Ask/Edit Controllers (danny-avila#1365) * refactor(Ask/Edit): consolidate ask/edit controllers between the main modules and openAI controllers to reduce repetition of code and increase reusability * fix(winston/logger): circular dependency issue * fix(config/scripts): fix script imports * refactor(indexSync): make not configured message an info log message * chore: create a rollup script for api/server/index.js to check circular dependencies * chore: bump @keyv/redis * Update package.json * 🍏Update mac_install.md (danny-avila#1373) The manual installation guide for mac was very outdated. This brings it up to date with the current method * 📸 feat: Gemini vision, Improved Logs and Multi-modal Handling (danny-avila#1368) * feat: add GOOGLE_MODELS env var * feat: add gemini vision support * refactor(GoogleClient): adjust clientOptions handling depending on model * fix(logger): fix redact logic and redact errors only * fix(GoogleClient): do not allow non-multiModal messages when gemini-pro-vision is selected * refactor(OpenAIClient): use `isVisionModel` client property to avoid calling validateVisionModel multiple times * refactor: better debug logging by correctly traversing, redacting sensitive info, and logging condensed versions of long values * refactor(GoogleClient): allow response errors to be thrown/caught above client handling so user receives meaningful error message debug orderedMessages, parentMessageId, and buildMessages result * refactor(AskController): use model from client.modelOptions.model when saving intermediate messages, which requires for the progress callback to be initialized after the client is initialized * feat(useSSE): revert to previous model if the model was auto-switched by backend due to message attachments * docs: update with google updates, notes about Gemini Pro Vision * fix: redis should not be initialized without USE_REDIS and increase max listeners to 20 * fix: revert `fonts` resolution path in vite.config.ts * 🚩 fix: Initialize Conversation Only when Necessary Data is Fetched (danny-avila#1379) * fix(ChatRoute): only initialize conversation after all data is fetched (models, endpoints, initialConversationQuery if not `new`) * chore: remove unnecessary packages for rolling up api * chore: bump data-provider package.json * ✨ feat: Azure Vision Support & Docs Update (danny-avila#1389) * feat(AzureOpenAI): Vision Support * chore(ci/OpenAIClient.test): update test to reflect Azure now uses chatCompletion method as opposed to getCompletion, while still testing the latter method * docs: update documentation mainly revolving around Azure setup, but also reformatting the 'Tokens and API' section completely * docs: add images and links to ai_setup.md * docs: ai setup reference * ✨ Release v0.6.5 (danny-avila#1391) * ✨ Release v0.6.5 * fix(ci): use dynamic currentDateString * Update pull_request_template.md (danny-avila#1417) * 🧹📚 docs: refactor and clean up (danny-avila#1392) * 📑 update mkdocs * rename docker override file and add to gitignore * update .env.example - GOOGLE_MODELS * update index.md * doc refactor: split installation and configuration in two sub-folders * doc update: installation guides * doc update: configuration guides * doc: new docker override guide * doc: new beginner's guide for contributions - Thanks @berry-13 * doc: update documentation_guidelines.md * doc: update testing.md * doc: update deployment guides * doc: update /dev readme * doc: update general_info * doc: add 0 value to doc weight * doc: add index.md to every doc folders * doc: add weight to index.md and move openrouter from free_ai_apis.md to ai_setup.md * doc: update toc so they display properly on the right had side in mkdocs * doc: update pandoranext.md * doc: index logging_system.md * doc: update readme.md * doc: update litellm.md * doc: update ./dev/readme.md * doc:🔖 new presets.md * doc: minor corrections * doc update: user_auth_system.md and presets.md, doc feat: add mermaid support to mkdocs * doc update: add screenshots to presets.md * doc update: add screenshots to - OpenID with AWS Cognito * doc update: BingAI cookie instruction * doc update: discord auth * doc update: facebook auth * doc: corrections to user_auth_system.md * doc update: github auth * doc update: google auth * doc update: auth clean up * doc organization: installation * doc organization: configuration * doc organization: features+plugins & update:plugins screenshots * doc organization: deploymend + general_info & update: tech_stack.md * doc organization: contributions * doc: minor fixes * doc: minor fixes * Update French Translation (danny-avila#1444) * 🪪mkdocs: social cards (danny-avila#1428) * mkdocs plugins: add plugin for social cards and plugin that allow to exclude a folder * docs: fix hyperlinks * mkdocs: social cards (descriptions) for 'contributions' and 'deployment' guides * mkdocs: social cards (descriptions) for all 'index.md' * mkdocs: social cards (descriptions) for 'features' and 'plugins' * mkdocs: social cards (descriptions) for 'general_info' * mkdocs: social cards (descriptions) for 'configuration' * mkdocs: social cards (descriptions) for 'installation' * mkdocs: minor fixes * update librechat.svg * update how_to_contribute.md add reference to the official GitHub documentation * 🌎: Italian translation update & refactor: translations (danny-avila#1414) * italian translation update * fix: removed some translations * refactor(Translation) * feat: allow FWA (danny-avila#1440) * 🌎: Update Russian translations (danny-avila#1413) * Update Russian localization * Update Ru.tsx * fix: russian translation typing errors * 🐛 fix: Prevent Unnecessary Cloning of Symbols in Log Object (danny-avila#1455) fix(api/config/parsers): prevent cloning of unnecessary symbols within log object by using `klona` instead of `klona/full`, handle symbols edge case, log parsing errors, and use spaces instead of tab for cleaner logs * 🚫🔍 feat: disallow search indexing (danny-avila#1409) * feat: disallow search indexing * Update index.js * Update .env.example * added middleware * 🔥🚀 feat: CDN (Firebase) & feat: account section (danny-avila#1438) * localization + api-endpoint * docs: added firebase documentation * chore: icons * chore: SettingsTabs * feat: account pannel; fix: gear icons * docs: position update * feat: firebase * feat: plugin support * route * fixed bugs with firebase and moved a lot of files * chore(DALLE3): using UUID v4 * feat: support for social strategies; moved '/images' path * fix: data ignored * gitignore update * docs: update firebase guide * refactor: Firebase - use singleton pattern for firebase initialization, initially on server start - reorganize imports, move firebase specific files to own service under Files - rename modules to remove 'avatar' redundancy - fix imports based on changes * ci(DALLE/DALLE3): fix tests to use logger and new expected outputs, add firebase tests * refactor(loadToolWithAuth): pass userId to tool as field * feat(images/parse): feat: Add URL Image Basename Extraction Implement a new module to extract the basename of an image from a given URL. This addition includes the function, which parses the URL and retrieves the basename using the Node.js 'url' and 'path' modules. The function is documented with JSDoc comments for better maintainability and understanding. This feature enhances the application's ability to handle and process image URLs efficiently. * refactor(addImages): function to use a more specific regular expression for observedImagePath based on the generated image markdown standard across the app * refactor(DALLE/DALLE3): utilize `getImageBasename` and `this.userId`; fix: pass correct image path to firebase url helper * fix(addImages): make more general to match any image markdown descriptor * fix(parse/getImageBasename): test result of this function for an actual image basename * ci(DALLE3): mock getImageBasename * refactor(AuthContext): use Recoil atom state for user * feat: useUploadAvatarMutation, react-query hook for avatar upload * fix(Toast): stack z-order of Toast over all components (1000) * refactor(showToast): add optional status field to avoid importing NotificationSeverity on each use of the function * refactor(routes/avatar): remove unnecessary get route, get userId from req.user.id, require auth on POST request * chore(uploadAvatar): TODO: remove direct use of Model, `User` * fix(client): fix Spinner imports * refactor(Avatar): use react-query hook, Toast, remove unnecessary states, add optimistic UI to upload * fix(avatar/localStrategy): correctly save local profile picture and cache bust for immediate rendering; fix: firebase init info message (only show once) * fix: use `includes` instead of `endsWith` for checking manual query of avatar image path in case more queries are appended (as is done in avatar/localStrategy) --------- Co-authored-by: Danny Avila <[email protected]> * 🧹fix: Handle Abort Message Edge Cases (danny-avila#1462) * chore: bump langchain to v0.0.213 from v0.0.186 * fix: handle abort edge cases: - abort message server-side if response experienced error mid-generation - attempt to recover message if aborting resulted in error - if abortKey is not provided, use conversationId if it exists - if headers were already sent, send an Event stream message - issue warning for possible Google censor/filter refactor(streamResponse): for `sendError`, allow passing overrides so that error can include partial generation, improve typing for `sendMessage` * chore(MessageContent): remove eslint warning for unused `i`, rephrase unfinished message text * fix(useSSE): avoid invoking cancelHandler if the abort response was 404 * chore(TMessage): remove unnecessary, unused legacy message property `submitting` * chore(TMessage): remove unnecessary legacy message property `cancelled` * chore(abortMiddleware): remove unused `errorText` property to avoid confusion * doc update: firebase.md (danny-avila#1456) * 📃 feat: add `list-balances`, `remove-user`, and improve User scripts (danny-avila#1418) * Refactoring opening of DB to config/helpers.js * Adding two user scripts: - 'delete-user' to remove a user definitely - 'list-balances' to show the balances of all the users * Add Russian translation for the new functionality in the settings (danny-avila#1457) * 🛠️ fix: Minor Fixes in `Message`, `Ask/EditController`, `OpenAIClient`, and `countTokens` (danny-avila#1463) * fix(Message): avoid overwriting unprovided properties * fix(OpenAIClient): return intermediateReply on user abort * fix(AskController): do not send/save final message if abort was triggered * fix(countTokens): avoid fetching remote registry and exclusively use cl100k_base or p50k_base weights for token counting * refactor(Message/messageSchema): rely on messageSchema for default values when saving messages * fix(EditController): do not send/save final message if abort was triggered * fix(config/helpers): fix module resolution error * update pull_request_template.md (danny-avila#1466) add "Translation update" the the PR type choices * 🌎: Update French Translation (danny-avila#1472) * 🌎: Update French Translation * 🌎: Update French Translation * 🌎: Update French Translation * 🌎: Update French Translation * 🌎: Update Portuguese Translation (danny-avila#1461) * 👮feat: moderation text (danny-avila#1388) * fixed some bugs and handling errors better * feat: plugins support * fix: prettier error message * moved circular-json-es6 in /api * docs: added openai moderation text * fix(gptPlugins): incorrect merge * discarding changes * removed circular-json-es6 * fix(OpenAIClient): do not invoke abortCompletion on completion error (danny-avila#1473) * Update dev-images.yml * Update backend-review.yml --------- Co-authored-by: Fuegovic <[email protected]> Co-authored-by: Ed Burnette <[email protected]> Co-authored-by: Danny Avila <[email protected]> Co-authored-by: Marco Beretta <[email protected]> Co-authored-by: Nikita Dybov <[email protected]> Co-authored-by: Danny Avila <[email protected]> Co-authored-by: Linus Gasser <[email protected]> Co-authored-by: MACHINSOFT <[email protected]> Co-authored-by: Raí Santos <[email protected]>
1 parent e82b3a3 commit b49f963

File tree

306 files changed

+10481
-5714
lines changed

Some content is hidden

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

306 files changed

+10481
-5714
lines changed

.env.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ MONGO_URI=mongodb://127.0.0.1:27017/LibreChat
2424
DOMAIN_CLIENT=http://localhost:3080
2525
DOMAIN_SERVER=http://localhost:3080
2626

27+
NO_INDEX=true
28+
29+
#===============#
30+
# Debug Logging #
31+
#===============#
32+
33+
DEBUG_LOGGING=true
34+
DEBUG_CONSOLE=false
35+
2736
#=============#
2837
# Permissions #
2938
#=============#
@@ -84,6 +93,7 @@ CHATGPT_MODELS=text-davinci-002-render-sha
8493
#============#
8594

8695
GOOGLE_KEY=user_provided
96+
# GOOGLE_MODELS=gemini-pro,gemini-pro-vision,chat-bison,chat-bison-32k,codechat-bison,codechat-bison-32k,text-bison,text-bison-32k,text-unicorn,code-gecko,code-bison,code-bison-32k
8797
# GOOGLE_REVERSE_PROXY=
8898

8999
#============#
@@ -178,6 +188,10 @@ MEILI_MASTER_KEY=DrhYf7zENyR6AlUCKmnz0eYASOQdl6zxH7s7MKFSfFCt
178188
# Moderation #
179189
#========================#
180190

191+
OPENAI_MODERATION=false
192+
OPENAI_MODERATION_API_KEY=
193+
# OPENAI_MODERATION_REVERSE_PROXY=not working with some reverse proxys
194+
181195
BAN_VIOLATIONS=true
182196
BAN_DURATION=1000 * 60 * 60 * 2
183197
BAN_INTERVAL=20
@@ -271,6 +285,17 @@ EMAIL_PASSWORD=
271285
EMAIL_FROM_NAME=
272286
273287

288+
#========================#
289+
# Firebase CDN #
290+
#========================#
291+
292+
FIREBASE_API_KEY=
293+
FIREBASE_AUTH_DOMAIN=
294+
FIREBASE_PROJECT_ID=
295+
FIREBASE_STORAGE_BUCKET=
296+
FIREBASE_MESSAGING_SENDER_ID=
297+
FIREBASE_APP_ID=
298+
274299
#==================================================#
275300
# Others #
276301
#==================================================#

.github/playwright.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
# PLAYWRIGHT_BROWSERS_PATH: 0 # Places binaries to node_modules/@playwright/test
3737
# TITLE_CONVO: false
3838
# steps:
39-
# - uses: actions/checkout@v3
40-
# - uses: actions/setup-node@v3
39+
# - uses: actions/checkout@v4
40+
# - uses: actions/setup-node@v4
4141
# with:
4242
# node-version: 18
4343
# cache: 'npm'

.github/pull_request_template.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Pull Request Template
22

33

4-
### ⚠️ Before Submitting a PR, read the [Contributing Docs](./CONTRIBUTING.md) in full!
4+
### ⚠️ Before Submitting a PR, read the [Contributing Docs](https://github.com/danny-avila/LibreChat/blob/main/.github/CONTRIBUTING.md) in full!
55

66
## Summary
77

@@ -15,7 +15,8 @@ Please delete any irrelevant options.
1515
- [ ] New feature (non-breaking change which adds functionality)
1616
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1717
- [ ] This change requires a documentation update
18-
- [ ] Documentation update
18+
- [ ] Documentation update
19+
- [ ] Translation update
1920

2021
## Testing
2122

.github/workflows/backend-review.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Backend Unit Tests
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
tests_Backend:
7+
name: Run Backend unit tests
8+
timeout-minutes: 60
9+
runs-on: ubuntu-latest
10+
env:
11+
MONGO_URI: ${{ secrets.MONGO_URI }}
12+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
13+
JWT_SECRET: ${{ secrets.JWT_SECRET }}
14+
CREDS_KEY: ${{ secrets.CREDS_KEY }}
15+
CREDS_IV: ${{ secrets.CREDS_IV }}
16+
BAN_VIOLATIONS: ${{ secrets.BAN_VIOLATIONS }}
17+
BAN_DURATION: ${{ secrets.BAN_DURATION }}
18+
BAN_INTERVAL: ${{ secrets.BAN_INTERVAL }}
19+
NODE_ENV: CI
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Use Node.js 20.x
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Install Data Provider
32+
run: npm run build:data-provider
33+
34+
- name: Run unit tests
35+
run: cd api && npm run test:ci
36+
37+
- name: Run linters
38+
uses: wearerequired/lint-action@v2
39+
with:
40+
eslint: true

.github/workflows/container.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Docker Compose Build on Tag
2+
3+
# The workflow is triggered when a tag is pushed
4+
on:
5+
push:
6+
tags:
7+
- "*"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Check out the repository
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
# Set up Docker
19+
- name: Set up Docker
20+
uses: docker/setup-buildx-action@v3
21+
22+
# Log in to GitHub Container Registry
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v2
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
# Run docker-compose build
31+
- name: Build Docker images
32+
run: |
33+
cp .env.example .env
34+
docker-compose build
35+
docker build -f Dockerfile.multi --target api-build -t librechat-api .
36+
37+
# Get Tag Name
38+
- name: Get Tag Name
39+
id: tag_name
40+
run: echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
41+
42+
# Tag it properly before push to github
43+
- name: tag image and push
44+
run: |
45+
docker tag librechat:latest ghcr.io/${{ github.repository_owner }}/librechat:${{ env.TAG_NAME }}
46+
docker push ghcr.io/${{ github.repository_owner }}/librechat:${{ env.TAG_NAME }}
47+
docker tag librechat:latest ghcr.io/${{ github.repository_owner }}/librechat:latest
48+
docker push ghcr.io/${{ github.repository_owner }}/librechat:latest
49+
docker tag librechat-api:latest ghcr.io/${{ github.repository_owner }}/librechat-api:${{ env.TAG_NAME }}
50+
docker push ghcr.io/${{ github.repository_owner }}/librechat-api:${{ env.TAG_NAME }}
51+
docker tag librechat-api:latest ghcr.io/${{ github.repository_owner }}/librechat-api:latest
52+
docker push ghcr.io/${{ github.repository_owner }}/librechat-api:latest

.github/workflows/data-provider.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Node.js Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/data-provider/package.json'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 16
18+
- run: cd packages/data-provider && npm ci
19+
- run: cd packages/data-provider && npm run build
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 16
29+
registry-url: 'https://registry.npmjs.org'
30+
- run: cd packages/data-provider && npm ci
31+
- run: cd packages/data-provider && npm run build
32+
- run: cd packages/data-provider && npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/deploy.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy_GHRunner_Linux_ACI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
RUNNER_VERSION: 2.293.0
8+
ACI_RESOURCE_GROUP: 'Demo-ACI-GitHub-Runners-RG'
9+
ACI_NAME: 'gh-runner-linux-01'
10+
DNS_NAME_LABEL: 'gh-lin-01'
11+
GH_OWNER: ${{ github.repository_owner }}
12+
GH_REPOSITORY: 'LibreChat' #Change here to deploy self hosted runner ACI to another repo.
13+
14+
jobs:
15+
deploy-gh-runner-aci:
16+
runs-on: ubuntu-latest
17+
steps:
18+
# checkout the repo
19+
- name: 'Checkout GitHub Action'
20+
uses: actions/checkout@v4
21+
22+
- name: 'Login via Azure CLI'
23+
uses: azure/login@v1
24+
with:
25+
creds: ${{ secrets.AZURE_CREDENTIALS }}
26+
27+
- name: 'Deploy to Azure Container Instances'
28+
uses: 'azure/aci-deploy@v1'
29+
with:
30+
resource-group: ${{ env.ACI_RESOURCE_GROUP }}
31+
image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/pwd9000-github-runner-lin:${{ env.RUNNER_VERSION }}
32+
registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
33+
registry-username: ${{ secrets.REGISTRY_USERNAME }}
34+
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
35+
name: ${{ env.ACI_NAME }}
36+
dns-name-label: ${{ env.DNS_NAME_LABEL }}
37+
environment-variables: GH_TOKEN=${{ secrets.PAT_TOKEN }} GH_OWNER=${{ env.GH_OWNER }} GH_REPOSITORY=${{ env.GH_REPOSITORY }}
38+
location: 'eastus'

.github/workflows/dev-images.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Dev Images Build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
# Check out the repository
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
# Set up Docker
16+
- name: Set up Docker
17+
uses: docker/setup-buildx-action@v3
18+
19+
# Log in to GitHub Container Registry
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
# Build Docker images
28+
- name: Build Docker images
29+
run: |
30+
cp .env.example .env
31+
docker build -f Dockerfile.multi --target api-build -t librechat-dev-api .
32+
docker build -f Dockerfile -t librechat-dev .
33+
34+
# Tag and push the images to GitHub Container Registry
35+
- name: Tag and push images
36+
run: |
37+
docker tag librechat-dev-api:latest ghcr.io/${{ github.repository_owner }}/librechat-dev-api:${{ github.sha }}
38+
docker push ghcr.io/${{ github.repository_owner }}/librechat-dev-api:${{ github.sha }}
39+
docker tag librechat-dev-api:latest ghcr.io/${{ github.repository_owner }}/librechat-dev-api:latest
40+
docker push ghcr.io/${{ github.repository_owner }}/librechat-dev-api:latest
41+
42+
docker tag librechat-dev:latest ghcr.io/${{ github.repository_owner }}/librechat-dev:${{ github.sha }}
43+
docker push ghcr.io/${{ github.repository_owner }}/librechat-dev:${{ github.sha }}
44+
docker tag librechat-dev:latest ghcr.io/${{ github.repository_owner }}/librechat-dev:latest
45+
docker push ghcr.io/${{ github.repository_owner }}/librechat-dev:latest

.github/workflows/frontend-review.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#github action to run unit tests for frontend with jest
2+
name: Frontend Unit Tests
3+
on:
4+
# push:
5+
# branches:
6+
# - main
7+
# - dev
8+
# - release/*
9+
pull_request:
10+
branches:
11+
- main
12+
- dev
13+
- release/*
14+
paths:
15+
- 'client/**'
16+
- 'packages/**'
17+
jobs:
18+
tests_frontend:
19+
name: Run frontend unit tests
20+
timeout-minutes: 60
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js 20.x
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build Client
34+
run: npm run frontend:ci
35+
36+
- name: Run unit tests
37+
run: npm run test:ci --verbose
38+
working-directory: client
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docker Compose Build on Main Branch
2+
3+
on:
4+
workflow_dispatch: # This line allows manual triggering
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
# Check out the repository
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
# Set up Docker
16+
- name: Set up Docker
17+
uses: docker/setup-buildx-action@v3
18+
19+
# Log in to GitHub Container Registry
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
# Run docker-compose build
28+
- name: Build Docker images
29+
run: |
30+
cp .env.example .env
31+
docker-compose build
32+
docker build -f Dockerfile.multi --target api-build -t librechat-api .
33+
34+
# Tag and push the images with the 'latest' tag
35+
- name: Tag image and push
36+
run: |
37+
docker tag librechat:latest ghcr.io/${{ github.repository_owner }}/librechat:latest
38+
docker push ghcr.io/${{ github.repository_owner }}/librechat:latest
39+
docker tag librechat-api:latest ghcr.io/${{ github.repository_owner }}/librechat-api:latest
40+
docker push ghcr.io/${{ github.repository_owner }}/librechat-api:latest

0 commit comments

Comments
 (0)