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