fix: tts params filter

This commit is contained in:
jialin
2026-02-11 15:30:35 +08:00
parent e66de732ac
commit 1b8c17ce92
9 changed files with 84 additions and 45 deletions
+25 -28
View File
@@ -62,36 +62,33 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
scroller: scroller.current
}));
const handleOnWheel = useCallback(
(e: any) => {
const scrollTop = scrollEventElement?.current.scrollTop;
const scrollHeight = scrollEventElement?.current.scrollHeight;
const clientHeight = scrollEventElement?.current.clientHeight;
const handleOnWheel = (e: any) => {
const scrollTop = scrollEventElement?.current?.scrollTop;
const scrollHeight = scrollEventElement?.current?.scrollHeight;
const clientHeight = scrollEventElement?.current?.clientHeight;
stopScroll.current = scrollTop + clientHeight <= scrollHeight;
stopScroll.current = scrollTop + clientHeight <= scrollHeight;
const isBottom = scrollTop + clientHeight + 150 >= scrollHeight;
// is scroll to top
if (scrollTop <= 10) {
onScroll?.({
isTop: true,
isBottom: false
});
} else if (isBottom) {
onScroll?.({
isTop: false,
isBottom: true
});
stopScroll.current = false;
} else {
onScroll?.({
isTop: false,
isBottom: false
});
}
},
[debounceResetStopScroll, scrollEventElement]
);
const isBottom = scrollTop + clientHeight + 150 >= scrollHeight;
// is scroll to top
if (scrollTop <= 10) {
onScroll?.({
isTop: true,
isBottom: false
});
} else if (isBottom) {
onScroll?.({
isTop: false,
isBottom: true
});
stopScroll.current = false;
} else {
onScroll?.({
isTop: false,
isBottom: false
});
}
};
const debounceUpdateScrollerPosition = _.debounce(() => {
generateInstance();
+1 -1
View File
@@ -146,7 +146,7 @@ const Details: React.FC = () => {
style={{
opacity: loading ? 0 : 1,
position: 'relative',
bottom: -2,
bottom: 1,
right: -1
}}
>
@@ -19,8 +19,8 @@ import { BenchmarkListItem as ListItem } from '../config/types';
const allFields = [
'cluster_id',
'model_name',
'dataset_name',
'profile',
'dataset_name',
'gpu_summary',
'state',
'request_rate',
@@ -47,7 +47,7 @@ const fieldSortPos: Record<string, number> = Object.fromEntries(
const defaultColumns: string[] = [
'model_name',
'dataset_name',
'profile',
'state',
'gpu_summary',
'tokens_per_second_mean',
@@ -107,10 +107,18 @@ const useColumnSettings = (options: {
title={`${title} ${options?.subTitle || ''}`}
>
{title}
{options?.subTitle && (
<div className="sub-title">{options.subTitle}</div>
)}
</AutoTooltip>
{options?.subTitle && (
<span className="sub-title">
<AutoTooltip
ghost
minWidth={20}
title={`${title} ${options?.subTitle || ''}`}
>
{options.subTitle}
</AutoTooltip>
</span>
)}
</span>
);
};
@@ -142,7 +150,11 @@ const useColumnSettings = (options: {
path: 'request_latency_mean',
unit: 'ms',
sorter: tableSorter(1),
render: (value: number) => round(value, 2)
render: (value: number) => (
<AutoTooltip ghost minWidth={20}>
{round(value, 2)}
</AutoTooltip>
)
},
{
title: renderTitle('TTFT', {
@@ -180,7 +192,11 @@ const useColumnSettings = (options: {
dataIndex: 'inter_token_latency_mean',
path: 'inter_token_latency_mean',
unit: 'ms',
render: (value: number) => round(value, 2) || '-'
render: (value: number) => (
<AutoTooltip ghost minWidth={20}>
{round(value, 2) || '-'}
</AutoTooltip>
)
},
{
title: 'RPS',
+1 -1
View File
@@ -247,7 +247,7 @@ const Benchmark: React.FC = () => {
sortDirections={TABLE_SORT_DIRECTIONS}
showSorterTooltip={false}
rowKey="id"
scroll={{ x: 1200 }}
scroll={{ x: 1260 }}
onChange={handleTableChange}
pagination={{
showSizeChanger: true,
@@ -63,7 +63,7 @@ const ClusterAdvanceConfig: React.FC<{
ref={editorRef}
title={
<span className="flex-center">
<span>{`${intl.formatMessage({ id: 'clusters.create.workerConfig' })} YAML`}</span>
<span>{`${intl.formatMessage({ id: 'clusters.create.workerConfig' })} (YAML)`}</span>
<Button
size="small"
type="link"
@@ -51,7 +51,7 @@ const AdvanceConfig: React.FC<{
ref={editorRef}
title={
<span className="flex-center">
<span>{`${intl.formatMessage({ id: 'providers.form.customConfig' })} YAML`}</span>
<span>{`${intl.formatMessage({ id: 'providers.form.customConfig' })} (YAML)`}</span>
<Button size="small" type="link" target="_blank" href={referLink}>
{intl.formatMessage({ id: 'playground.audio.enablemic.doc' })}{' '}
<IconFont
+7 -3
View File
@@ -1,14 +1,17 @@
import MetadataList from '@/components/metadata-list';
import SealInput from '@/components/seal-form/seal-input';
import Password from '@/components/seal-form/password';
import { PageAction } from '@/config';
import useAppUtils from '@/hooks/use-app-utils';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import { useFormContext } from '../config/form-context';
import { FormData } from '../config/types';
const AccessToken = () => {
const intl = useIntl();
const { getRuleMessage } = useAppUtils();
const form = Form.useFormInstance<FormData>();
const { action } = useFormContext();
const tokenList = Form.useWatch('api_tokens', form) || [];
const onAdd = () => {
@@ -55,10 +58,11 @@ const AccessToken = () => {
>
{(item, index) => (
<div style={{ width: '100%' }} key={index}>
<SealInput.Password
<Password
value={item}
visibilityToggle={action !== PageAction.EDIT}
onChange={(e) => handleInputChange(index, e)}
></SealInput.Password>
></Password>
</div>
)}
</MetadataList>
@@ -446,7 +446,10 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
zIndex: 10
}}
>
<CopyButton text={messageList[0]?.content}></CopyButton>
<CopyButton
text={messageList[0]?.content}
type="link"
></CopyButton>
</span>
)}
<div
+21 -2
View File
@@ -114,11 +114,28 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
return selectModel || modelList[0]?.value || '';
}, [modelList]);
const dropEmptyFields = (parameters: Record<string, any>) => {
const fields = [
'task_type',
'instructions',
'max_new_tokens',
'ref_audio',
'ref_text',
'language',
'x_vector_only_mode'
];
const newParams = { ...parameters };
return _.omitBy(newParams, (value: any, key: string) => {
return fields.includes(key) && !value;
});
};
const viewCodeContent = useMemo(() => {
return TextToSpeechCode({
api: AUDIO_TEXT_TO_SPEECH_API,
parameters: {
...parameters,
...dropEmptyFields(parameters),
input: currentPrompt
}
});
@@ -185,7 +202,7 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
const signal = controllerRef.current.signal;
const params = {
...parameters,
...dropEmptyFields(parameters),
input: current?.content || currentPrompt
};
const res: any = await textToSpeech({
@@ -194,6 +211,8 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
signal
});
setParams(params);
console.log('result:', res);
if ((res?.status_code && res?.status_code !== 200) || res?.error) {