feat: 使用 tomlkit 替换 toml,增强配置文件的读取和写入功能,保留注释和格式

This commit is contained in:
墨梓柒
2025-11-29 14:24:10 +08:00
parent ccda410ab4
commit d7932595e8
2 changed files with 28 additions and 17 deletions

View File

@@ -586,8 +586,8 @@ async def save_adapter_config(data: dict[str, str] = Body(...)):
# 验证 TOML 格式
try:
import toml
toml.loads(content)
import tomlkit
tomlkit.loads(content)
except Exception as e:
raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}")