fix: 按 DeepSeek 文档为每种调用指定是否思考,修复分类器拿不到结果
deepseek-flash 默认先思考(reasoning_effort high),思考也占输出 token,思考模式下 temperature 无效。 分类器只给 10 个 token,全被思考用掉,正文为空,切到新后端后的提问都没有层级。 - 生成代码:开思考;引导:关思考,回得快;分类:关思考,temperature 0 才生效 - thinking 只发给 DeepSeek,豆包请求不变 - 实测 deepseek-flash:分类约 1.2s,引导约 1.5s;固定 68 条样本两次一致 65 条 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b765cbf1aa
commit
6b2ffbb3ec
3 files changed
+27
-15
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
extractCode,
|
||||
parseGuidanceResponse,
|
||||
streamChat,
|
||||
streamGuidance,
|
||||
trimHistory,
|
||||
userFacingError,
|
||||
} from "../src/services/llm"
|
||||
@@ -77,12 +78,13 @@ test("CSV 转义", () => {
|
||||
})
|
||||
|
||||
describe("streamChat", () => {
|
||||
test("不认识的模型换成默认模型,最后一行没有换行也能读到", async () => {
|
||||
test("不认识的模型换成默认模型,最后一行没有换行也能读到;生成代码开思考,引导不开", async () => {
|
||||
let model = ""
|
||||
let thinking: unknown
|
||||
const server = Bun.serve({
|
||||
port: 0,
|
||||
async fetch(req) {
|
||||
model = ((await req.json()) as any).model
|
||||
;({ model, thinking } = (await req.json()) as any)
|
||||
const line = (s: string) => `data: ${JSON.stringify({ choices: [{ delta: { content: s } }] })}`
|
||||
// 一行拆在两个分块之间,最后一行不带换行
|
||||
const body = `${line("你好")}\n\n${line("世")}\n${line("界")}`
|
||||
@@ -108,6 +110,9 @@ describe("streamChat", () => {
|
||||
for await (const s of streamChat([{ role: "user", content: "hi" }], "deepseek-v4-flash-thinking")) out += s
|
||||
expect(out).toBe("你好世界")
|
||||
expect(model).toBe(config.llmModel)
|
||||
expect(thinking).toEqual({ type: "enabled" })
|
||||
for await (const _ of streamGuidance([{ role: "user", content: "hi" }]));
|
||||
expect(thinking).toEqual({ type: "disabled" })
|
||||
} finally {
|
||||
Object.assign(config, saved)
|
||||
server.stop(true)
|
||||
|
||||
Reference in new issue
Block a user