Files
tokens-reef/docs/MERGE_QUICKREF.md

74 lines
1.7 KiB
Markdown
Raw Normal View History

# 合并快速参考
## 一键合并命令
```bash
# 标准合并流程
git fetch upstream && git merge upstream/main && cd backend && go build ./cmd/server
```
## 必须保留的本地功能
### 1. 国内模型定价 (`billing_service.go`)
- `initFallbackPricing()` - 所有国内模型fallback定价
- `getFallbackPricing()` - 国内模型匹配逻辑
### 2. 定价数据 (`model_prices_and_context_window.json`)
- GLM系列、通义千问、Kimi、MiniMax、豆包、百川、DeepSeek
### 3. URL白名单 (`config.go`)
- 所有国内模型API域名
## 冲突解决优先级
1. **官方代码** → 基础逻辑
2. **本地定价** → 国内模型支持
3. **合并双方** → URL白名单、配置
## 验证命令
```bash
# 编译验证
go build ./cmd/server
# JSON验证
python -c "import json; json.load(open('resources/model-pricing/model_prices_and_context_window.json', encoding='utf-8'))"
# 测试验证
go test ./... -v -count=1
```
## 定价更新来源
| 厂商 | URL |
|------|-----|
| 智谱 | open.bigmodel.cn/pricing |
| 通义 | help.aliyun.com/zh/dashscope |
| Kimi | platform.moonshot.cn/docs/pricing |
| MiniMax | platform.minimaxi.com/pricing |
| 豆包 | volcengine.com/docs/82379/1290310 |
| DeepSeek | api-docs.deepseek.com/quick_start/pricing |
| 百川 | platform.baichuan-ai.com/prices |
| 硅基流动 | siliconflow.cn/pricing |
## 回滚命令
```bash
# 合并前回滚
git merge --abort
# 合并后回滚
git reset --hard HEAD~1
```
## 完整检查清单
- [ ] `git fetch upstream`
- [ ] `git merge upstream/main`
- [ ] 解决冲突(保留国内模型配置)
- [ ] `go build ./cmd/server`
- [ ] JSON格式验证
- [ ] 国内模型定价完整
- [ ] URL白名单完整
- [ ] `git commit && git push`