Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# DevContainer data
data-node/
meili_data*/
pgdata/
*.log
*.tmp
.env

38 changes: 38 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# LibreChat DevContainer Dockerfile
FROM node:20-alpine

# Install system dependencies
RUN apk add --no-cache \
git \
python3 \
py3-pip \
make \
g++ \
jemalloc \
bash \
curl \
openssh-client \
sudo

# Set environment variable to use jemalloc
ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2

# Create app directory
WORKDIR /workspaces

# Set npm configuration for better reliability
RUN npm config set fetch-retry-maxtimeout 600000 && \
npm config set fetch-retries 5 && \
npm config set fetch-retry-mintimeout 15000

# Create vscode user with sudo privileges
RUN addgroup -g 1000 vscode && \
adduser -u 1000 -G vscode -s /bin/bash -D vscode && \
echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
chown -R vscode:vscode /workspaces

# Switch to vscode user
USER vscode

# Default command keeps container running
CMD ["/bin/sh", "-c", "while sleep 1000; do :; done"]
FROM node:18-bullseye

RUN useradd -m -s /bin/bash vscode
Expand Down
22 changes: 22 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LibreChat DevContainer (簡易セットアップ)

## 使い方
1. VS Codeで開く → コマンドパレット「Dev Containers: Reopen in Container」
2. 初回ビルド完了後、自動で `.devcontainer/post-create.sh` が走り、依存インストールとビルドを実施
3. ルートに `.env` が無い場合、自動でテンプレートから作成されます
4. 起動:
- バックエンド: `npm run backend:dev`
- フロント: `cd client && npm run dev -- --host --port 3000`
5. ブラウザで `http://localhost:3000` を表示

## 環境変数
- `.devcontainer/env.template` を `.env` にコピーし、必要に応じて修正
- 最低限: `PORT=3080`, `MONGO_URI=mongodb://mongodb:27017/LibreChat`

## 同梱サービス
- MongoDB (27017), Meilisearch (7700), PostgreSQL/pgvector (5432), RAG API (8000)

## トラブルシュート
- `librechat.yaml` が無いと警告が出ます。必要に応じてルートに配置してください。
- RAG API のDB接続エラーが出る場合は、`.env` の Postgres 資格情報と `docker-compose.yml` の `vectordb` 設定を揃えてください。

57 changes: 57 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
{
"name": "LibreChat Dev",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces",
"shutdownAction": "stopCompose",

"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"ms-playwright.playwright",
"ms-vscode.vscode-typescript-next",
"orta.vscode-jest",
"eamodio.gitlens",
"ms-azuretools.vscode-docker"
],
"settings": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
}
}
},

"forwardPorts": [3080, 3000, 27017, 7700, 5432, 8000],
"portsAttributes": {
"3080": { "label": "LibreChat API", "onAutoForward": "notify" },
"3000": { "label": "LibreChat Client (Dev)", "onAutoForward": "notify" },
"27017": { "label": "MongoDB", "onAutoForward": "silent" },
"7700": { "label": "Meilisearch", "onAutoForward": "silent" },
"5432": { "label": "PostgreSQL (VectorDB)", "onAutoForward": "silent" },
"8000": { "label": "RAG API", "onAutoForward": "silent" }
},

"postCreateCommand": "bash .devcontainer/post-create.sh",
"postStartCommand": "echo 'DevContainer started. docker-compose services are available.'",

"remoteUser": "vscode",
"remoteEnv": {
"NODE_ENV": "development"
},

"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
}
}
{
"dockerComposeFile": "docker-compose.yml",
"service": "app",
Expand Down
109 changes: 109 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,112 @@
version: '3.8'

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
restart: unless-stopped
depends_on:
- mongodb
- meilisearch
- vectordb
- rag_api
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/workspaces:cached
- node_modules:/workspaces/node_modules
- api_node_modules:/workspaces/api/node_modules
- client_node_modules:/workspaces/client/node_modules
- packages_api_node_modules:/workspaces/packages/api/node_modules
- packages_client_node_modules:/workspaces/packages/client/node_modules
- packages_data_provider_node_modules:/workspaces/packages/data-provider/node_modules
- packages_data_schemas_node_modules:/workspaces/packages/data-schemas/node_modules
environment:
- HOST=0.0.0.0
- NODE_ENV=development
- MONGO_URI=mongodb://mongodb:27017/LibreChat
- MEILI_HOST=http://meilisearch:7700
- RAG_API_URL=http://rag_api:8000
user: vscode
command: /bin/sh -c "while sleep 1000; do :; done"
networks:
- librechat-network

mongodb:
container_name: chat-mongodb
image: mongo:latest
restart: unless-stopped
expose:
- 27017
volumes:
- ./data-node:/data/db
command: mongod --noauth
networks:
- librechat-network

meilisearch:
container_name: chat-meilisearch
image: getmeili/meilisearch:v1.12.3
restart: unless-stopped
expose:
- 7700
environment:
- MEILI_HOST=http://meilisearch:7700
- MEILI_NO_ANALYTICS=true
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-dev-meili-key}
volumes:
- ./meili_data_v1.12:/meili_data
networks:
- librechat-network

