alongLFB/lol-ai-eval

这是一个结合 Riot Games API 和 AI(如 OpenAI/DeepSeek)的英雄联盟评价和数据分析工具。项目基于 Next.js 框架构建。

★ 1Forks 0TypeScriptGitHub ↗Compare

Project website ↗

README

LOL AI Eval (AI 召唤师神谕)

English | 中文


English

A Next.js application that integrates the Riot Games API and Large Language Models (LLMs) (OpenAI/DeepSeek, etc.) to evaluate, roast, or praise Summoners' recent match history. It features an OP.GG-style match history interface, dynamic game data visualization, and shareable match reports.

🌟 Key Features

  • 🔮 AI Oracle Evaluation: Uses an LLM to generate memes roasting or praising players' recent performance based on their match statistics.
  • 🌐 Internationalization (i18n): Seamlessly toggle between English and Chinese. UI elements, champions, items, queue types, and ranks are fully localized.
  • 🎮 OP.GG-Style Match History:
    • Game Type Identification: Visually categorizes matches (Ranked Solo/Duo, Ranked Flex, ARAM, Normal Draft, etc.) with custom-themed labels.
    • Detailed Stats: Displays K/D/A, KDA Ratio, Kill Participation, Creep Score (CS & CS/min), and Vision Score.
    • Full Build & Loadouts (8-Slot System): Shows summoner spells, primary/secondary runes, six item slots, trinket, and natively supports the 8th slot for quest rewards/special enchantments.
    • Achievements & Badges: Identifies multikills (Double Kill up to Pentakill) and awards MVP/ACE titles.
    • 👑 Win Streak Tracking: Intelligently tracks your recent performance and displays a glowing Crown badge for active win streaks (≥ 3 wins), ignoring Remakes.
  • 📊 Expandable Match Details (No Extra API Cost):
    • Clicking a match opens a detailed list of all 10 participants.
    • Responsive Elastic Layout: Optimized for both mobile and desktop. Intelligent CSS grid wrapping for seamless transitions without messy overflow scrollbars.
    • Displays champion level, item builds, spells, KDA, CS, and damage dealt to champions (visualized with relative damage bars).
    • Smart Lobby Rank Detection: On expansion, the app asynchronously loads the ranks of all 10 players to display individual ranks and calculate the average lobby rank.
  • 📸 Shareable Poster Card: Generate a high-resolution PNG image of the AI Oracle evaluation and recent match history card with a single click, ready for social sharing.
  • ⚡ Automated CI/CD: GitHub Actions workflow preconfigured for automatic deployment to cloud servers using PM2.

💻 Local Development Guide

1. Requirements

  • Node.js (v18 or higher recommended)
  • npm / yarn / pnpm

2. Install Dependencies

npm install

3. Environment Configuration

Copy the template file to .env.local:

cp .env.example .env.local

Fill in the environment variables:

  • RIOT_API_KEY: Your Riot Games Developer API Key.
  • AI_API_KEY: Your API key for OpenAI, DeepSeek, or any OpenAI-compatible provider.
  • AI_BASE_URL: Base URL of your AI provider.
  • AI_MODEL: Model name (e.g., gpt-3.5-turbo, deepseek-chat).

4. Run Development Server

npm run dev

Open http://localhost:3000 to view the application.


🐳 Docker Deployment Guide

1. Quick Start with Docker Compose (Recommended)

Make sure you have created your .env file from .env.example:

cp .env.example .env
# Edit .env and fill in your RIOT_API_KEY and AI_API_KEY

Build and run in the background:

docker compose up -d --build

The application will be accessible at http://localhost:3006.

To stop the container:

docker compose down

2. Manual Docker Build & Run

# Build the Docker image
docker build -t lol-ai-eval .

# Run container with environment variables file
docker run -d --name lol-ai-eval -p 3006:3006 --env-file .env lol-ai-eval

🚀 CI/CD Server Deployment (GitHub Actions + Docker)

A preconfigured GitHub Actions workflow (.github/workflows/deploy.yml) is available to deploy updates automatically when code is pushed to the master branch.

1. Server Setup

Ensure your server has the following installed:

  • Git
  • Docker & Docker Compose

2. Repository Secrets

Under your GitHub Repository Settings -> Secrets and variables -> Actions, add:

  • SERVER_HOST: Public IP of your server.
  • SERVER_USER: Server username (e.g., root, ubuntu).
  • SERVER_SSH_KEY: Private SSH Key contents used to access the server.
  • SERVER_PORT: SSH port (default: 22).
  • ENV_FILE: Copy all contents of your .env file. The deployment runner will dynamically generate the environment file on the server.

中文

