diff --git a/.env b/.env index bb113aa9..2f258ca1 100644 --- a/.env +++ b/.env @@ -67,3 +67,7 @@ DOCUMENT_CHUNK_OVERLAP=200 EMBEDDING_MAX_TEXT_LENGTH=3072 DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda + +# Hugging Face configurations +# Hugging face China mirror website endpoint: https://hf-mirror.com +HF_ENDPOINT=https://huggingface.co \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9e6f32bf..7d133e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ data/sqlite/* data/uploads/* data/progress/* lpm_frontend/node_modules +lpm_frontend/yarn.lock # L2 Model Storage resources/model/output/merged_model/* diff --git a/Makefile b/Makefile index 87d76183..58fef485 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,27 @@ -.PHONY: install test format lint all setup start stop restart restart-backend restart-force help docker-build docker-up docker-down docker-build-backend docker-build-frontend docker-restart-backend docker-restart-backend-fast docker-restart-backend-smart docker-restart-frontend docker-restart-all docker-check-cuda docker-use-gpu docker-use-cpu +.PHONY: install test format lint all setup setup-china start stop restart restart-backend restart-force help docker-build docker-up docker-down docker-build-backend docker-build-frontend docker-restart-backend docker-restart-backend-fast docker-restart-backend-smart docker-restart-frontend docker-restart-all docker-check-cuda docker-use-gpu docker-use-cpu + +# Colors for output +COLOR_CYAN=\033[0;36m +COLOR_BOLD=\033[1m +COLOR_GRAY=\033[0;90m +COLOR_RESET=\033[0m + +# Function to display ASCII art only +define display_ascii + @printf "\n" + @printf "$(COLOR_CYAN)" + @printf ' ███████╗███████╗ ██████╗ ██████╗ ███╗ ██╗██████╗ ███╗ ███╗███████╗\n' + @printf ' ██╔════╝██╔════╝██╔════╝██╔═══██╗████╗ ██║██╔══██╗ ████╗ ████║██╔════╝\n' + @printf ' ███████╗█████╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║█████╗██╔████╔██║█████╗ \n' + @printf ' ╚════██║██╔══╝ ██║ ██║ ██║██║╚██╗██║██║ ██║╚════╝██║╚██╔╝██║██╔══╝ \n' + @printf ' ███████║███████╗╚██████╗╚██████╔╝██║ ╚████║██████╔╝ ██║ ╚═╝ ██║███████╗\n' + @printf ' ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚══════╝\n' + @printf "$(COLOR_RESET)\n" + @printf "$(COLOR_BOLD)Second-Me v1.0.0$(COLOR_RESET)\n" + @printf "$(COLOR_GRAY)%s$(COLOR_RESET)\n\n" "$$(date)" +endef + + # Check for GPU flag file and set Docker Compose file accordingly ifeq ($(wildcard .gpu_selected),) @@ -53,15 +76,9 @@ DOCKER_COMPOSE_FILE := docker-compose.yml # Show help message help: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Help $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" ifeq ($(WINDOWS),1) - @echo. - @echo ███████╗███████╗ ██████╗ ██████╗ ███╗ ██╗██████╗ ███╗ ███╗███████╗ - @echo ██╔════╝██╔════╝██╔════╝██╔═══██╗████╗ ██║██╔══██╗ ████╗ ████║██╔════╝ - @echo ███████╗█████╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║█████╗██╔████╔██║█████╗ - @echo ╚════██║██╔══╝ ██║ ██║ ██║██║╚██╗██║██║ ██║╚════╝██║╚██╔╝██║██╔══╝ - @echo ███████║███████╗╚██████╗╚██████╔╝██║ ╚████║██████╔╝ ██║ ╚═╝ ██║███████╗ - @echo ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚══════╝ - @echo. @echo SECOND-ME MAKEFILE COMMANDS @echo ------------------------------ @echo. @@ -97,18 +114,10 @@ ifeq ($(WINDOWS),1) @echo make all - Run format, lint and test else @echo "$(COLOR_CYAN)" - @echo ' ███████╗███████╗ ██████╗ ██████╗ ███╗ ██╗██████╗ ███╗ ███╗███████╗' - @echo ' ██╔════╝██╔════╝██╔════╝██╔═══██╗████╗ ██║██╔══██╗ ████╗ ████║██╔════╝' - @echo ' ███████╗█████╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║█████╗██╔████╔██║█████╗ ' - @echo ' ╚════██║██╔══╝ ██║ ██║ ██║██║╚██╗██║██║ ██║╚════╝██║╚██╔╝██║██╔══╝ ' - @echo ' ███████║███████╗╚██████╗╚██████╔╝██║ ╚████║██████╔╝ ██║ ╚═╝ ██║███████╗' - @echo ' ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚══════╝' - @echo "$(COLOR_RESET)" - @echo "$(COLOR_BOLD)Second-Me Makefile Commands$(COLOR_RESET)" - @echo "$(COLOR_GRAY)$$(date)$(COLOR_RESET)\n" @echo "" @echo "$(COLOR_GREEN)▶ LOCAL COMMANDS:$(COLOR_RESET)" - @echo " make setup - Complete installation" + @echo " make setup - Complete installation (global mirrors)" + @echo " make setup-china - Complete installation (China mirrors)" @echo " make start - Start all services" @echo " make stop - Stop all services" @echo " make restart - Restart all services" @@ -122,7 +131,7 @@ else @echo " make docker-down - Stop all Docker containers" @echo " make docker-build-backend - Build only backend Docker image" @echo " make docker-build-frontend - Build only frontend Docker image" - @echo " make docker-restart-backend - Restart only backend container (with rebuild)" + @echo " make docker-restart-backend - Restart only backend container" @echo " make docker-restart-backend-fast - Restart backend+cuda without rebuilding llama.cpp" @echo " make docker-restart-frontend - Restart only frontend container" @echo " make docker-restart-all - Restart all Docker containers" @@ -144,8 +153,9 @@ else fi endif -# Configuration switchers for Docker docker-use-gpu: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Use GPU $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" @echo "Switching to GPU configuration..." ifeq ($(WINDOWS),1) @echo GPU mode enabled. Docker commands will use docker-compose-gpu.yml @@ -156,6 +166,8 @@ else endif docker-use-cpu: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Use CPU $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" @echo "Switching to CPU-only configuration..." ifeq ($(WINDOWS),1) @echo CPU-only mode enabled. Docker commands will use docker-compose.yml @@ -166,25 +178,44 @@ else endif setup: - ./scripts/setup.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Setup $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/setup.sh + +setup-cn: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Setup (China) $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/setup.sh --china start: - ./scripts/start.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Start $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/start.sh stop: - ./scripts/stop.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Stop $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/stop.sh restart: - ./scripts/restart.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Restart $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/restart.sh restart-backend: - ./scripts/restart-backend.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Restart Backend $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/restart-backend.sh restart-force: - ./scripts/restart-force.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Restart Force $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/restart-force.sh status: - ./scripts/status.sh + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Status $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @./scripts/status.sh # Docker commands # Set Docker environment variable for all Docker commands @@ -197,6 +228,8 @@ DOCKER_COMPOSE_CMD := $(shell if command -v docker-compose >/dev/null 2>&1; then endif docker-build: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Build $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" ifeq ($(WINDOWS),1) @echo "Prompting for CUDA preference..." @scripts\prompt_cuda.bat @@ -205,9 +238,11 @@ else @chmod +x ./scripts/prompt_cuda.sh @./scripts/prompt_cuda.sh endif - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build docker-up: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Up $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" @echo "Building and starting Docker containers..." ifeq ($(WINDOWS),1) @echo "Prompting for CUDA preference..." @@ -233,55 +268,71 @@ endif @echo "Check CUDA support with: make docker-check-cuda" docker-down: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) down + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Down $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) down docker-build-backend: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build backend + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Build Backend $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build backend docker-build-frontend: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build frontend + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Build Frontend $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build frontend # Standard backend restart with complete rebuild docker-restart-backend: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop backend - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f backend - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build backend || { echo "$(COLOR_RED)❌ Backend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d backend + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Restart Backend $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop backend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f backend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build backend || { echo "$(COLOR_RED)❌ Backend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d backend # Fast backend restart: preserves llama.cpp build docker-restart-backend-fast: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Restart Backend (Fast) $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" @echo "Smart restarting backend container (preserving llama.cpp build)..." @echo "Stopping backend container..." - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop backend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop backend @echo "Removing backend container..." - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f backend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f backend @echo "Building backend image with build-arg to skip llama.cpp build..." ifeq ($(wildcard .gpu_selected),) @echo "Using CPU configuration (docker-compose.yml)..." else @echo "Using GPU configuration (docker-compose-gpu.yml)..." endif - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build --build-arg SKIP_LLAMA_BUILD=true backend || { echo "$(COLOR_RED)❌ Backend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build --build-arg SKIP_LLAMA_BUILD=true backend || { echo "$(COLOR_RED)❌ Backend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } @echo "Starting backend container..." - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d backend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d backend @echo "Backend container smart-restarted successfully" @echo "Check CUDA support with: make docker-check-cuda" docker-restart-frontend: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop frontend - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f frontend - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build frontend || { echo "$(COLOR_RED)❌ Frontend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d frontend + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Restart Frontend $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop frontend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f frontend + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build frontend || { echo "$(COLOR_RED)❌ Frontend build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d frontend docker-restart-all: - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build || { echo "$(COLOR_RED)❌ Build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } - $(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Restart All $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) stop + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) rm -f + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) build || { echo "$(COLOR_RED)❌ Build failed! Aborting operation...$(COLOR_RESET)"; exit 1; } + @$(DOCKER_COMPOSE_CMD) -f $(DOCKER_COMPOSE_FILE) up -d # New command to check CUDA support in containers docker-check-cuda: + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Docker Check CUDA $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" @echo "Checking CUDA support in Docker containers..." ifeq ($(WINDOWS),1) @echo Running CUDA support check in backend container @@ -292,15 +343,26 @@ else endif install: - poetry install + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Install $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @poetry install test: - poetry run pytest tests + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Test $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @poetry run pytest tests format: - poetry run ruff format lpm_kernel/ + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Format $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @poetry run ruff format lpm_kernel/ lint: - poetry run ruff check lpm_kernel/ + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)Lint $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @poetry run ruff check lpm_kernel/ -all: format lint test \ No newline at end of file +all: format lint test + @$(call display_ascii) + @printf "\n$(COLOR_CYAN)==================== [ $(COLOR_BOLD)All $(COLOR_CYAN)] ====================$(COLOR_RESET)\n\n" + @echo "All tasks completed!" \ No newline at end of file diff --git a/README.md b/README.md index cbddf335..98cebccb 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ Star and join us, and you will receive all release notifications from GitHub wit | Memory (GB) | Docker Deployment (Windows/Linux) | Docker Deployment (Mac) | Integrated Setup (Windows/Linux) | Integrated Setup (Mac) | |--------------|-----------------------------|-------------------|--------------------------|----------------| -| 8 | ~0.8B (example) | ~0.4B (example) | ~1.0B (example) | ~0.6B (example) | -| 16 | 1.5B (example) | 0.5B (example) | ~2.0B (example) | ~0.8B (example) | -| 32 | ~2.8B (example) | ~1.2B (example) | ~3.5B (example) | ~1.5B (example) | +| 8 | ~0.5B | ~0.5B | ~1.5B | ~0.5B | +| 16 | 1.5B | 0.5B | ~3.0B | ~0.5B | +| 32 | ~3B | ~1.5B | ~3B | ~1.5B | > **Note**: Models below 0.5B may not provide satisfactory performance for complex tasks. And we're continuously improving cross-platform support - please [submit an issue](https://github.com/mindverse/Second-Me/issues/new) for feedback or compatibility problems on different operating systems. diff --git a/dependencies/graphrag-1.2.1.dev27.tar.gz b/dependencies/graphrag-1.2.1.dev27.tar.gz index 7375b074..f0f8e9b8 100644 Binary files a/dependencies/graphrag-1.2.1.dev27.tar.gz and b/dependencies/graphrag-1.2.1.dev27.tar.gz differ diff --git a/dependencies/graphrag-modified.tar.gz b/dependencies/graphrag-modified.tar.gz index a0797a54..7e6a1136 100644 Binary files a/dependencies/graphrag-modified.tar.gz and b/dependencies/graphrag-modified.tar.gz differ diff --git a/docs/Configuration Guide for CN zh.md b/docs/Configuration Guide for CN zh.md new file mode 100644 index 00000000..297479a9 --- /dev/null +++ b/docs/Configuration Guide for CN zh.md @@ -0,0 +1,142 @@ +# 中国大陆地区环境下的项目配置指南 + +本文档提供了在中国大陆地区使用国内网络环境进行项目配置的方法,适用于 Docker 和非 Docker 用户。 + +## 非 Docker 用户配置 + +非 Docker 用户可以直接使用以下命令进行配置: + +```bash +make setup-cn +``` + +## Docker 用户配置 + +Docker 用户需要修改 Docker 的配置文件,以使用国内镜像源。以下是不同操作系统的配置方法: + +### Mac 系统 + +#### 方法一:通过 Docker Desktop 界面配置 + +1. 点击桌面顶部菜单栏的 Docker 图标 +2. 选择 "Settings" 或 "首选项" +3. 点击 "Docker Engine" 选项卡 +4. 将以下配置复制到配置编辑器中(注意保留其他已有配置): + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +5. 点击 "Apply & Restart" 按钮应用更改并重启 Docker + +#### 方法二:直接修改配置文件 + +1. 打开终端 +2. 使用文本编辑器打开 Docker 配置文件: + +```bash +mkdir -p ~/.docker +nano ~/.docker/daemon.json +``` + +3. 将以下内容复制到文件中: + +```json +{ + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +4. 保存文件(在 nano 中按 Ctrl+O,然后按 Enter,再按 Ctrl+X 退出) +5. 重启 Docker Desktop + +### Linux 系统 + +1. 创建或编辑 Docker 配置文件: + +```bash +sudo mkdir -p /etc/docker +sudo nano /etc/docker/daemon.json +``` + +2. 将以下内容复制到文件中: + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +3. 保存文件并重启 Docker 服务: + +```bash +sudo systemctl daemon-reload +sudo systemctl restart docker +``` + +### Windows 系统 + +1. 右键点击任务栏中的 Docker 图标 +2. 选择 "Settings" +3. 点击左侧菜单中的 "Docker Engine" +4. 也可以直接修改配置文件,位置通常在:`C:\Users\<用户名>\.docker\daemon.json` +5. 将以下配置复制到配置编辑器中(注意保留其他已有配置): + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +6. 点击 "Apply & Restart" 按钮应用更改并重启 Docker + +## 验证配置 + +配置完成后,可以通过以下命令验证镜像源是否生效: + +```bash +docker info +``` + +在输出信息中应该能看到 "Registry Mirrors" 部分列出了你配置的镜像源。 + +## 常见问题 + +1. 如果遇到权限问题,请确保你有足够的权限修改 Docker 配置文件。 + +2. 配置完成后如果 Docker 无法启动,请检查配置文件格式是否正确,确保 JSON 格式有效。 \ No newline at end of file diff --git a/docs/Configuration Guide for CN.md b/docs/Configuration Guide for CN.md new file mode 100644 index 00000000..9ae92e3e --- /dev/null +++ b/docs/Configuration Guide for CN.md @@ -0,0 +1,142 @@ +# Project Configuration Guide for Environments in mainland China + +This document provides methods to configure the project using domestic network resources in mainland China, applicable for both Docker and non-Docker users. + +## Non-Docker User Configuration + +Non-Docker users can directly use the following command for configuration: + +```bash +make setup-cn +``` + +## Docker User Configuration + +Docker users need to modify the Docker configuration file to use mirrors in China. Below are configuration methods for different operating systems: + +### Mac System + +#### Method 1: Configure through Docker Desktop UI + +1. Click on the Docker icon in the top menu bar +2. Select "Settings" or "Preferences" +3. Click on the "Docker Engine" tab +4. Copy the following configuration to the configuration editor (note to preserve any existing configurations): + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +5. Click the "Apply & Restart" button to apply changes and restart Docker + +#### Method 2: Directly edit the configuration file + +1. Open Terminal +2. Open the Docker configuration file with a text editor: + +```bash +mkdir -p ~/.docker +nano ~/.docker/daemon.json +``` + +3. Copy the following content to the file: + +```json +{ + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +4. Save the file (in nano, press Ctrl+O, then Enter, then Ctrl+X to exit) +5. Restart Docker Desktop + +### Linux System + +1. Create or edit the Docker configuration file: + +```bash +sudo mkdir -p /etc/docker +sudo nano /etc/docker/daemon.json +``` + +2. Copy the following content to the file: + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +3. Save the file and restart the Docker service: + +```bash +sudo systemctl daemon-reload +sudo systemctl restart docker +``` + +### Windows System + +1. Right-click on the Docker icon in the taskbar +2. Select "Settings" +3. Click on "Docker Engine" in the left menu +4. You can also directly modify the configuration file, typically located at: `C:\Users\\.docker\daemon.json` +5. Copy the following configuration to the configuration editor (note to preserve any existing configurations): + +```json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": false, + "registry-mirrors": [ + "https://docker.1ms.run", + "https://docker.xuanyuan.me" + ] +} +``` + +6. Click the "Apply & Restart" button to apply changes and restart Docker + +## Verify Configuration + +After configuration, you can verify if the mirror sources are effective with the following command: + +```bash +docker info +``` + +In the output information, you should be able to see the "Registry Mirrors" section listing the mirror sources you configured. + +## Common Issues + +1. If you encounter permission issues, please ensure you have sufficient permissions to modify the Docker configuration file. + +2. If Docker fails to start after configuration, check if the configuration file format is correct and ensure the JSON format is valid. diff --git a/env.example b/env.example new file mode 100644 index 00000000..e05e3a53 --- /dev/null +++ b/env.example @@ -0,0 +1,35 @@ +# Application Configuration +APP_NAME=second-me +APP_VERSION=1.0.0 +APP_WORD="Hello from Second Me" +LOCAL_APP_PORT=8000 + +# Database Configuration +DB_FILE=data/sqlite/lpm.db +DB_POOL_SIZE=5 +DB_POOL_RECYCLE=3600 + +# Directory Configuration +BASE_DIR=/app +USER_DATA_PIPELINE_DIR=data/pipeline + +# Vector Store Settings +CHROMA_PERSIST_DIRECTORY=data/chroma_db +CHROMA_COLLECTION_NAME=documents + +# Service URLs +KERNEL2_SERVICE_URL=http://127.0.0.1:8000 +REGISTRY_SERVICE_URL=http://registry:8080 + +# Email Configuration +SMTP_HOST=smtp.gmail.com +SMTP_PORT=587 +SMTP_USER=your-email@gmail.com +SMTP_PASSWORD=your-app-specific-password +SMTP_USE_TLS=True +SENDER_EMAIL=your-email@gmail.com +NOTIFICATION_EMAIL=your-notification-email@example.com + +# Training Configuration +DOCUMENT_CHUNK_SIZE=1000 +DOCUMENT_CHUNK_OVERLAP=200 \ No newline at end of file diff --git a/lpm_frontend/src/app/dashboard/playground/chat/page.tsx b/lpm_frontend/src/app/dashboard/playground/chat/page.tsx index 921f9d53..a137d3fe 100644 --- a/lpm_frontend/src/app/dashboard/playground/chat/page.tsx +++ b/lpm_frontend/src/app/dashboard/playground/chat/page.tsx @@ -79,8 +79,8 @@ export default function PlaygroundChat() { }, [loadInfo, modelType]); const originSettings = useMemo(() => { return { - enableL0Retrieval: true, - enableL1Retrieval: true, + enableL0Retrieval: false, + enableL1Retrieval: false, enableHelperModel: false, selectedModel: 'ollama', apiKey: 'http://localhost:11434', diff --git a/lpm_frontend/src/app/dashboard/train/memories/page.tsx b/lpm_frontend/src/app/dashboard/train/memories/page.tsx index 1d0c15c2..6417550c 100644 --- a/lpm_frontend/src/app/dashboard/train/memories/page.tsx +++ b/lpm_frontend/src/app/dashboard/train/memories/page.tsx @@ -137,7 +137,7 @@ export default function TrainPage() { }; const handleDeleteMemory = async (id: string, name: string) => { - const res = await deleteMemory(name); + const res = await deleteMemory(id); if (res.data.code === 0) { setMemories((prev) => { diff --git a/lpm_frontend/src/components/OnboardingTutorial/index.tsx b/lpm_frontend/src/components/OnboardingTutorial/index.tsx index afae4aab..90324ca8 100644 --- a/lpm_frontend/src/components/OnboardingTutorial/index.tsx +++ b/lpm_frontend/src/components/OnboardingTutorial/index.tsx @@ -25,7 +25,7 @@ export default function OnboardingTutorial({ onComplete, onClose }: OnboardingTu image: '/images/step_3.png' }, { - title: 'Join AI Network', + title: 'Export your Second Me', description: 'Explore interactions between your Second Me and other AI entities in the network.', image: '/images/step_4.png' diff --git a/lpm_frontend/src/components/ThinkingModelModal/index.tsx b/lpm_frontend/src/components/ThinkingModelModal/index.tsx index dd5f2cdc..d69265a5 100644 --- a/lpm_frontend/src/components/ThinkingModelModal/index.tsx +++ b/lpm_frontend/src/components/ThinkingModelModal/index.tsx @@ -26,7 +26,28 @@ const ThinkingModelModal = (props: IProps) => { }, [open]); useEffect(() => { - setThinkingModelParams(thinkingModelConfig); + // If backend returned data + if (thinkingModelConfig) { + const updatedParams = {...thinkingModelConfig}; + + // Check fields, if null/undefined then set default values + if (updatedParams.thinking_model_name === null || updatedParams.thinking_model_name === undefined) { + updatedParams.thinking_model_name = "deepseek-reasoner"; + } + + if (updatedParams.thinking_endpoint === null || updatedParams.thinking_endpoint === undefined) { + updatedParams.thinking_endpoint = "https://api.deepseek.com"; + } + + setThinkingModelParams(updatedParams); + } else { + // Set complete default values when no configuration exists + setThinkingModelParams({ + thinking_model_name: "deepseek-reasoner", + thinking_endpoint: "https://api.deepseek.com", + thinking_api_key: "" + }); + } }, [thinkingModelConfig]); const handleUpdate = () => { @@ -75,6 +96,7 @@ const ThinkingModelModal = (props: IProps) => { setThinkingModelParams({ ...thinkingModelParams, @@ -109,6 +131,7 @@ const ThinkingModelModal = (props: IProps) => { setThinkingModelParams({ ...thinkingModelParams, diff --git a/lpm_frontend/src/components/train/TrainingConfiguration.tsx b/lpm_frontend/src/components/train/TrainingConfiguration.tsx index 3e3fe1d1..5a981ced 100644 --- a/lpm_frontend/src/components/train/TrainingConfiguration.tsx +++ b/lpm_frontend/src/components/train/TrainingConfiguration.tsx @@ -173,7 +173,7 @@ const TrainingConfiguration: React.FC = ({ e.stopPropagation(); if (disabledChangeParams) { - message.warning('Cancel the current train in order to configure the model'); + message.warning('Cancel the current training run to configure the model'); return; } @@ -348,7 +348,7 @@ const TrainingConfiguration: React.FC = ({ value={trainingParams.number_of_epochs} />
- Enter an integer between 1 and 10 (recommended: 2) + Enter an integer between 1 and 10 (recommended: 3)
@@ -460,8 +460,11 @@ const TrainingConfiguration: React.FC = ({ setOpenThinkingModel(true); }} > - Thinking Model + Thinking Model
+ + + @@ -477,7 +480,13 @@ const TrainingConfiguration: React.FC = ({ {trainButtonText === 'Resume Training' && (