diff --git a/src/locales/en-US/models.ts b/src/locales/en-US/models.ts index e22648f7..db9521d1 100644 --- a/src/locales/en-US/models.ts +++ b/src/locales/en-US/models.ts @@ -209,9 +209,9 @@ export default { 'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.active': 'Active', 'models.form.kvCache.tips': - 'Available only with built-in backends (vLLM / SGLang) — switch backend in Advanced to enable.', + 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the Advanced settings to enable them.', 'models.form.kvCache.tips2': - 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).', + 'Only supported when using built-in inference backends (vLLM or SGLang).', 'models.form.scheduling': 'Scheduling', 'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramSize': 'Maximum RAM Size (GiB)', @@ -237,5 +237,6 @@ export default { 'models.form.draftModel.placeholder': 'Please select or enter a draft model', 'models.form.draftModel.tips': 'You can enter a local path (e.g., /path/to/model) or select a model from Hugging Face or ModelScope (e.g., Tengyunw/qwen3_8b_eagle3). The system will automatically match based on the primary model source.', - 'models.form.quantization': 'Quantization' + 'models.form.quantization': 'Quantization', + 'models.form.backend.custom': 'User Defined' }; diff --git a/src/locales/ja-JP/models.ts b/src/locales/ja-JP/models.ts index 0d5157ae..eaa7cade 100644 --- a/src/locales/ja-JP/models.ts +++ b/src/locales/ja-JP/models.ts @@ -209,9 +209,9 @@ export default { 'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.active': 'Active', 'models.form.kvCache.tips': - 'Available only with built-in backends (vLLM / SGLang) — switch backend in Advanced to enable.', + 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the Advanced settings to enable them.', 'models.form.kvCache.tips2': - 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).', + 'Only supported when using built-in inference backends (vLLM or SGLang).', 'models.form.scheduling': 'Scheduling', 'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramSize': 'Maximum RAM Size (GiB)', @@ -237,7 +237,8 @@ export default { 'models.form.draftModel.placeholder': 'Please select or enter a draft model', 'models.form.draftModel.tips': 'You can enter a local path (e.g., /path/to/model) or select a model from Hugging Face or ModelScope (e.g., Tengyunw/qwen3_8b_eagle3). The system will automatically match based on the primary model source.', - 'models.form.quantization': 'Quantization' + 'models.form.quantization': 'Quantization', + 'models.form.backend.custom': 'User Defined' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== @@ -282,8 +283,8 @@ export default { // 41. 'models.mymodels.status.degrade': 'Abnormal', // 42. 'models.mymodels.status.active': 'Active' // 43. 'models.form.remoteURL.tips': 'Refer to the configuration documentation for details.', -// 44. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) — switch backend in Advanced to enable.' -// 45. 'models.form.kvCache.tips2': 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).', +// 44. 'models.form.kvCache.tips': 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the Advanced settings to enable them.', +// 45. 'models.form.kvCache.tips2': 'Only supported when using built-in inference backends (vLLM or SGLang).', // 46. 'models.form.scheduling': 'Scheduling', // 47. 'models.form.ramRatio': 'RAM-to-VRAM Ratio', // 48. 'models.form.ramSize': 'Maximum RAM Size (GiB)', @@ -304,5 +305,6 @@ export default { // 44. 'models.form.mode.baseline.tips': 'the most compatible option with full precision, // 45. 'models.form.draftModel.placeholder': 'Please select or enter a draft model', // 46. 'models.form.draftModel.tips': 'You can enter a local path (e.g., /path/to/model) or select a model from Hugging Face or ModelScope (e.g., Tengyunw/qwen3_8b_eagle3). The system will automatically match based on the primary model source.' -// 47. 'models.form.quantization': 'Quantization' +// 47. 'models.form.quantization': 'Quantization', +// 48. 'models.form.backend.custom': 'User Defined' // ========== End of To-Do List ========== diff --git a/src/locales/ru-RU/models.ts b/src/locales/ru-RU/models.ts index f343be8c..b04b0652 100644 --- a/src/locales/ru-RU/models.ts +++ b/src/locales/ru-RU/models.ts @@ -209,9 +209,9 @@ export default { 'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.active': 'Active', 'models.form.kvCache.tips': - 'Available only with built-in backends (vLLM / SGLang) — switch backend in Advanced to enable.', + 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the Advanced settings to enable them.', 'models.form.kvCache.tips2': - 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).', + 'Only supported when using built-in inference backends (vLLM or SGLang).', 'models.form.scheduling': 'Scheduling', 'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramSize': 'Maximum RAM Size (GiB)', @@ -237,7 +237,8 @@ export default { 'models.form.draftModel.placeholder': 'Please select or enter a draft model', 'models.form.draftModel.tips': 'You can enter a local path (e.g., /path/to/model) or select a model from Hugging Face or ModelScope (e.g., Tengyunw/qwen3_8b_eagle3). The system will automatically match based on the primary model source.', - 'models.form.quantization': 'Quantization' + 'models.form.quantization': 'Quantization', + 'models.form.backend.custom': 'User Defined' }; // ========== To-Do: Translate Keys (Remove After Translation) ========== @@ -245,8 +246,8 @@ export default { // 3. 'models.mymodels.status.degrade': 'Abnormal', // 4. 'models.mymodels.status.active': 'Active' // 5. 'models.form.remoteURL.tips': 'Refer to the configuration documentation for details.', -// 6. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) — switch backend in Advanced to enable.' -// 7. 'models.form.kvCache.tips2': 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).'; +// 6. 'models.form.kvCache.tips': 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the Advanced settings to enable them.', +// 7. 'models.form.kvCache.tips2': 'Only supported when using built-in inference backends (vLLM or SGLang).'; // 8. 'models.form.scheduling': 'Scheduling', // 9. 'models.form.ramRatio': 'RAM-to-VRAM Ratio', // 10. 'models.form.ramSize': 'Maximum RAM Size (GiB)', @@ -267,5 +268,6 @@ export default { // 36. 'models.form.mode.baseline.tips': 'the most compatible option with full precision.' // 37. 'models.form.draftModel.placeholder': 'Please select or enter a draft model', // 38. 'models.form.draftModel.tips': 'You can enter a local path (e.g., /path/to/model) or select a model from Hugging Face or ModelScope (e.g., Tengyunw/qwen3_8b_eagle3). The system will automatically match based on the primary model source.', -// 39. 'models.form.quantization': 'Quantization' +// 39. 'models.form.quantization': 'Quantization', +// 40. 'models.form.backend.custom': 'User Defined' // ========== End of To-Do List ========== diff --git a/src/locales/zh-CN/models.ts b/src/locales/zh-CN/models.ts index 7d16e60d..3e66bf48 100644 --- a/src/locales/zh-CN/models.ts +++ b/src/locales/zh-CN/models.ts @@ -198,9 +198,8 @@ export default { 'models.mymodels.status.degrade': '异常', 'models.mymodels.status.active': '可用', 'models.form.kvCache.tips': - '仅在内置后端(vLLM / SGLang)可用 —— 请在高级配置中切换后端以启用。', - 'models.form.kvCache.tips2': - '仅在使用内置推理后端(vLLM 或 SGLang)时支持 KV 缓存。', + '扩展 KV 缓存和推测解码仅在内置后端(vLLM / SGLang)可用,请在高级配置中切换后端以启用。', + 'models.form.kvCache.tips2': '仅在使用内置推理后端(vLLM 或 SGLang)时支持。', 'models.form.scheduling': '调度', 'models.form.ramRatio': '内存与显存比例', 'models.form.ramSize': '内存最大占用 (GiB)', @@ -225,5 +224,6 @@ export default { 'models.form.draftModel.placeholder': '请选择或输入草稿模型', 'models.form.draftModel.tips': '可填写本地路径(如 /path/to/model),或从 Hugging Face、ModelScope 选择模型(如 Tengyunw/qwen3_8b_eagle3)。系统将根据主模型来源自动匹配。', - 'models.form.quantization': '量化' + 'models.form.quantization': '量化', + 'models.form.backend.custom': '用户定义' }; diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index a8aac602..fdf22653 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -475,7 +475,9 @@ const InstanceItem: React.FC = ({
{intl.formatMessage({ id: 'models.form.backend' })}:{' '} - {modelData?.backend || ''} + {modelData?.backend === backendOptionsMap.custom + ? intl.formatMessage({ id: 'models.form.backend.custom' }) + : modelData?.backend || ''} {modelData.backend_version ? `(${modelData.backend_version})` : ''}
diff --git a/src/pages/llmodels/forms/index.tsx b/src/pages/llmodels/forms/index.tsx index d49d7f43..e6392237 100644 --- a/src/pages/llmodels/forms/index.tsx +++ b/src/pages/llmodels/forms/index.tsx @@ -190,12 +190,15 @@ const DataForm: React.FC = forwardRef((props, ref) => { const updateKVCacheConfig = (backend: string, option: BackendOption) => { if ( - !option.isBuiltIn && - [backendOptionsMap.SGLang, backendOptionsMap.vllm].includes(backend) + !option.isBuiltIn || + ![backendOptionsMap.SGLang, backendOptionsMap.vllm].includes(backend) ) { return { extended_kv_cache: { enabled: false + }, + speculative_config: { + enabled: false } }; } diff --git a/src/pages/llmodels/forms/kv-cache.tsx b/src/pages/llmodels/forms/kv-cache.tsx index a9e1df75..f404c3cc 100644 --- a/src/pages/llmodels/forms/kv-cache.tsx +++ b/src/pages/llmodels/forms/kv-cache.tsx @@ -50,15 +50,6 @@ const KVCacheForm = () => { name={['extended_kv_cache', 'enabled']} valuePropName="checked" style={{ marginBottom: 8 }} - extra={ - !builtInBackend && ( - - ) - } > { const intl = useIntl(); - const { source, onValuesChange } = useFormContext(); + const { source, backendOptions, onValuesChange } = useFormContext(); const { getRuleMessage } = useAppUtils(); const form = Form.useFormInstance(); + const backend = Form.useWatch('backend', form); const speculativeEnabled = Form.useWatch( ['speculative_config', 'enabled'], form @@ -65,18 +67,44 @@ const SpeculativeDecode = () => { } }; + const builtInBackend = useMemo(() => { + const currentBackend = backendOptions.find( + (item) => item.value === backend + ); + + return ( + currentBackend?.isBuiltIn && + [backendOptionsMap.SGLang, backendOptionsMap.vllm].includes( + backend as string + ) + ); + }, [backend, backendOptions]); + return ( <> name={['speculative_config', 'enabled']} valuePropName="checked" style={{ marginBottom: 8 }} + extra={ + !builtInBackend && ( + + ) + } > {speculativeEnabled && ( diff --git a/src/pages/playground/apis/index.ts b/src/pages/playground/apis/index.ts index acb638f6..e51e966a 100644 --- a/src/pages/playground/apis/index.ts +++ b/src/pages/playground/apis/index.ts @@ -96,6 +96,9 @@ export const textToSpeech = async (params: any, options?: any) => { const res = await fetch(AUDIO_TEXT_TO_SPEECH_API, { method: 'POST', body: JSON.stringify(params.data), + headers: { + 'Content-Type': 'application/json' + }, signal: params.signal }); if (!res.ok) {