Skip to content

Commit b0f8ccd

Browse files
authored
fix: 移除对MaxTokens的硬性设置以支持模型默认值 (#105)
避免在请求中明确设置MaxTokens时覆盖模型默认的最大令牌限制,从而允许模型使用其预设的上下文长度上限。
1 parent 2681b72 commit b0f8ccd

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

.github/.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
linters:
2-
default: none
2+
disable-all: true
33
enable:
44
- gocognit # 检查函数 Cognitive Complexity 复杂度
55
- gofmt

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "2"
22

33
linters:
4-
default: none
4+
disable-all: true
55
enable:
66
# - dupl # 重复代码
77
# - errcheck # 检查是否存在未处理的错误

docs/ModelModal.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ function App() {
207207
pnpm install
208208
```
209209

210+
3. **代码检查**
211+
```bash
212+
make lint
213+
```
214+
210215
### 运行示例环境
211216

212217
项目提供了一键启动测试环境的命令,可以同时启动后端服务和前端示例:
@@ -219,4 +224,3 @@ make dev
219224
1. 启动后端服务 (`test/backend/main.go`)
220225
2. 启动前端开发服务器 (`test/ui_example`)
221226

222-

usecase/helper.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ func (m *ModelKit) getChatModelGenerateChat(ctx context.Context, provider consts
6767
if req.Param.Temperature != nil {
6868
md.Temperature = req.Param.Temperature
6969
}
70-
if req.Param.MaxTokens > 0 {
71-
md.MaxTokens = &req.Param.MaxTokens
72-
}
7370
}
7471

7572
chatModel, err := m.GetChatModel(ctx, md)

0 commit comments

Comments
 (0)