From 4c6a20e5fc75f4b0655594b209dc893262c30f1b Mon Sep 17 00:00:00 2001 From: EduBrain Dev Date: Tue, 14 Apr 2026 15:03:43 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=A1=B9=E7=9B=AE=E6=9B=B4=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=20HuiBrain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 全局替换 EduBrain -> HuiBrain, edu-brain -> huibrain, edu_brain -> hui_brain, EDUBRAIN -> HUIBRAIN 涉及文件:README.md, pyproject.toml, docker-compose.yml, .env, .env.example, app/config.py, app/main.py, app/wework_bot.py, app/__init__.py, app/mcp/server.py, static/index.html, docs/IMAGE_API_GUIDE.md --- .env.example | 6 +++--- README.md | 8 ++++---- app/__init__.py | 2 +- app/config.py | 6 +++--- app/main.py | 2 +- app/mcp/server.py | 2 +- app/wework_bot.py | 12 ++++++------ docker-compose.yml | 2 +- docs/IMAGE_API_GUIDE.md | 4 ++-- pyproject.toml | 8 ++++---- static/index.html | 10 +++++----- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.env.example b/.env.example index ca72715..44a58e8 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,12 @@ # ============================================================ -# EduBrain - 中文直播教育知识库系统 环境变量配置 +# HuiBrain - 中文直播教育知识库系统 环境变量配置 # ============================================================ # 复制此文件为 .env 并根据实际情况修改配置值 # cp .env.example .env # ============================================================ # ── 数据库 ── -DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/edu_brain +DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/hui_brain POSTGRES_PASSWORD=postgres # ── 嵌入模型配置 ── @@ -77,4 +77,4 @@ DB_PORT=5432 WEWORK_BOT_ENABLED=false WEWORK_BOT_ID=your-bot-id WEWORK_BOT_SECRET=your-bot-secret -EDUBRAIN_BASE_URL=http://localhost:8765 +HUIBRAIN_BASE_URL=http://localhost:8765 diff --git a/README.md b/README.md index d777dd6..79787c1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# EduBrain - 中文直播教育知识库系统 +# HuiBrain - 中文直播教育知识库系统 基于 FastAPI 的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、AI 语义搜索、企业微信机器人等功能。 @@ -52,7 +52,7 @@ ## 项目结构 ``` -edu-brain/ +huibrain/ ├── app/ │ ├── main.py # FastAPI 入口,路由注册,生命周期管理,BotManager │ ├── config.py # pydantic-settings 配置管理 @@ -90,7 +90,7 @@ edu-brain/ ```bash # 克隆项目 git clone -cd edu-brain +cd huibrain # 复制配置文件 cp .env.example .env @@ -105,7 +105,7 @@ pip install -r requirements.txt ```env # 数据库(默认 SQLite,无需额外配置) -DATABASE_URL=sqlite+aiosqlite:///edu_brain.db +DATABASE_URL=sqlite+aiosqlite:///hui_brain.db # OCR(使用 DeepSeek Vision) OCR_PROVIDER=deepseek diff --git a/app/__init__.py b/app/__init__.py index 3f89385..561db39 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,5 +1,5 @@ """ -中文直播教育知识库系统 - edu-brain +中文直播教育知识库系统 - huibrain """ __version__ = "1.2.0" diff --git a/app/config.py b/app/config.py index c372add..07b341f 100644 --- a/app/config.py +++ b/app/config.py @@ -46,7 +46,7 @@ class Settings(BaseSettings): # ──────────────────────────── 数据库 ──────────────────────────── DATABASE_URL: str = Field( - default="sqlite+aiosqlite:///./edu_brain.db", + default="sqlite+aiosqlite:///./hui_brain.db", description="SQLite 数据库连接字符串", ) @@ -175,9 +175,9 @@ class Settings(BaseSettings): default=None, description="企业微信智能机器人 Secret", ) - EDUBRAIN_BASE_URL: str = Field( + HUIBRAIN_BASE_URL: str = Field( default="http://localhost:8765", - description="EduBrain 后端服务地址,企业微信机器人通过此地址调用后端 API(搜索/OCR识别等)。当机器人与后端部署在同一台机器时使用默认值 http://localhost:8765;若机器人独立部署到其他服务器,需改为后端的实际访问地址(如 http://192.168.1.100:8765)", + description="HuiBrain 后端服务地址,企业微信机器人通过此地址调用后端 API(搜索/OCR识别等)。当机器人与后端部署在同一台机器时使用默认值 http://localhost:8765;若机器人独立部署到其他服务器,需改为后端的实际访问地址(如 http://192.168.1.100:8765)", ) # ──────────────────────────── 属性方法 ──────────────────────────── diff --git a/app/main.py b/app/main.py index 6052517..988ce02 100644 --- a/app/main.py +++ b/app/main.py @@ -182,7 +182,7 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]: # ──────────────────────────── 创建应用 ──────────────────────────── app = FastAPI( - title="EduBrain - 中文直播教育知识库", + title="HuiBrain - 中文直播教育知识库", description="基于向量检索的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、语义搜索等功能。", version="1.2.0", lifespan=lifespan, diff --git a/app/mcp/server.py b/app/mcp/server.py index 1a6fb35..edfb230 100644 --- a/app/mcp/server.py +++ b/app/mcp/server.py @@ -21,7 +21,7 @@ logger = logging.getLogger(__name__) # ──────────────────────────── 创建 MCP Server ──────────────────────────── mcp = FastMCP( - name="EduBrain-Knowledge", + name="HuiBrain-Knowledge", instructions=( "中文直播教育知识库助手。你可以使用以下工具来搜索和查询知识库中的内容:\n" "- search_knowledge: 语义搜索知识库,支持按课程、讲师、日期过滤\n" diff --git a/app/wework_bot.py b/app/wework_bot.py index 62d766a..e6bc441 100644 --- a/app/wework_bot.py +++ b/app/wework_bot.py @@ -44,7 +44,7 @@ class WeComBotService: def __init__(self): self.bot_id = settings.WEWORK_BOT_ID or "" self.bot_secret = settings.WEWORK_BOT_SECRET or "" - self.edubrain_base_url = settings.EDUBRAIN_BASE_URL + self.huibrain_base_url = settings.HUIBRAIN_BASE_URL self.enabled = settings.WEWORK_BOT_ENABLED self.ws_client: WSClient | None = None @@ -152,7 +152,7 @@ class WeComBotService: False, ) - # 调用 EduBrain 搜索 + # 调用 HuiBrain 搜索 try: results = await self._search_images(keyword) @@ -265,7 +265,7 @@ class WeComBotService: # 3. 调用后端 recognize-direct 接口 async with httpx.AsyncClient(timeout=120.0) as client: resp = await client.post( - f"{self.edubrain_base_url}/api/v1/images/recognize-direct", + f"{self.huibrain_base_url}/api/v1/images/recognize-direct", files={"file": (save_filename, image_data, "image/jpeg")}, ) @@ -430,7 +430,7 @@ class WeComBotService: """从后端 API 实时获取当前 search_limit 配置""" try: async with httpx.AsyncClient(timeout=5.0) as client: - resp = await client.get(f"{self.edubrain_base_url}/api/v1/settings") + resp = await client.get(f"{self.huibrain_base_url}/api/v1/settings") if resp.status_code == 200: data = resp.json() limit = data.get("search_limit") @@ -442,7 +442,7 @@ class WeComBotService: async def _search_images(self, keyword: str) -> list: """ - 调用 EduBrain 搜索接口(SSE 流式),收集所有匹配结果。 + 调用 HuiBrain 搜索接口(SSE 流式),收集所有匹配结果。 Args: keyword: 搜索关键词 @@ -451,7 +451,7 @@ class WeComBotService: 匹配结果列表 """ results = [] - url = f"{self.edubrain_base_url}/api/v1/images/search" + url = f"{self.huibrain_base_url}/api/v1/images/search" limit = await self._get_search_limit() async with httpx.AsyncClient(timeout=300.0) as client: diff --git a/docker-compose.yml b/docker-compose.yml index 1a14397..1f849d2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: context: . dockerfile: Dockerfile - container_name: edu-brain-app + container_name: huibrain-app restart: unless-stopped ports: - "${APP_PORT:-8000}:8000" diff --git a/docs/IMAGE_API_GUIDE.md b/docs/IMAGE_API_GUIDE.md index b70b72c..57cc60f 100644 --- a/docs/IMAGE_API_GUIDE.md +++ b/docs/IMAGE_API_GUIDE.md @@ -1,6 +1,6 @@ -# EduBrain 图片功能集成指南 +# HuiBrain 图片功能集成指南 -> 本文档介绍如何在 ADK Agent 项目中集成 EduBrain 的图片 OCR 和搜索功能。 +> 本文档介绍如何在 ADK Agent 项目中集成 HuiBrain 的图片 OCR 和搜索功能。 ## 服务地址 diff --git a/pyproject.toml b/pyproject.toml index d7ac88b..ea46d76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,14 +3,14 @@ requires = ["setuptools>=75.0", "wheel"] build-backend = "setuptools.backends._legacy:_Backend" [project] -name = "edu-brain" +name = "huibrain" version = "1.2.0" description = "中文直播教育知识库系统 - 基于向量检索的知识管理平台" readme = "README.md" requires-python = ">=3.11" license = {text = "MIT"} authors = [ - {name = "EduBrain Team"}, + {name = "HuiBrain Team"}, ] classifiers = [ "Development Status :: 3 - Alpha", @@ -45,8 +45,8 @@ dev = [ ] [project.scripts] -edu-brain = "app.main:app" -edu-brain-mcp = "app.mcp.server:run_mcp_server" +huibrain = "app.main:app" +huibrain-mcp = "app.mcp.server:run_mcp_server" [tool.ruff] target-version = "py311" diff --git a/static/index.html b/static/index.html index fe539fe..3987f5a 100644 --- a/static/index.html +++ b/static/index.html @@ -3,10 +3,10 @@ - EduBrain - 知识库管理 + HuiBrain - 知识库管理