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
@@ -475,7 +475,9 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
<div className="flex-center">
<ThunderboltFilled className="m-r-5" />
{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})` : ''}
</div>
</div>
+5 -2
View File
@@ -190,12 +190,15 @@ const DataForm: React.FC<DataFormProps> = 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
}
};
}
-9
View File
@@ -50,15 +50,6 @@ const KVCacheForm = () => {
name={['extended_kv_cache', 'enabled']}
valuePropName="checked"
style={{ marginBottom: 8 }}
extra={
!builtInBackend && (
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'models.form.kvCache.tips' })
}}
></span>
)
}
>
<CheckboxField
description={intl.formatMessage({
@@ -7,7 +7,8 @@ import useAppUtils from '@/hooks/use-app-utils';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
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 { FormData } from '../config/types';
import useQueryDraftModels from '../hooks/use-query-draftModels';
@@ -20,9 +21,10 @@ const AlgorithmMap = {
const SpeculativeDecode = () => {
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 (
<>
<Form.Item<FormData>
name={['speculative_config', 'enabled']}
valuePropName="checked"
style={{ marginBottom: 8 }}
extra={
!builtInBackend && (
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'models.form.kvCache.tips' })
}}
></span>
)
}
>
<CheckboxField
description={intl.formatMessage({
id: 'models.form.kvCache.tips2'
})}
label={intl.formatMessage({
id: 'models.form.enableSpeculativeDecoding'
})}
onChange={handleSpeculativeEnabledChange}
disabled={!builtInBackend}
></CheckboxField>
</Form.Item>
{speculativeEnabled && (