跳到正文
GitHub·· 7 天前AI 评分22

Sorena AI 开源 LeagueAiCoach:用 Gemini 或 Grok 做《英雄联盟》实时语音教练

sorena-ai/LeagueAiCoach

AI 导读

Sorena AI 开源 LeagueAiCoach,一个 FastAPI 服务,输入游戏截图和语音提问即可返回语音指导。它通过 LangChain 封装可切换 Gemini 或 Grok 作为教练模型,用 OpenAI Whisper 转写、OpenAI TTS 生成语音,并支持 WebSocket 实时对局接口。

正文

Sensii API - AI-Powered League of Legends Coach

🎥 Demo

Watch Sensii in Action

Watch the full demo on YouTube


About

FastAPI service that ingests an in-game screenshot plus a voice question, runs the coach model, and replies with audio advice. Uses LangChain wrappers with flexible coach provider (Gemini or Grok, configurable via COACH_PROVIDER and COACH_MODEL env vars) for analysis, OpenAI Whisper for transcription, and OpenAI TTS for speech generation.

Visit us at sensii.gg

Project layout

  • app/routes: FastAPI endpoints (health.py, catalog.py, coach.py, knowledge.py, live.py)
  • app/assistant: Coach logic, prompts, draft agent, TTS
  • app/lib: Shared LangChain clients (langchain.py)
  • app/config.py: Settings loaded from .env
  • data/: Champion data (not tracked in this repo — see below)

Champion data

This project uses the open-source champion data from awesome-league-of-legends. The data is not included in this repository; to run the app you must clone it into data/ yourself:

git clone https://github.com/sorena-ai/awesome-league-of-legends.git data

data/ is git-ignored, so your local copy is never committed.

Setup

git clone git@github.com:sorena-ai/LeagueAiCoach.git
cd sensii
git clone https://github.com/sorena-ai/awesome-league-of-legends.git data
cp .env.example .env   # fill in API keys

Required Environment Variables

  • OPENAI_API_KEY - For Whisper transcription + TTS
  • COACH_PROVIDER - Choose your coach provider: gemini (default) or grok
  • COACH_MODEL - Model name for the selected provider (e.g., gemini-flash-lite-latest or grok-3)
  • GOOGLE_API_KEY - Required if COACH_PROVIDER=gemini
  • GROK_API_KEY - Required if COACH_PROVIDER=grok

Switching Coach Providers

To use Gemini (default):

COACH_PROVIDER=gemini
COACH_MODEL=gemini-flash-lite-latest

To use Grok:

COACH_PROVIDER=grok
COACH_MODEL=grok-3

Just change COACH_PROVIDER and COACH_MODEL in .env - no code changes needed!

Run with Docker Compose

docker-compose up -d --build
# API at http://localhost:8000

Tests

Run the test suite in a clean container build:

docker-compose run --rm --build sensei-api test

Local development (without Docker)

python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
uvicorn app.main:app --reload

Useful endpoints

  • Health: GET /api/v1/health
  • Ready: GET /api/v1/ready
  • Knowledge: POST /api/v1/assistant/knowledge (audio file, optional language)
  • Coach: POST /api/v1/assistant/coach (audio file, required game_stats JSON, optional language)
  • Live: WS /api/v1/assistant/live (in-game realtime; turn.start requires game_stats)

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

Copyright 2025 Sorena AI

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

来源:GitHub · github.com