这是一个结合了 Riot Games API 和 AI 大语言模型(OpenAI/DeepSeek 等)的英雄联盟战绩评价与数据分析工具。项目基于 Next.js 框架构建,提供类似 OP.GG 的战绩展示、动态对局细节以及可分享的 AI 裁决报告。

🌟 功能特性

  • 🔮 水晶枢纽 AI 裁决:根据玩家近期的战绩数据,由 AI 生成毒舌嘲讽或热血赞美的大字报评价。
  • 🌐 多语言与国际化 (i18n):原生支持一键切换中文/英文,从基础 UI 到英雄、段位、装备及模式名称全盘本地化。
  • 🎮 OP.GG 风格对战历史:
    • 对局类型标记:区分单双排、灵活组排、大乱斗、匹配等模式,提供彩色标签。
    • 详细战绩数据:展示 K/D/A、KDA 比率、击杀参与率、CS(补刀数与分均补刀)、视野得分。
    • 完美还原 8 槽位装备栏:除了召唤师技能、主副系符文、核心 6 神装与饰品眼,全面支持第 8 个独立奖励槽位展示。
    • 成就徽章:自动标记多杀情况(双杀至五杀),并基于算法授予队伍 MVP/ACE 勋章。
    • 👑 专属连胜皇冠:自动追踪并计算最近战绩的连胜场次,达到 3 连胜及以上时展示炫酷的流光连胜徽章(智能排除提前重开局)。
  • 📊 可展开的对战详情(极低 API 消耗):
    • 点击任意对战行即可展开查看双方队伍 10 位玩家的完整信息。
    • 极致的响应式弹性布局:全自动适应移动端和桌面大屏,智能动态折叠/平铺装备栏网格,彻底告别臃肿的横向滚动条。
    • 展示英雄等级、出装、技能、KDA、CS、对英雄造成的伤害(带有直观的伤害进度条)。
    • 智能大厅段位检测:点击展开时,异步并行拉取 10 位玩家的实时段位,计算并显示该场对局的平均段位及个人的段位等级。
  • 📸 战绩大字报分享:一键生成高清晰度 PNG 分享长图,包含 AI 裁决与精美战绩,方便炫耀分享至社交平台。
  • ⚡ 自动化部署 CI/CD:内置 GitHub Actions 工作流,支持代码推送至 master 分支后自动通过 Docker Compose 部署至云服务器。

💻 本地开发指南

1. 环境要求

  • Node.js (推荐 v18 或更高版本)
  • npm / yarn / pnpm

2. 安装依赖

npm install

3. 配置环境变量

复制根目录的示例环境变量文件并重命名为 .env.local:

cp .env.example .env.local

然后在 .env.local 中填入你的 API 密钥信息:

  • RIOT_API_KEY: Riot Games 开发者 API 密钥
  • AI_API_KEY: 你的 OpenAI 或 DeepSeek 等兼容平台的 API 密钥
  • AI_BASE_URL: AI 接口服务地址
  • AI_MODEL: 使用的 AI 模型名称

4. 启动开发服务器

npm run dev

打开浏览器访问 http://localhost:3000 即可查看效果。


🐳 Docker 容器化部署指南

1. Docker Compose 一键启动(推荐)

配置好 .env 文件后,在项目根目录运行:

# 构建并后台启动容器
docker compose up -d --build

启动成功后,访问 http://localhost:3006 即可。

查看运行日志:

docker compose logs -f

停止容器:

docker compose down

2. 原生 Docker 命令构建与运行

# 构建镜像
docker build -t lol-ai-eval .

# 启动容器并挂载环境变量
docker run -d \
  --name lol-ai-eval \
  -p 3006:3006 \
  --env-file .env \
  --restart unless-stopped \
  lol-ai-eval

🚀 CI/CD 自动部署指南 (GitHub Actions + Docker)

项目已配置好 GitHub Actions 工作流(.github/workflows/deploy.yml),当代码 push 到 master 分支时会自动触发 Docker 构建与部署。

1. 服务器准备工作

为了使自动部署生效,你的目标服务器(Ubuntu/Debian/CentOS 等)需要安装:

  • Git
  • Docker & Docker Compose

2. GitHub 仓库 Secrets 配置

进入你的 GitHub 仓库 -> Settings -> Secrets and variables -> Actions,点击 New repository secret 依次添加以下 Secrets:

  • SERVER_HOST: 你的服务器公网 IP
  • SERVER_USER: 登录服务器的用户名(如 root、ubuntu)
  • SERVER_SSH_KEY: 用于登录服务器的 SSH 私钥(~/.ssh/id_rsa 的内容)
  • SERVER_PORT: SSH 端口(可选,默认为 22)
  • ENV_FILE: (重要)你的完整环境变量内容。将你本地 .env 的所有内容复制并粘贴到此 Secret 中。自动部署脚本会在服务器上动态生成 .env 文件。

Contributors

alongLFB

Issues