- Remove *.bat from .gitignore to track build and utility scripts - Add build.bat for automated PyInstaller packaging with dependency checks - Add run_gui.bat for launching the GUI application with error handling - Add 启动工具.bat interactive menu for accessing all project tools and operations - Add 修复并重新打包.bat comprehensive build script with COM component fixes - Add 配置API密钥.bat utility for configuring API keys in config.json - Enable version control of batch scripts for easier distribution and maintenance
49 lines
1.6 KiB
Batchfile
49 lines
1.6 KiB
Batchfile
@echo off
|
||
chcp 65001 >nul
|
||
title 配置API密钥
|
||
color 0B
|
||
|
||
echo ╔════════════════════════════════════════╗
|
||
echo ║ 配置百炼API密钥工具 ║
|
||
echo ╚════════════════════════════════════════╝
|
||
echo.
|
||
echo 此工具用于在打包前配置API密钥
|
||
echo API密钥将被写入config.json文件
|
||
echo.
|
||
echo ════════════════════════════════════════
|
||
echo.
|
||
|
||
set /p api_key=请输入您的百炼API密钥:
|
||
|
||
if "%api_key%"=="" (
|
||
echo.
|
||
echo [错误] API密钥不能为空
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo.
|
||
echo 正在更新配置文件...
|
||
|
||
python -c "import json; config = json.load(open('config.json', 'r', encoding='utf-8')); config['api_key'] = '%api_key%'; json.dump(config, open('config.json', 'w', encoding='utf-8'), ensure_ascii=False, indent=2)"
|
||
|
||
if errorlevel 1 (
|
||
echo [错误] 配置失败
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo [成功] API密钥已配置
|
||
echo.
|
||
echo ════════════════════════════════════════
|
||
echo 下一步:
|
||
echo ════════════════════════════════════════
|
||
echo 1. 配置目标群组(编辑config.json)
|
||
echo 2. 运行打包脚本(修复并重新打包.bat)
|
||
echo 3. 测试打包后的exe
|
||
echo.
|
||
echo 提示:API密钥已保存在config.json中
|
||
echo 打包后的exe将使用此密钥
|
||
echo.
|
||
pause
|