feat: add AI学习助手 agent (KG+RAG ideal) and renshenguo feishu bot

- Add AI学习助手 agent creation script with all 39 tools, 3-layer KG+RAG memory
- Add renshenguo (人参果) feishu bot integration (app_service + ws_handler)
- Register renshenguo WS client in main.py startup
- Add RENSHENGUO_APP_ID / RENSHENGUO_APP_SECRET / RENSHENGUO_AGENT_ID config
- Reorganize docs from root into docs/ subdirectories
- Move startup scripts to scripts/startup/
- Various backend optimizations and tool improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-06 01:37:13 +08:00
parent f33bc461ff
commit eabf90c496
171 changed files with 4906 additions and 445 deletions

38
scripts/startup/start.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# 低代码智能体平台启动脚本
echo "🚀 启动低代码智能体平台..."
echo ""
# 检查Docker是否运行
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker 未运行,请先启动 Docker"
exit 1
fi
# 检查docker-compose是否可用
if ! command -v docker-compose &> /dev/null; then
echo "❌ docker-compose 未安装,请先安装 docker-compose"
exit 1
fi
echo "📦 启动 Docker Compose 服务..."
docker-compose -f docker-compose.dev.yml up -d
echo ""
echo "⏳ 等待服务启动..."
sleep 5
echo ""
echo "✅ 服务启动完成!"
echo ""
echo "📍 访问地址:"
echo " - 前端: http://localhost:8038"
echo " - 后端API: http://localhost:8037"
echo " - API文档: http://localhost:8037/docs"
echo " - 健康检查: http://localhost:8037/health"
echo ""
echo "📋 查看日志: docker-compose -f docker-compose.dev.yml logs -f"
echo "🛑 停止服务: docker-compose -f docker-compose.dev.yml down"
echo ""

View File

