AI健身教练

一款基于Strava数据的开源AI健身教练,提供智能训练建议、训练计划生成和个性化分析。

  • by Joe-Heffer
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 Joe-Heffer/trainer

使用说明

教练

一款基于Strava数据的开源智能健身和健康私人教练。

特性

  • 人工智能驱动的教练:获得由高级LLM提供的智能培训建议
  • Strava集成:从Strava自动分析您的训练
  • 锻炼分析:收到详细的反馈和个性化建议
  • 培训计划:根据您的目标和健身水平制定定制计划
  • 会话界面:与你的人工智能培训师自然地讨论训练、恢复和表现

快速开始

先决条件

安装

  1. 克隆并安装:

    git clone https://github.com/Joe-Heffer/trainer.git
    cd trainer
    pip install -e .
    
  2. 设置Strava MCP服务器:

    # Clone and build the Strava MCP server
    git clone https://github.com/r-huijts/strava-mcp.git
    cd strava-mcp
    npm install
    npm run build
    
    # Authenticate with Strava (creates API app and gets tokens)
    npx tsx scripts/setup-auth.ts
    # Follow the prompts to authorize with Strava
    
  3. 配置环境:

    cd ../trainer
    cp .env.example .env
    # Edit .env and add:
    # - GOOGLE_API_KEY: Your Google Gemini API key (https://aistudio.google.com/apikey)
    # - STRAVA_MCP_PATH: Absolute path to strava-mcp/dist/server.js
    

    示例 .env:

    GOOGLE_API_KEY=your_gemini_api_key_here
    STRAVA_MCP_PATH=/absolute/path/to/strava-mcp/dist/server.js
    LOG_LEVEL=WARNING
    

用法

命令行

trainer

对于论点:

trainer --help

程序化

from trainer import TrainerAgent

agent = TrainerAgent()
await agent.initialize()

# Analyze a workout
analysis = await agent.analyze_workout("activity_id")

# Create a training plan
plan = await agent.create_training_plan(
    goal="Run a half marathon under 2 hours",
    weeks=12
)

对话示例

💪> What should I do to improve my cycling performance?

Based on your Strava data, here's what I see:
- You've been cycling consistently with multiple rides per week
- Your distances vary from 7km to 80km
- You're incorporating regular weight training which supports cycling performance

Recommendations:
1. **Structured Training Zones:** Add interval training to improve VO2 max
2. **Progressive Overload:** Gradually increase ride duration and intensity
3. **Strength Training:** Continue your weight training - it's great for power
4. **Recovery:** Ensure adequate rest between hard efforts
5. **Nutrition:** Focus on pre-ride and during-ride fueling for longer sessions

Would you like me to create a specific training plan for your cycling goals?

💪> quit
👋 Thanks for training with trAIner!

文档

对于用户:

对于贡献者:

贡献

我们欢迎捐款!看 贡献.md 开始吧。

支持

许可证

MIT许可证-请参阅 许可证 了解详情。

致谢

内置: