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,5 +1,5 @@
|
||||
"""
|
||||
中文直播教育知识库系统 - edu-brain
|
||||
中文直播教育知识库系统 - huibrain
|
||||
"""
|
||||
|
||||
__version__ = "1.2.0"
|
||||
|
||||
@@ -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)",
|
||||
)
|
||||
|
||||
# ──────────────────────────── 属性方法 ────────────────────────────
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -21,7 +21,7 @@ logger = logging.getLogger(__name__)
|
||||
# ──────────────────────────── 创建 MCP Server ────────────────────────────
|
||||
|
||||
mcp = FastMCP(
|
||||
name="EduBrain-Knowledge",
|
||||
name="HuiBrain-Knowledge",
|
||||
instructions=(
|
||||
"中文直播教育知识库助手。你可以使用以下工具来搜索和查询知识库中的内容:\n"
|
||||
"- search_knowledge: 语义搜索知识库,支持按课程、讲师、日期过滤\n"
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user