feat: 配置系统重构,添加用户配置和中文注释

This commit is contained in:
2026-04-23 20:11:22 +08:00
parent e070461fe4
commit dd3c8a03e1
10 changed files with 336 additions and 318 deletions

View File

@@ -326,6 +326,7 @@ func outputLineByLine(text string) {
```yaml
# hxclaw 项目配置文件
# 项目级配置,会覆盖用户配置
# 模拟流式输出配置
streaming:
@@ -334,19 +335,21 @@ streaming:
# Markdown 渲染配置
markdown:
glamour_style: dark # 渲染主题dark, light, dracula, tokyo-night 等
wrap_width: 0 # 自动换行宽度0=自动获取终端宽度)
theme: dark # 渲染主题dark, light, dracula, tokyo-night 等
line_width: 0 # 自动换行宽度0=自动获取终端宽度)
# UI 配置
ui:
logo: "🦐" # Logo
user_prefix: "👀 " # 用户输入前缀
user_icon: "👀 " # 用户输入提示符
```
#### 配置加载优先级
1. 环境变量 `HXCLAW_CONFIG` 指定路径
2. 项目根目录 `project.config.yml`
1. 用户配置 `~/.config/hxclaw/config.yml`
2. 环境变量 `HXCLAW_CONFIG` 指定路径
3. 项目根目录 `project.config.yml`
4. 代码中的默认值
#### 代码实现