fix: 对照 API 文档修复 3 个 Adapter 的 8 个实现差异
通过逐接口对比 DeepSeek/AgnesAI/Ollama 官方文档与实现代码,发现并修复:
DeepSeek (4 fix):
- temperature 默认值: 错误发送 0(API默认=1),改为 undefined 让 API 用默认值
- thinking 禁用: API 默认 enabled,不传=开启。改为显式发送 {type:disabled}
- reasoning_effort: 补充 xhigh→max 映射(文档规定)
- stream 请求: 补充 AbortSignal.timeout 超时控制
Agnes AI (2 fix):
- temperature 默认值: 同上
- 图片 image_url: 移除文档未提及的 detail 字段
Ollama (3 fix):
- temperature 默认值: 同上(Ollama默认≈0.8)
- tool_calls arguments: 从对象改为 JSON 字符串(REST API 要求)
- finishReason: 使用 done_reason 字段正确映射(之前始终返回 STOP)
This commit is contained in:
@@ -122,7 +122,7 @@ export class AgnesAdapter extends BaseAdapter {
|
||||
for (const img of origMsg.images) {
|
||||
contentParts.push({
|
||||
type: 'image_url',
|
||||
image_url: { url: img.url, detail: img.detail ?? 'auto' },
|
||||
image_url: { url: img.url },
|
||||
});
|
||||
}
|
||||
messages[i].content = contentParts;
|
||||
@@ -131,7 +131,7 @@ export class AgnesAdapter extends BaseAdapter {
|
||||
const body: Record<string, unknown> = {
|
||||
model: this.config.defaultModel,
|
||||
messages,
|
||||
temperature: request.params.temperature ?? 0,
|
||||
temperature: request.params.temperature,
|
||||
max_tokens: request.params.maxTokens ?? 65536,
|
||||
stream,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user