feat: add seed-36b <seed:think></seed:think> parser support (#9498)

* feat: add seed-36b thinking tag parser support

Signed-off-by: jwinpbe <jwin_pbe@proton.me>

* fix: capitalize model name for proper parsing

Signed-off-by: jwinpbe <jwin_pbe@proton.me>

* Revert "fix: capitalize model name for proper parsing"

This reverts commit dd9b45e3f4.

* fix: make seed-36b model parser case-insensitive

Signed-off-by: jwinpbe <jwin_pbe@proton.me>

* refactor(ThinkingTagExtractionMiddleware): 使用getLowerBaseModelName统一处理模型ID

简化模型ID比较逻辑,避免重复调用toLowerCase方法

---------

Signed-off-by: jwinpbe <jwin_pbe@proton.me>
Co-authored-by: jwinpbe <jwin_pbe@proton.me>
Co-authored-by: icarus <eurfelux@gmail.com>
This commit is contained in:
JwinPBE 2025-08-25 06:12:14 +00:00 committed by GitHub
parent 4b02878390
commit cce88745c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ import {
ThinkingDeltaChunk,
ThinkingStartChunk
} from '@renderer/types/chunk'
import { getLowerBaseModelName } from '@renderer/utils'
import { TagConfig, TagExtractor } from '@renderer/utils/tagExtraction'
import { CompletionsParams, CompletionsResult, GenericChunk } from '../schemas'
@ -22,13 +23,16 @@ const reasoningTags: TagConfig[] = [
{ openingTag: '<thought>', closingTag: '</thought>', separator: '\n' },
{ openingTag: '###Thinking', closingTag: '###Response', separator: '\n' },
{ openingTag: '◁think▷', closingTag: '◁/think▷', separator: '\n' },
{ openingTag: '<thinking>', closingTag: '</thinking>', separator: '\n' }
{ openingTag: '<thinking>', closingTag: '</thinking>', separator: '\n' },
{ openingTag: '<seed:think>', closingTag: '</seed:think>', separator: '\n' }
]
const getAppropriateTag = (model?: Model): TagConfig => {
if (model?.id?.includes('qwen3')) return reasoningTags[0]
if (model?.id?.includes('gemini-2.5')) return reasoningTags[1]
if (model?.id?.includes('kimi-vl-a3b-thinking')) return reasoningTags[3]
const modelId = model?.id ? getLowerBaseModelName(model.id) : undefined
if (modelId?.includes('qwen3')) return reasoningTags[0]
if (modelId?.includes('gemini-2.5')) return reasoningTags[1]
if (modelId?.includes('kimi-vl-a3b-thinking')) return reasoningTags[3]
if (modelId?.includes('seed-oss-36b')) return reasoningTags[5]
// 可以在这里添加更多模型特定的标签配置
return reasoningTags[0] // 默认使用 <think> 标签
}