fix: tts request content-type

This commit is contained in:
jialin
2025-11-05 17:09:16 +08:00
parent 333b430b97
commit 6173f3b459
9 changed files with 65 additions and 33 deletions
+4 -3
View File
@@ -209,9 +209,9 @@ export default {
'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.degrade': 'Abnormal',
'models.mymodels.status.active': 'Active', 'models.mymodels.status.active': 'Active',
'models.form.kvCache.tips': 'models.form.kvCache.tips':
'Available only with built-in backends (vLLM / SGLang) switch backend in <span class="bold-text">Advanced</span> to enable.', 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the <span class="bold-text">Advanced</span> settings to enable them.',
'models.form.kvCache.tips2': '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.scheduling': 'Scheduling',
'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramRatio': 'RAM-to-VRAM Ratio',
'models.form.ramSize': 'Maximum RAM Size (GiB)', '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.placeholder': 'Please select or enter a draft model',
'models.form.draftModel.tips': '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.', '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'
}; };
+8 -6
View File
@@ -209,9 +209,9 @@ export default {
'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.degrade': 'Abnormal',
'models.mymodels.status.active': 'Active', 'models.mymodels.status.active': 'Active',
'models.form.kvCache.tips': 'models.form.kvCache.tips':
'Available only with built-in backends (vLLM / SGLang) switch backend in <span class="bold-text">Advanced</span> to enable.', 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the <span class="bold-text">Advanced</span> settings to enable them.',
'models.form.kvCache.tips2': '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.scheduling': 'Scheduling',
'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramRatio': 'RAM-to-VRAM Ratio',
'models.form.ramSize': 'Maximum RAM Size (GiB)', '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.placeholder': 'Please select or enter a draft model',
'models.form.draftModel.tips': '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.', '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) ========== // ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -282,8 +283,8 @@ export default {
// 41. 'models.mymodels.status.degrade': 'Abnormal', // 41. 'models.mymodels.status.degrade': 'Abnormal',
// 42. 'models.mymodels.status.active': 'Active' // 42. 'models.mymodels.status.active': 'Active'
// 43. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.', // 43. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
// 44. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) switch backend in <span class="bold-text">Advanced</span> to enable.' // 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 <span class="bold-text">Advanced</span> settings to enable them.',
// 45. 'models.form.kvCache.tips2': 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).', // 45. 'models.form.kvCache.tips2': 'Only supported when using built-in inference backends (vLLM or SGLang).',
// 46. 'models.form.scheduling': 'Scheduling', // 46. 'models.form.scheduling': 'Scheduling',
// 47. 'models.form.ramRatio': 'RAM-to-VRAM Ratio', // 47. 'models.form.ramRatio': 'RAM-to-VRAM Ratio',
// 48. 'models.form.ramSize': 'Maximum RAM Size (GiB)', // 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, // 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', // 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.' // 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 ========== // ========== End of To-Do List ==========
+8 -6
View File
@@ -209,9 +209,9 @@ export default {
'models.mymodels.status.degrade': 'Abnormal', 'models.mymodels.status.degrade': 'Abnormal',
'models.mymodels.status.active': 'Active', 'models.mymodels.status.active': 'Active',
'models.form.kvCache.tips': 'models.form.kvCache.tips':
'Available only with built-in backends (vLLM / SGLang) switch backend in <span class="bold-text">Advanced</span> to enable.', 'Extended KV cache and speculative decoding are only available with built-in backends (vLLM / SGLang), Please switch the backend in the <span class="bold-text">Advanced</span> settings to enable them.',
'models.form.kvCache.tips2': '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.scheduling': 'Scheduling',
'models.form.ramRatio': 'RAM-to-VRAM Ratio', 'models.form.ramRatio': 'RAM-to-VRAM Ratio',
'models.form.ramSize': 'Maximum RAM Size (GiB)', '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.placeholder': 'Please select or enter a draft model',
'models.form.draftModel.tips': '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.', '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) ========== // ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -245,8 +246,8 @@ export default {
// 3. 'models.mymodels.status.degrade': 'Abnormal', // 3. 'models.mymodels.status.degrade': 'Abnormal',
// 4. 'models.mymodels.status.active': 'Active' // 4. 'models.mymodels.status.active': 'Active'
// 5. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.', // 5. 'models.form.remoteURL.tips': 'Refer to the <a href="https://docs.lmcache.ai/api_reference/configurations.html" target="_blank">configuration documentation</a> for details.',
// 6. 'models.form.kvCache.tips': 'Available only with built-in backends (vLLM / SGLang) switch backend in <span class="bold-text">Advanced</span> to enable.' // 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 <span class="bold-text">Advanced</span> settings to enable them.',
// 7. 'models.form.kvCache.tips2': 'Extended KV cache is only supported when using built-in inference backends (vLLM or SGLang).'; // 7. 'models.form.kvCache.tips2': 'Only supported when using built-in inference backends (vLLM or SGLang).';
// 8. 'models.form.scheduling': 'Scheduling', // 8. 'models.form.scheduling': 'Scheduling',
// 9. 'models.form.ramRatio': 'RAM-to-VRAM Ratio', // 9. 'models.form.ramRatio': 'RAM-to-VRAM Ratio',
// 10. 'models.form.ramSize': 'Maximum RAM Size (GiB)', // 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.' // 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', // 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.', // 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 ========== // ========== End of To-Do List ==========
+4 -4
View File
@@ -198,9 +198,8 @@ export default {
'models.mymodels.status.degrade': '异常', 'models.mymodels.status.degrade': '异常',
'models.mymodels.status.active': '可用', 'models.mymodels.status.active': '可用',
'models.form.kvCache.tips': 'models.form.kvCache.tips':
'仅在内置后端(vLLM / SGLang)可用 —— 请在<span class="bold-text">高级</span>配置中切换后端以启用。', '扩展 KV 缓存和推测解码仅在内置后端(vLLM / SGLang)可用请在<span class="bold-text">高级</span>配置中切换后端以启用。',
'models.form.kvCache.tips2': 'models.form.kvCache.tips2': '仅在使用内置推理后端(vLLM 或 SGLang)时支持。',
'仅在使用内置推理后端(vLLM 或 SGLang)时支持 KV 缓存。',
'models.form.scheduling': '调度', 'models.form.scheduling': '调度',
'models.form.ramRatio': '内存与显存比例', 'models.form.ramRatio': '内存与显存比例',
'models.form.ramSize': '内存最大占用 (GiB)', 'models.form.ramSize': '内存最大占用 (GiB)',
@@ -225,5 +224,6 @@ export default {
'models.form.draftModel.placeholder': '请选择或输入草稿模型', 'models.form.draftModel.placeholder': '请选择或输入草稿模型',
'models.form.draftModel.tips': 'models.form.draftModel.tips':
'可填写本地路径(如 /path/to/model),或从 Hugging Face、ModelScope 选择模型(如 Tengyunw/qwen3_8b_eagle3)。系统将根据主模型来源自动匹配。', '可填写本地路径(如 /path/to/model),或从 Hugging Face、ModelScope 选择模型(如 Tengyunw/qwen3_8b_eagle3)。系统将根据主模型来源自动匹配。',
'models.form.quantization': '量化' 'models.form.quantization': '量化',
'models.form.backend.custom': '用户定义'
}; };
@@ -475,7 +475,9 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
<div className="flex-center"> <div className="flex-center">
<ThunderboltFilled className="m-r-5" /> <ThunderboltFilled className="m-r-5" />
{intl.formatMessage({ id: 'models.form.backend' })}:{' '} {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})` : ''} {modelData.backend_version ? `(${modelData.backend_version})` : ''}
</div> </div>
</div> </div>
+5 -2
View File
@@ -190,12 +190,15 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
const updateKVCacheConfig = (backend: string, option: BackendOption) => { const updateKVCacheConfig = (backend: string, option: BackendOption) => {
if ( if (
!option.isBuiltIn && !option.isBuiltIn ||
[backendOptionsMap.SGLang, backendOptionsMap.vllm].includes(backend) ![backendOptionsMap.SGLang, backendOptionsMap.vllm].includes(backend)
) { ) {
return { return {
extended_kv_cache: { extended_kv_cache: {
enabled: false enabled: false
},
speculative_config: {
enabled: false
} }
}; };
} }
-9
View File
@@ -50,15 +50,6 @@ const KVCacheForm = () => {
name={['extended_kv_cache', 'enabled']} name={['extended_kv_cache', 'enabled']}
valuePropName="checked" valuePropName="checked"
style={{ marginBottom: 8 }} style={{ marginBottom: 8 }}
extra={
!builtInBackend && (
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'models.form.kvCache.tips' })
}}
></span>
)
}
> >
<CheckboxField <CheckboxField
description={intl.formatMessage({ description={intl.formatMessage({
@@ -7,7 +7,8 @@ import useAppUtils from '@/hooks/use-app-utils';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { Form } from 'antd'; import { Form } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import { useRef } from 'react'; import { useMemo, useRef } from 'react';
import { backendOptionsMap } from '../config/backend-parameters';
import { useFormContext } from '../config/form-context'; import { useFormContext } from '../config/form-context';
import { FormData } from '../config/types'; import { FormData } from '../config/types';
import useQueryDraftModels from '../hooks/use-query-draftModels'; import useQueryDraftModels from '../hooks/use-query-draftModels';
@@ -20,9 +21,10 @@ const AlgorithmMap = {
const SpeculativeDecode = () => { const SpeculativeDecode = () => {
const intl = useIntl(); const intl = useIntl();
const { source, onValuesChange } = useFormContext(); const { source, backendOptions, onValuesChange } = useFormContext();
const { getRuleMessage } = useAppUtils(); const { getRuleMessage } = useAppUtils();
const form = Form.useFormInstance(); const form = Form.useFormInstance();
const backend = Form.useWatch('backend', form);
const speculativeEnabled = Form.useWatch( const speculativeEnabled = Form.useWatch(
['speculative_config', 'enabled'], ['speculative_config', 'enabled'],
form 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 ( return (
<> <>
<Form.Item<FormData> <Form.Item<FormData>
name={['speculative_config', 'enabled']} name={['speculative_config', 'enabled']}
valuePropName="checked" valuePropName="checked"
style={{ marginBottom: 8 }} style={{ marginBottom: 8 }}
extra={
!builtInBackend && (
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'models.form.kvCache.tips' })
}}
></span>
)
}
> >
<CheckboxField <CheckboxField
description={intl.formatMessage({
id: 'models.form.kvCache.tips2'
})}
label={intl.formatMessage({ label={intl.formatMessage({
id: 'models.form.enableSpeculativeDecoding' id: 'models.form.enableSpeculativeDecoding'
})} })}
onChange={handleSpeculativeEnabledChange} onChange={handleSpeculativeEnabledChange}
disabled={!builtInBackend}
></CheckboxField> ></CheckboxField>
</Form.Item> </Form.Item>
{speculativeEnabled && ( {speculativeEnabled && (
+3
View File
@@ -96,6 +96,9 @@ export const textToSpeech = async (params: any, options?: any) => {
const res = await fetch(AUDIO_TEXT_TO_SPEECH_API, { const res = await fetch(AUDIO_TEXT_TO_SPEECH_API, {
method: 'POST', method: 'POST',
body: JSON.stringify(params.data), body: JSON.stringify(params.data),
headers: {
'Content-Type': 'application/json'
},
signal: params.signal signal: params.signal
}); });
if (!res.ok) { if (!res.ok) {