chore: speech to text

This commit is contained in:
jialin
2024-11-22 10:00:34 +08:00
parent f24aef300b
commit c3473673da
47 changed files with 3364 additions and 904 deletions
@@ -8,6 +8,7 @@ import '../style/reference-params.less';
interface ReferenceParamsProps {
showOutput?: boolean;
scaleable?: boolean;
fields?: string[];
usage: {
error?: boolean;
errorMessage?: string;
@@ -22,7 +23,12 @@ interface ReferenceParamsProps {
const ReferenceParams = (props: ReferenceParamsProps) => {
const intl = useIntl();
const { usage, showOutput = true, scaleable } = props;
const {
usage,
showOutput = true,
scaleable,
fields = ['completion_tokens', 'prompt_tokens']
} = props;
if (!usage || _.isEmpty(usage)) {
return null;
}
@@ -60,14 +66,18 @@ const ReferenceParams = (props: ReferenceParamsProps) => {
<Tooltip
title={
<Space>
<span>
{intl.formatMessage({ id: 'playground.completion' })}:{' '}
{usage.completion_tokens}
</span>
<span>
{intl.formatMessage({ id: 'playground.prompt' })}:{' '}
{usage.prompt_tokens}
</span>
{fields.includes('completion_tokens') && (
<span>
{intl.formatMessage({ id: 'playground.completion' })}:{' '}
{usage.completion_tokens}
</span>
)}
{fields.includes('prompt_tokens') && (
<span>
{intl.formatMessage({ id: 'playground.prompt' })}:{' '}
{usage.prompt_tokens}
</span>
)}
</Space>
}
>