vectordb:
container_name: vectordb
image: pgvector/pgvector:0.8.0-pg15-trixie
restart: unless-stopped
expose:
- 5432
environment:
POSTGRES_DB: mydatabase
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- librechat-network

rag_api:
container_name: rag_api
image: ghcr.io/danny-avila/librechat-rag-api-dev-lite:latest
restart: unless-stopped
expose:
- 8000
environment:
- DB_HOST=vectordb
- RAG_PORT=8000
- POSTGRES_DB=mydatabase
- POSTGRES_USER=myuser
- POSTGRES_PASSWORD=mypassword
depends_on:
- vectordb
networks:
- librechat-network
env_file:
- ../.env

volumes:
pgdata:
node_modules:
api_node_modules:
client_node_modules:
packages_api_node_modules:
packages_client_node_modules:
packages_data_provider_node_modules:
packages_data_schemas_node_modules:

networks:
librechat-network:
driver: bridge
services:
app:
build:
Expand Down
47 changes: 47 additions & 0 deletions .devcontainer/env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# LibreChat DevContainer Environment Variables (development)
# Copy to project root as .env and adjust as needed.

# Basic
HOST=0.0.0.0
PORT=3080
NODE_ENV=development

# Databases
MONGO_URI=mongodb://mongodb:27017/LibreChat
DATABASE_URL=postgresql://myuser:mypassword@vectordb:5432/mydatabase
POSTGRES_DB=mydatabase
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword

# Security (change for production)
JWT_SECRET=dev_jwt_secret_change_me
JWT_REFRESH_SECRET=dev_jwt_refresh_secret_change_me
CREDS_KEY=dev_creds_key_change_me
CREDS_IV=dev_creds_iv_16chars

# Search
MEILI_HOST=http://meilisearch:7700
MEILI_MASTER_KEY=dev-meili-key

# RAG API
RAG_PORT=8000
RAG_API_URL=http://rag_api:8000

# Auth defaults
ALLOW_EMAIL_LOGIN=true
ALLOW_REGISTRATION=true
ALLOW_SOCIAL_LOGIN=false
ALLOW_SOCIAL_REGISTRATION=false

# Dev
NO_INDEX=true
TRUST_PROXY=0
DEBUG=false

# Optional API keys
# OPENAI_API_KEY=
# ANTHROPIC_API_KEY=
# GOOGLE_API_KEY=
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=

25 changes: 25 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -e

echo "🚀 post-create: install & build"

if [ ! -f "/workspaces/.env" ] && [ -f "/workspaces/.devcontainer/env.template" ]; then
cp /workspaces/.devcontainer/env.template /workspaces/.env
echo "✓ .env created from template"
fi

cd /workspaces

echo "📦 npm install"
npm install

echo "🔨 build packages"
npm run build:data-provider || true
npm run build:data-schemas || true
npm run build:api || true

echo "🎭 playwright deps (optional)"
npx playwright install --with-deps || true

echo "✅ post-create done"

32 changes: 24 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,29 @@ Project maintainers have the right and responsibility to remove, edit, or reject

## 3. Git Workflow

We utilize a GitFlow workflow to manage changes to this project's codebase. Follow these general steps when contributing code:

