chore: 项目更名为 HuiBrain
全局替换 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
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# EduBrain - 中文直播教育知识库系统 环境变量配置
|
# HuiBrain - 中文直播教育知识库系统 环境变量配置
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# 复制此文件为 .env 并根据实际情况修改配置值
|
# 复制此文件为 .env 并根据实际情况修改配置值
|
||||||
# cp .env.example .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
|
POSTGRES_PASSWORD=postgres
|
||||||
|
|
||||||
# ── 嵌入模型配置 ──
|
# ── 嵌入模型配置 ──
|
||||||
@@ -77,4 +77,4 @@ DB_PORT=5432
|
|||||||
WEWORK_BOT_ENABLED=false
|
WEWORK_BOT_ENABLED=false
|
||||||
WEWORK_BOT_ID=your-bot-id
|
WEWORK_BOT_ID=your-bot-id
|
||||||
WEWORK_BOT_SECRET=your-bot-secret
|
WEWORK_BOT_SECRET=your-bot-secret
|
||||||
EDUBRAIN_BASE_URL=http://localhost:8765
|
HUIBRAIN_BASE_URL=http://localhost:8765
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# EduBrain - 中文直播教育知识库系统
|
# HuiBrain - 中文直播教育知识库系统
|
||||||
|
|
||||||
基于 FastAPI 的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、AI 语义搜索、企业微信机器人等功能。
|
基于 FastAPI 的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、AI 语义搜索、企业微信机器人等功能。
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
## 项目结构
|
## 项目结构
|
||||||
|
|
||||||
```
|
```
|
||||||
edu-brain/
|
huibrain/
|
||||||
├── app/
|
├── app/
|
||||||
│ ├── main.py # FastAPI 入口,路由注册,生命周期管理,BotManager
|
│ ├── main.py # FastAPI 入口,路由注册,生命周期管理,BotManager
|
||||||
│ ├── config.py # pydantic-settings 配置管理
|
│ ├── config.py # pydantic-settings 配置管理
|
||||||
@@ -90,7 +90,7 @@ edu-brain/
|
|||||||
```bash
|
```bash
|
||||||
# 克隆项目
|
# 克隆项目
|
||||||
git clone <repo-url>
|
git clone <repo-url>
|
||||||
cd edu-brain
|
cd huibrain
|
||||||
|
|
||||||
# 复制配置文件
|
# 复制配置文件
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
@@ -105,7 +105,7 @@ pip install -r requirements.txt
|
|||||||
|
|
||||||
```env
|
```env
|
||||||
# 数据库(默认 SQLite,无需额外配置)
|
# 数据库(默认 SQLite,无需额外配置)
|
||||||
DATABASE_URL=sqlite+aiosqlite:///edu_brain.db
|
DATABASE_URL=sqlite+aiosqlite:///hui_brain.db
|
||||||
|
|
||||||
# OCR(使用 DeepSeek Vision)
|
# OCR(使用 DeepSeek Vision)
|
||||||
OCR_PROVIDER=deepseek
|
OCR_PROVIDER=deepseek
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
中文直播教育知识库系统 - edu-brain
|
中文直播教育知识库系统 - huibrain
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "1.2.0"
|
__version__ = "1.2.0"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
# ──────────────────────────── 数据库 ────────────────────────────
|
# ──────────────────────────── 数据库 ────────────────────────────
|
||||||
DATABASE_URL: str = Field(
|
DATABASE_URL: str = Field(
|
||||||
default="sqlite+aiosqlite:///./edu_brain.db",
|
default="sqlite+aiosqlite:///./hui_brain.db",
|
||||||
description="SQLite 数据库连接字符串",
|
description="SQLite 数据库连接字符串",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -175,9 +175,9 @@ class Settings(BaseSettings):
|
|||||||
default=None,
|
default=None,
|
||||||
description="企业微信智能机器人 Secret",
|
description="企业微信智能机器人 Secret",
|
||||||
)
|
)
|
||||||
EDUBRAIN_BASE_URL: str = Field(
|
HUIBRAIN_BASE_URL: str = Field(
|
||||||
default="http://localhost:8765",
|
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)",
|
||||||
)
|
)
|
||||||
|
|
||||||
# ──────────────────────────── 属性方法 ────────────────────────────
|
# ──────────────────────────── 属性方法 ────────────────────────────
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
|
|||||||
# ──────────────────────────── 创建应用 ────────────────────────────
|
# ──────────────────────────── 创建应用 ────────────────────────────
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="EduBrain - 中文直播教育知识库",
|
title="HuiBrain - 中文直播教育知识库",
|
||||||
description="基于向量检索的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、语义搜索等功能。",
|
description="基于向量检索的中文直播教育知识库系统,支持直播文字稿导入、OCR 截图识别、语义搜索等功能。",
|
||||||
version="1.2.0",
|
version="1.2.0",
|
||||||
lifespan=lifespan,
|
lifespan=lifespan,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ logger = logging.getLogger(__name__)
|
|||||||
# ──────────────────────────── 创建 MCP Server ────────────────────────────
|
# ──────────────────────────── 创建 MCP Server ────────────────────────────
|
||||||
|
|
||||||
mcp = FastMCP(
|
mcp = FastMCP(
|
||||||
name="EduBrain-Knowledge",
|
name="HuiBrain-Knowledge",
|
||||||
instructions=(
|
instructions=(
|
||||||
"中文直播教育知识库助手。你可以使用以下工具来搜索和查询知识库中的内容:\n"
|
"中文直播教育知识库助手。你可以使用以下工具来搜索和查询知识库中的内容:\n"
|
||||||
"- search_knowledge: 语义搜索知识库,支持按课程、讲师、日期过滤\n"
|
"- search_knowledge: 语义搜索知识库,支持按课程、讲师、日期过滤\n"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class WeComBotService:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.bot_id = settings.WEWORK_BOT_ID or ""
|
self.bot_id = settings.WEWORK_BOT_ID or ""
|
||||||
self.bot_secret = settings.WEWORK_BOT_SECRET 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.enabled = settings.WEWORK_BOT_ENABLED
|
||||||
self.ws_client: WSClient | None = None
|
self.ws_client: WSClient | None = None
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class WeComBotService:
|
|||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 调用 EduBrain 搜索
|
# 调用 HuiBrain 搜索
|
||||||
try:
|
try:
|
||||||
results = await self._search_images(keyword)
|
results = await self._search_images(keyword)
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ class WeComBotService:
|
|||||||
# 3. 调用后端 recognize-direct 接口
|
# 3. 调用后端 recognize-direct 接口
|
||||||
async with httpx.AsyncClient(timeout=120.0) as client:
|
async with httpx.AsyncClient(timeout=120.0) as client:
|
||||||
resp = await client.post(
|
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")},
|
files={"file": (save_filename, image_data, "image/jpeg")},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ class WeComBotService:
|
|||||||
"""从后端 API 实时获取当前 search_limit 配置"""
|
"""从后端 API 实时获取当前 search_limit 配置"""
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=5.0) as client:
|
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:
|
if resp.status_code == 200:
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
limit = data.get("search_limit")
|
limit = data.get("search_limit")
|
||||||
@@ -442,7 +442,7 @@ class WeComBotService:
|
|||||||
|
|
||||||
async def _search_images(self, keyword: str) -> list:
|
async def _search_images(self, keyword: str) -> list:
|
||||||
"""
|
"""
|
||||||
调用 EduBrain 搜索接口(SSE 流式),收集所有匹配结果。
|
调用 HuiBrain 搜索接口(SSE 流式),收集所有匹配结果。
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
keyword: 搜索关键词
|
keyword: 搜索关键词
|
||||||
@@ -451,7 +451,7 @@ class WeComBotService:
|
|||||||
匹配结果列表
|
匹配结果列表
|
||||||
"""
|
"""
|
||||||
results = []
|
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()
|
limit = await self._get_search_limit()
|
||||||
|
|
||||||
async with httpx.AsyncClient(timeout=300.0) as client:
|
async with httpx.AsyncClient(timeout=300.0) as client:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: edu-brain-app
|
container_name: huibrain-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "${APP_PORT:-8000}:8000"
|
- "${APP_PORT:-8000}:8000"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# EduBrain 图片功能集成指南
|
# HuiBrain 图片功能集成指南
|
||||||
|
|
||||||
> 本文档介绍如何在 ADK Agent 项目中集成 EduBrain 的图片 OCR 和搜索功能。
|
> 本文档介绍如何在 ADK Agent 项目中集成 HuiBrain 的图片 OCR 和搜索功能。
|
||||||
|
|
||||||
## 服务地址
|
## 服务地址
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ requires = ["setuptools>=75.0", "wheel"]
|
|||||||
build-backend = "setuptools.backends._legacy:_Backend"
|
build-backend = "setuptools.backends._legacy:_Backend"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "edu-brain"
|
name = "huibrain"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
description = "中文直播教育知识库系统 - 基于向量检索的知识管理平台"
|
description = "中文直播教育知识库系统 - 基于向量检索的知识管理平台"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
license = {text = "MIT"}
|
license = {text = "MIT"}
|
||||||
authors = [
|
authors = [
|
||||||
{name = "EduBrain Team"},
|
{name = "HuiBrain Team"},
|
||||||
]
|
]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
@@ -45,8 +45,8 @@ dev = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
edu-brain = "app.main:app"
|
huibrain = "app.main:app"
|
||||||
edu-brain-mcp = "app.mcp.server:run_mcp_server"
|
huibrain-mcp = "app.mcp.server:run_mcp_server"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py311"
|
target-version = "py311"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>EduBrain - 知识库管理</title>
|
<title>HuiBrain - 知识库管理</title>
|
||||||
<style>
|
<style>
|
||||||
/* ═══════════════════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
EduBrain — Stripe-inspired Design System
|
HuiBrain — Stripe-inspired Design System
|
||||||
系统字体栈,零外部依赖
|
系统字体栈,零外部依赖
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@
|
|||||||
<!-- Logo 区域 -->
|
<!-- Logo 区域 -->
|
||||||
<div style="padding: 20px 20px 16px; border-bottom: 1px solid #e5edf5;">
|
<div style="padding: 20px 20px 16px; border-bottom: 1px solid #e5edf5;">
|
||||||
<div style="display:flex; align-items:center; gap:8px;">
|
<div style="display:flex; align-items:center; gap:8px;">
|
||||||
<span style="font-size:20px; font-weight:600; color:#061b31; letter-spacing:-0.02em;">EduBrain</span>
|
<span style="font-size:20px; font-weight:600; color:#061b31; letter-spacing:-0.02em;">HuiBrain</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -551,7 +551,7 @@
|
|||||||
|
|
||||||
<!-- 底部版本信息 -->
|
<!-- 底部版本信息 -->
|
||||||
<div style="padding:12px 20px; border-top:1px solid #e5edf5; color:#64748d; font-size:11px;">
|
<div style="padding:12px 20px; border-top:1px solid #e5edf5; color:#64748d; font-size:11px;">
|
||||||
EduBrain v0.1.0
|
HuiBrain v0.1.0
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -1068,7 +1068,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">服务地址</label>
|
<label class="form-label">服务地址</label>
|
||||||
<input type="text" id="setting-edubrain-base-url" value="http://localhost:8765" class="input-field" style="color:var(--text-secondary); font-size:13px;" readonly>
|
<input type="text" id="setting-huibrain-base-url" value="http://localhost:8765" class="input-field" style="color:var(--text-secondary); font-size:13px;" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user