feat: 新增 LLM AI 错误点评功能,支持通过 OpenAI 兼容 API 对提交代码进行智能分析

This commit is contained in:
2026-05-29 16:04:42 +08:00
parent 606e0855f9
commit b95ede457e
3 changed files with 296 additions and 0 deletions

View File

@@ -145,6 +145,15 @@ static $OJ_LOG_TRACE_ENABLED=false;
static $OJ_SaaS_ENABLE=false;
static $OJ_MENU_NEWS=true;
/* LLM AI Review - AI错误点评功能 */
static $OJ_LLM_ENABLED=false; // 总开关设为true开启AI点评
static $OJ_LLM_API_URL="https://api.openai.com/v1/chat/completions"; // API地址兼容OpenAI格式
static $OJ_LLM_API_KEY=""; // 填入你的API Key
static $OJ_LLM_MODEL="gpt-4o-mini"; // 模型名称
static $OJ_LLM_MAX_TOKENS=1024; // 最大输出token数
static $OJ_LLM_TIMEOUT=30; // 请求超时(秒)
static $OJ_LLM_SYSTEM_PROMPT=""; // 自定义系统prompt留空使用内置默认
require_once(dirname(__FILE__) . "/pdo.php");
require_once(dirname(__FILE__) . "/init.php");