This repository has been archived on 2026-03-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
YLHP_HR_2.0/main.py
JiaoTianBo 6a5495005e refactor(core): 重构配置与入口模块,统一配置结构并调整导入
- 扁平化应用配置类,合并数据库、LLM、爬虫和通知配置
- 重新实现配置加载,统一环境变量前缀和字段命名
- 入口脚本调整,增加源码路径处理,支持模块绝对导入和直接运行
- HRAgentApplication中使用新配置字段访问方式
- 优化通知渠道注册逻辑,适配新的配置字段重命名
- 模块路径统一由ylhp_hr_2.0改为ylhp_hr_2_0,确保导入一致性
- 删除旧配置模块,避免配置重复和混淆
- service.analysis包暴露MockLLMClient,完善LLM客户端选项
- 保留主入口运行示例,演示系统初始化与功能打印
2026-03-24 11:57:45 +08:00

79 lines
2.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Resume Intelligence Agent - Entry Point
简历智能体系统入口
Usage:
# 运行应用
uv run python main.py
# 或使用模块方式
uv run python -m src.main.python.cn.yinlihupo.ylhp_hr_2.0.main
Environment Variables:
# 数据库配置
DB_URL=mysql+pymysql://root:123456@10.200.8.25:3306/hr_agent
# LLM 配置
LLM_PROVIDER=mock
LLM_API_KEY=your_api_key
# 爬虫配置
CRAWLER_BOSS_WT_TOKEN=your_boss_token
# 通知配置
NOTIFY_WECHAT_WORK_WEBHOOK=https://qyapi.weixin.qq.com/cgi-bin/webhook/...
"""
import asyncio
import sys
from pathlib import Path
# 添加源码路径到 sys.path
src_path = Path(__file__).parent / "src" / "main" / "python"
if str(src_path) not in sys.path:
sys.path.insert(0, str(src_path))
# 导入应用
from cn.yinlihupo.ylhp_hr_2_0.main import HRAgentApplication, get_app
from cn.yinlihupo.ylhp_hr_2_0.domain.candidate import CandidateSource
async def demo():
"""演示:使用 HR Agent 进行简历处理"""
print("=" * 50)
print("简历智能体系统 - 演示")
print("=" * 50)
# 初始化应用
app = get_app()
print("\n已注册爬虫:")
for source in app.crawler_factory.get_registered_sources():
print(f" - {source.value}")
print("\n已配置通知渠道:")
if app.notification_service:
for channel_type in app.notification_service.get_configured_channels():
print(f" - {channel_type.value}")
else:
print(" - 无")
print("\n可用的评价方案:")
schemas = app.analyzer.schema_service.list_schemas()
for schema in schemas:
default_mark = " (默认)" if schema.is_default else ""
print(f" - {schema.name}{default_mark}")
print("\n" + "=" * 50)
print("系统初始化完成")
print("=" * 50)
# 示例:爬取并入库(需要配置 CRAWLER_BOSS_WT_TOKEN
# await app.crawl_and_ingest(
# source=CandidateSource.BOSS,
# job_id="your_job_id"
# )
if __name__ == "__main__":
asyncio.run(demo())