@@ -0,0 +1,219 @@
@echo off
echo ==============================================
echo 低代码智能体平台 - Windows 启动脚本
echo ==============================================
echo.
REM 检查Python是否安装
python --version >nul 2>&1
if errorlevel 1 (
echo ❌ Python 未安装或未添加到系统PATH
echo 请安装 Python 3.11+ 并确保在PATH中
pause
exit /b 1
)
REM 检查Node.js是否安装
node --version >nul 2>&1
if errorlevel 1 (
echo ❌ Node.js 未安装或未添加到系统PATH
echo 请安装 Node.js 18+ 并确保在PATH中
pause
exit /b 1
)
REM 检查pnpm是否安装
pnpm --version >nul 2>&1
if errorlevel 1 (
echo ⚠️ pnpm 未安装,正在安装...
npm install -g pnpm
if errorlevel 1 (
echo ❌ pnpm 安装失败
pause
exit /b 1
)
)
echo ✅ 环境检查通过
echo.
REM 进入项目目录
cd /d "%~dp0"
echo ==============================================
echo 1. Redis 检查
echo ==============================================
echo.
REM 检查Redis服务是否运行
sc query Redis >nul 2>&1
if errorlevel 1 (
echo ❌ Redis 服务未运行
echo.
echo 请按以下步骤安装Redis
echo 1. 下载 Redis Windows 版本https://github.com/microsoftarchive/redis/releases
echo 2. 下载 Redis-x64-3.2.100.msi
echo 3. 运行安装程序,按照默认设置安装
echo 4. Redis 将作为 Windows 服务运行在 6379 端口
echo.
echo 安装完成后,请重新运行此脚本
pause
exit /b 1
) else (
echo ✅ Redis 服务正在运行
)
echo ==============================================
echo 2. 启动后端服务
echo ==============================================
echo.
REM 进入backend目录
cd backend
REM 检查虚拟环境
if not exist "venv\Scripts\activate" (
echo ⚠️ 虚拟环境不存在,正在创建...
python -m venv venv
if errorlevel 1 (
echo ❌ 虚拟环境创建失败
pause
exit /b 1
)
)
echo ✅ 虚拟环境检查通过
REM 激活虚拟环境并安装依赖
call venv\Scripts\activate
echo 📦 检查Python依赖...
pip list | findstr "fastapi" >nul
if errorlevel 1 (
echo ⚠️ 正在安装Python依赖...
pip install -r requirements.txt
if errorlevel 1 (
echo ❌ Python依赖安装失败
pause
exit /b 1
)
echo ✅ Python依赖安装完成
) else (
echo ✅ Python依赖已安装
)
echo.
echo 🔧 配置环境变量...
if not exist ".env" (
copy env.example .env >nul
echo ⚠️ 已创建 .env 文件,请检查配置
)
echo.
echo 🗄️ 运行数据库迁移...
alembic upgrade head
if errorlevel 1 (
echo ⚠️ 数据库迁移失败,继续启动...
)
echo.
echo 🌐 启动后端服务...
echo 后端服务将在 http://localhost:8037 启动
echo API文档http://localhost:8037/docs
echo.
start cmd /k "uvicorn app.main:app --host 0.0.0.0 --port 8037 --reload"
echo ⏳ 等待后端服务启动...
timeout /t 3 /nobreak >nul
echo.
echo ==============================================
echo 3. 启动 Celery Worker
echo ==============================================
echo.
echo 🔄 启动 Celery Worker...
start cmd /k "celery -A app.core.celery_app worker --loglevel=info"
echo ⏳ 等待 Celery Worker 启动...
timeout /t 2 /nobreak >nul
echo.
echo ==============================================
echo 4. 启动前端服务
echo ==============================================
echo.
REM 返回项目根目录
cd ..
REM 进入frontend目录
cd frontend
echo 📦 检查前端依赖...
if not exist "node_modules" (
echo ⚠️ 正在安装前端依赖...
pnpm install
if errorlevel 1 (
echo ❌ 前端依赖安装失败
pause
exit /b 1
)
echo ✅ 前端依赖安装完成
) else (
echo ✅ 前端依赖已安装
)
echo.
echo 🖥️ 启动前端服务...
echo 前端服务将在 http://localhost:3000 启动
echo.
start cmd /k "pnpm dev"
echo ⏳ 等待前端服务启动...
timeout /t 5 /nobreak >nul
echo.
echo ==============================================
echo 🎉 启动完成!
echo ==============================================
echo.
echo 服务访问地址:
echo 📍 前端界面: http://localhost:3000
echo 📍 后端API: http://localhost:8037
echo 📍 API文档: http://localhost:8037/docs
echo.
echo 服务状态:
echo ✅ Redis 服务: 运行中
echo ✅ 后端服务: 已启动
echo ✅ Celery Worker: 已启动
echo ✅ 前端服务: 已启动
echo.
echo 📋 重要提示:
echo 1. 首次访问需要注册新用户
echo 2. 保持所有命令行窗口打开
echo 3. 停止服务:关闭所有命令行窗口
echo.
echo ==============================================
echo.
REM 返回项目根目录
cd ..
echo 按任意键打开浏览器访问前端界面...
pause >nul
start http://localhost:3000
echo.
echo 脚本执行完成!
echo 按任意键退出...
pause >nul

View File

