Files
Enterprise-Knowledge-Base/frontend/src/utils/thinkingControl.test.ts
T
wizardchen e2a41ecf0a feat(thinkingControl): implement thinking mode configuration in model editor
- Added a new thinking mode control field in the ModelEditorDialog, allowing users to specify how the agent's thinking mode is formatted for API requests.
- Introduced localization strings for thinking mode labels and descriptions in English, Korean, Russian, and Chinese, enhancing user experience across multiple languages.
- Updated the model form data structure to include thinking control settings, ensuring proper handling during model edits and saves.
- Implemented utility functions for resolving and defaulting thinking control values based on provider and model, improving backend integration.
- Added tests for the new thinking control functionality to ensure reliability and correctness in handling user configurations.
2026-06-05 14:56:48 +08:00

37 lines
1.3 KiB
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { defaultThinkingControl } from './thinkingControl.ts'
// Cases mirror internal/models/chat/provider_test.go TestResolveProvider thinking defaults.
test('defaultThinkingControl matches backend provider adapters', () => {
const cases: Array<[string, string, ReturnType<typeof defaultThinkingControl>]> = [
['generic', 'anything', 'chat_template_kwargs'],
['nvidia', 'anything', 'chat_template_kwargs'],
['volcengine', 'doubao', 'thinking_type'],
['aliyun', 'qwen3-32b', 'enable_thinking'],
['aliyun', 'qwen-plus', 'enable_thinking'],
['aliyun', 'gpt-4', 'none'],
['lkeap', '', 'thinking_type'],
['lkeap', 'deepseek-v3.1', 'thinking_type'],
['lkeap', 'deepseek-r1', 'none'],
['openai', 'gpt-4o', 'none'],
['openai', 'gpt-5', 'none'],
['azure_openai', 'gpt-4', 'none'],
['deepseek', 'deepseek-chat', 'none'],
['zhipu', 'glm-4', 'none'],
['gemini', 'gemini-2.0', 'none'],
['siliconflow', 'qwen3-8b', 'none'],
['hunyuan', 'hunyuan-turbo', 'none'],
['moonshot', 'moonshot-v1-8k', 'none'],
['weknoracloud', 'anything', 'none'],
]
for (const [provider, model, want] of cases) {
assert.equal(
defaultThinkingControl(provider, model),
want,
`${provider}/${model}`,
)
}
})