feat: 集成大模型AI、重构构建系统并修复多项代码质量问题

- 构建系统:Makefile 迁移至 CMakeLists.txt,支持 cJSON 和 WinHTTP
- 项目结构:src/ 按功能拆分为 core/、gui/、network/、record/、llm/ 子目录
- 新功能:集成大模型 AI(WinHTTP + cJSON,兼容 OpenAI 协议),支持异步请求
- 渲染修复:IupDraw* 替换为 Windows GDI,修复画布黑屏问题
- 网络修复:ENet 初始化幂等化,实现真实 get_local_ip() (Winsock)
- 代码质量:删除死代码 (dfs/count_threats_in_direction),修复头文件守卫,
  sprintf→snprintf 防溢出,strncpy 安全终止,GDI 资源泄漏修复

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-02 15:32:54 +08:00
parent f897536a45
commit 96a94aaddf
25 changed files with 4631 additions and 363 deletions
+11
View File
@@ -135,6 +135,17 @@
#define CONFIG_FILE "gobang_config.ini" // 配置文件路径
#define MAX_PATH_LENGTH 256 // 最大路径长度
//---------- LLM大模型参数 ----------//
#define DEFAULT_LLM_USE 0 // 默认不使用LLM (0=算法AI, 1=大模型)
#define DEFAULT_LLM_ENDPOINT "https://api.minimax.chat/v1/chat/completions" // 默认API地址
#define DEFAULT_LLM_API_KEY "" // 默认API Key (需用户填写)
#define DEFAULT_LLM_MODEL "MiniMax-Text-01" // 默认模型名
#define MAX_LLM_ENDPOINT_LEN 256 // API地址最大长度
#define MAX_LLM_API_KEY_LEN 128 // API Key最大长度
#define MAX_LLM_MODEL_LEN 64 // 模型名最大长度
#define LLM_MAX_RETRIES 3 // LLM返回非法坐标时最大重试次数
#define LLM_TIMEOUT_MS 30000 // LLM HTTP请求超时(毫秒)
//---------- 配置管理函数声明 ----------//
/**
* @brief 加载游戏配置