1. Fork the repository and create a new branch with a descriptive slash-based name (e.g., `new/feature/x`).
2. Implement your changes and ensure that all tests pass.
3. Commit your changes using conventional commit messages with GitFlow flags. Begin the commit message with a tag indicating the change type, such as "feat" (new feature), "fix" (bug fix), "docs" (documentation), or "refactor" (code refactoring), followed by a brief summary of the changes (e.g., `feat: Add new feature X to the project`).
4. Submit a pull request with a clear and concise description of your changes and the reasons behind them.
5. We will review your pull request, provide feedback as needed, and eventually merge the approved changes into the main branch.
We follow a simplified GitFlow with a small set of long-lived branches and environment configs kept in the repository (instead of environment-specific branches).

### Branch roles
- `main`: release / production (protected)
- `develop`: integration for upcoming releases
- `feature/*`: topic work merged into `develop`
- `hotfix/*`: urgent fixes starting from `main`, merged back into `main` and `develop`
- `release/*` (optional): stabilize before tagging, then merge to `main` and `develop`
- `upstream` (remote): tracks the source repository for rebases/sync

### Environment configuration
- Keep environment-specific files in the repo instead of creating infra-specific branches:
- `.devcontainer/` for DevContainer
- `docker-compose*.yml` for local containers
- `deploy/` (e.g., `deploy/aws/`, `deploy/railway/`) for cloud manifests/IaC
- Switch targets via CI/CD variables/secrets (no plaintext secrets in the repo).

### Typical contribution flow
1. Fork and branch from `develop` (or `main` for hotfixes), e.g., `feature/your-change`.
2. Implement and ensure tests pass.
3. Use conventional commits (`feat`, `fix`, `docs`, `chore`, etc.): e.g., `feat: add new feature X`.
4. Open a PR with a clear description and test notes.
5. After review, we merge to `develop` (or `main` for hotfixes/release).

## 4. Commit Message Format

Expand Down Expand Up @@ -113,7 +129,7 @@ Ensure that your changes meet the following criteria:

Apply the following naming conventions to branches, labels, and other Git-related entities:

- **Branch names:** Descriptive and slash-based (e.g., `new/feature/x`).
- **Branch names:** Descriptive and slash-based (e.g., `feature/xyz`, `hotfix/issue-123`, `release/1.2.0`).
- **Labels:** Descriptive and kebab case (e.g., `bug-fix`).
- **JS/TS:** Directories and file names: Descriptive and camelCase. First letter uppercased for React files (e.g., `helperFunction.ts, ReactComponent.tsx`).
- **Docs:** Directories and file names: Descriptive and snake_case (e.g., `config_files.md`).
Expand Down
21 changes: 21 additions & 0 deletions AGENT_RULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Agent Behavioral Guidelines / Code of Conduct

These guidelines are established to prevent unnecessary code modifications and ensure accurate implementation planning, based on retrospective analysis of past tasks.

## 1. Code-First Analysis (Fact-Checking)
* **Principle**: Do not rely solely on visual observation of static samples or user descriptions.
* **Action**: Before planning changes, deeply analyze the **existing component code** (React components, Logic, CSS) and **render output**.
* **Why**: To identify what is already implemented (e.g., dynamic text, existing styling loops) versus what is actually missing.

## 2. Evidence-Based Gap Analysis
* **Principle**: "Different until proven same" is dangerous. Assume "Potentially same" and verify.
* **Action**: Explicitly list the **discrepancies** between the "Target Design/Behavior" and the "Current Implementation".
* **Rule**: Only create tasks for items present in the "Target" but PROVEN missing in the "Current".

## 3. Respect Existing Architecture
* **Principle**: Leveraging existing mechanisms (i18n, ThemeContext) is better than hardcoding.
* **Action**: Check `client/src/locales`, `client/src/hooks`, and logical wrappers (like `StartupLayout`) before overriding content.
* **Why**: To maintain maintainability and consistency (e.g., Dark Mode support, Multi-language support).

## Revision History
- **2025-12-09**: Added initial rules following "Login Page Customization" task where redundant text/style changes were initially proposed.
3 changes: 3 additions & 0 deletions client/src/components/Chat/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export default function Landing({ centerFormOnLanding }: { centerFormOnLanding:
</TooltipAnchor>
)}
</div>
<div className="ctw-logo-bg" data-logo-url="assets/claytechworks_logo_typeA_gray.svg">
<img src="assets/claytechworks_logo_typeA_gray.svg" alt="Claytech Works Logo" />
</div>
{((isAgent || isAssistant) && name) || name ? (
<div className="flex flex-col items-center gap-0 p-2">
<SplitText
Expand Down
Loading