@@ -0,0 +1,239 @@
# 低代码智能体平台 - Windows PowerShell 启动脚本
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "低代码智能体平台 - Windows 启动脚本" -ForegroundColor Cyan
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
# 检查Python是否安装
try {
$pythonVersion = python --version 2>&1
Write-Host "✅ Python 版本: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Python 未安装或未添加到系统PATH" -ForegroundColor Red
Write-Host "请安装 Python 3.11+ 并确保在PATH中"
pause
exit 1
}
# 检查Node.js是否安装
try {
$nodeVersion = node --version
Write-Host "✅ Node.js 版本: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "❌ Node.js 未安装或未添加到系统PATH" -ForegroundColor Red
Write-Host "请安装 Node.js 18+ 并确保在PATH中"
pause
exit 1
}
# 检查pnpm是否安装
try {
$pnpmVersion = pnpm --version
Write-Host "✅ pnpm 版本: $pnpmVersion" -ForegroundColor Green
} catch {
Write-Host "⚠️ pnpm 未安装,正在安装..." -ForegroundColor Yellow
npm install -g pnpm
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ pnpm 安装失败" -ForegroundColor Red
pause
exit 1
}
Write-Host "✅ pnpm 安装成功" -ForegroundColor Green
}
Write-Host "✅ 环境检查通过" -ForegroundColor Green
Write-Host ""
# 设置项目目录
$projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $projectRoot
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "1. Redis 检查" -ForegroundColor Cyan
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
# 检查Redis服务是否运行
$redisService = Get-Service -Name "Redis" -ErrorAction SilentlyContinue
if ($null -eq $redisService -or $redisService.Status -ne "Running") {
Write-Host "❌ Redis 服务未运行" -ForegroundColor Red
Write-Host ""
Write-Host "请按以下步骤安装Redis" -ForegroundColor Yellow
Write-Host "1. 下载 Redis Windows 版本https://github.com/microsoftarchive/redis/releases"
Write-Host "2. 下载 Redis-x64-3.2.100.msi"
Write-Host "3. 运行安装程序,按照默认设置安装"
Write-Host "4. Redis 将作为 Windows 服务运行在 6379 端口"
Write-Host ""
Write-Host "安装完成后,请重新运行此脚本" -ForegroundColor Yellow
pause
exit 1
} else {
Write-Host "✅ Redis 服务正在运行 (状态: $($redisService.Status))" -ForegroundColor Green
}
Write-Host ""
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "2. 启动后端服务" -ForegroundColor Cyan
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
# 进入backend目录
Set-Location "$projectRoot\backend"
# 检查虚拟环境
if (-not (Test-Path "venv\Scripts\activate")) {
Write-Host "⚠️ 虚拟环境不存在,正在创建..." -ForegroundColor Yellow
python -m venv venv
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ 虚拟环境创建失败" -ForegroundColor Red
pause
exit 1
}
Write-Host "✅ 虚拟环境创建成功" -ForegroundColor Green
}
Write-Host "✅ 虚拟环境检查通过" -ForegroundColor Green
# 激活虚拟环境
$activateScript = "$projectRoot\backend\venv\Scripts\Activate.ps1"
if (Test-Path $activateScript) {
& $activateScript
} else {
Write-Host "❌ 虚拟环境激活脚本不存在: $activateScript" -ForegroundColor Red
pause
exit 1
}
Write-Host "📦 检查Python依赖..." -ForegroundColor Cyan
$fastapiInstalled = pip list | Select-String "fastapi"
if (-not $fastapiInstalled) {
Write-Host "⚠️ 正在安装Python依赖..." -ForegroundColor Yellow
pip install -r requirements.txt
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Python依赖安装失败" -ForegroundColor Red
pause
exit 1
}
Write-Host "✅ Python依赖安装完成" -ForegroundColor Green
} else {
Write-Host "✅ Python依赖已安装" -ForegroundColor Green
}
Write-Host ""
Write-Host "🔧 配置环境变量..." -ForegroundColor Cyan
if (-not (Test-Path ".env")) {
Copy-Item env.example .env -ErrorAction SilentlyContinue
Write-Host "⚠️ 已创建 .env 文件,请检查配置" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "🗄️ 运行数据库迁移..." -ForegroundColor Cyan
alembic upgrade head
if ($LASTEXITCODE -ne 0) {
Write-Host "⚠️ 数据库迁移失败,继续启动..." -ForegroundColor Yellow
}
Write-Host ""
Write-Host "🌐 启动后端服务..." -ForegroundColor Cyan
Write-Host "后端服务将在 http://localhost:8037 启动" -ForegroundColor Green
Write-Host "API文档http://localhost:8037/docs" -ForegroundColor Green
Write-Host ""
# 启动后端服务(新窗口)
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$projectRoot\backend'; .\venv\Scripts\Activate.ps1; uvicorn app.main:app --host 0.0.0.0 --port 8037 --reload"
Write-Host "⏳ 等待后端服务启动..." -ForegroundColor Cyan
Start-Sleep -Seconds 3
Write-Host ""
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "3. 启动 Celery Worker" -ForegroundColor Cyan
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "🔄 启动 Celery Worker..." -ForegroundColor Cyan
# Windows 下 prefork 池易卡住任务Redis 出现大量 unacked使用线程池更稳定
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$projectRoot\backend'; .\venv\Scripts\Activate.ps1; celery -A app.core.celery_app worker --loglevel=info --pool=threads --concurrency=8"
Write-Host "⏳ 等待 Celery Worker 启动..." -ForegroundColor Cyan
Start-Sleep -Seconds 2
Write-Host ""
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "4. 启动前端服务" -ForegroundColor Cyan
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
# 返回项目根目录
Set-Location $projectRoot
# 进入frontend目录
Set-Location "$projectRoot\frontend"
Write-Host "📦 检查前端依赖..." -ForegroundColor Cyan
if (-not (Test-Path "node_modules")) {
Write-Host "⚠️ 正在安装前端依赖..." -ForegroundColor Yellow
pnpm install
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ 前端依赖安装失败" -ForegroundColor Red
pause
exit 1
}
Write-Host "✅ 前端依赖安装完成" -ForegroundColor Green
} else {
Write-Host "✅ 前端依赖已安装" -ForegroundColor Green
}
Write-Host ""
Write-Host "🖥️ 启动前端服务..." -ForegroundColor Cyan
Write-Host "前端服务将在 http://localhost:3000 启动" -ForegroundColor Green
Write-Host ""
# 启动前端服务(新窗口)
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$projectRoot\frontend'; pnpm dev"
Write-Host "⏳ 等待前端服务启动..." -ForegroundColor Cyan
Start-Sleep -Seconds 5
Write-Host ""
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host "🎉 启动完成!" -ForegroundColor Green
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "服务访问地址:" -ForegroundColor White
Write-Host " 📍 前端界面: http://localhost:3000" -ForegroundColor Yellow
Write-Host " 📍 后端API: http://localhost:8037" -ForegroundColor Yellow
Write-Host " 📍 API文档: http://localhost:8037/docs" -ForegroundColor Yellow
Write-Host ""
Write-Host "服务状态:" -ForegroundColor White
Write-Host " ✅ Redis 服务: 运行中" -ForegroundColor Green
Write-Host " ✅ 后端服务: 已启动" -ForegroundColor Green
Write-Host " ✅ Celery Worker: 已启动" -ForegroundColor Green
Write-Host " ✅ 前端服务: 已启动" -ForegroundColor Green
Write-Host ""
Write-Host "📋 重要提示:" -ForegroundColor White
Write-Host " 1. 首次访问需要注册新用户" -ForegroundColor Gray
Write-Host " 2. 保持所有PowerShell窗口打开" -ForegroundColor Gray
Write-Host " 3. 停止服务关闭所有PowerShell窗口" -ForegroundColor Gray
Write-Host ""
Write-Host "==============================================" -ForegroundColor Cyan
Write-Host ""
# 返回项目根目录
Set-Location $projectRoot
Write-Host "是否要打开浏览器访问前端界面?(Y/N)" -ForegroundColor Cyan
$response = Read-Host
if ($response -eq "Y" -or $response -eq "y") {
Start-Process "http://localhost:3000"
}
Write-Host ""
Write-Host "脚本执行完成!" -ForegroundColor Green
Write-Host "按任意键退出..." -ForegroundColor Gray
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

9
scripts/startup/stop.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
# 低代码智能体平台停止脚本
echo "🛑 停止低代码智能体平台服务..."
docker-compose -f docker-compose.dev.yml down
echo "✅ 服务已停止"

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# 查看工作流调试日志的脚本
echo "正在查看后端日志(包含 [rjb] 调试信息)..."
echo "按 Ctrl+C 退出"
echo ""
docker-compose -f docker-compose.dev.yml logs -f backend | grep --line-buffered "\[rjb\]"