fix: audio set progress error

This commit is contained in:
jialin
2024-12-03 16:17:54 +08:00
parent 605d6f0f9b
commit 687dabc777
9 changed files with 52 additions and 55 deletions
+26 -25
View File
@@ -13,33 +13,34 @@ interface AlertInfoProps {
const AlertInfo: React.FC<AlertInfoProps> = (props) => { const AlertInfo: React.FC<AlertInfoProps> = (props) => {
const { message, type, rows = 1, ellipsis, style } = props; const { message, type, rows = 1, ellipsis, style } = props;
if (!message) {
return null;
}
return ( return (
<Typography.Paragraph <>
type={type} {message ? (
ellipsis={ <Typography.Paragraph
ellipsis !== undefined type={type}
? ellipsis ellipsis={
: { ellipsis !== undefined
rows: rows, ? ellipsis
tooltip: message : {
} rows: rows,
} tooltip: message
style={{ }
textAlign: 'center', }
padding: '2px 5px', style={{
borderRadius: 'var(--border-radius-base)', textAlign: 'center',
margin: 0, padding: '2px 5px',
backgroundColor: 'var(--ant-color-error-bg)', borderRadius: 'var(--border-radius-base)',
...style margin: 0,
}} backgroundColor: 'var(--ant-color-error-bg)',
> ...style
<WarningOutlined className="m-r-8" /> }}
{message} >
</Typography.Paragraph> <WarningOutlined className="m-r-8" />
{message}
</Typography.Paragraph>
) : null}
</>
); );
}; };
+3 -3
View File
@@ -88,11 +88,11 @@ const ListInput: React.FC<ListInputProps> = (props) => {
<div className="flex justify-center"> <div className="flex justify-center">
<Button <Button
ref={buttonRef} ref={buttonRef}
type="text" variant="filled"
color="default"
block block
style={{ style={{
marginTop: 16, marginTop: 16
backgroundColor: 'var(--ant-color-fill-secondary)'
}} }}
onClick={handleOnAdd} onClick={handleOnAdd}
> >
-5
View File
@@ -67,11 +67,6 @@ const useParseAnsi = () => {
const n = parseInt(match[1], 10) || 1; const n = parseInt(match[1], 10) || 1;
const m = parseInt(match[2], 10) || 1; const m = parseInt(match[2], 10) || 1;
const command = match[3]; const command = match[3];
console.log('command', {
command,
cursorRow,
n
});
// handle ANSI control characters // handle ANSI control characters
switch (command) { switch (command) {
@@ -73,11 +73,6 @@ const parseAnsi = (input: string, setId: () => number) => {
const n = parseInt(match[1], 10) || 1; const n = parseInt(match[1], 10) || 1;
const m = parseInt(match[2], 10) || 1; const m = parseInt(match[2], 10) || 1;
const command = match[3]; const command = match[3];
console.log('command', {
command,
cursorRow,
n
});
// handle ANSI control characters // handle ANSI control characters
switch (command) { switch (command) {
+4 -2
View File
@@ -58,8 +58,10 @@ export default {
'models.table.layers': 'Layers', 'models.table.layers': 'Layers',
'models.form.backend': 'Backend', 'models.form.backend': 'Backend',
'models.form.backend_parameters': 'Backend Parameters', 'models.form.backend_parameters': 'Backend Parameters',
'models.search.gguf.tips': '1. GGUF model backend is llama-box.', 'models.search.gguf.tips':
'models.search.vllm.tips': '2. Non-GGUF model backend is vLLM.', '1. GGUF models backend is llama-box(supports Linux, macOS and Windows).',
'models.search.vllm.tips':
'2. Non-GGUF models use vox-box for audio and vLLM for others.',
'models.form.ollamalink': 'Find More in Ollama Library', 'models.form.ollamalink': 'Find More in Ollama Library',
'models.form.backend_parameters.llamabox.placeholder': 'models.form.backend_parameters.llamabox.placeholder':
'e.g., --ctx-size=8192', 'e.g., --ctx-size=8192',
+4 -2
View File
@@ -57,8 +57,10 @@ export default {
'models.table.layers': '层', 'models.table.layers': '层',
'models.form.backend': '后端', 'models.form.backend': '后端',
'models.form.backend_parameters': '后端参数', 'models.form.backend_parameters': '后端参数',
'models.search.gguf.tips': '1. GGUF 模型后端为 llama-box', 'models.search.gguf.tips':
'models.search.vllm.tips': '2. 非 GGUF 模型后端为 vLLM', '1. GGUF 模型后端为 llama-box(支持 Linux, macOS 和 Windows)。',
'models.search.vllm.tips':
'2. 非 GGUF 的音频模型用 vox-box,其它非 GGUF 的模型用 vLLM。',
'models.form.ollamalink': '在 Ollama Library 中查找', 'models.form.ollamalink': '在 Ollama Library 中查找',
'models.form.backend_parameters.llamabox.placeholder': 'models.form.backend_parameters.llamabox.placeholder':
'例如,--ctx-size=8192', '例如,--ctx-size=8192',
+8 -3
View File
@@ -29,15 +29,20 @@ const GPUCard: React.FC<{
{intl.formatMessage({ id: 'resources.table.used' })}/ {intl.formatMessage({ id: 'resources.table.used' })}/
{intl.formatMessage({ id: 'resources.table.total' })}):{' '} {intl.formatMessage({ id: 'resources.table.total' })}):{' '}
<span> <span>
{convertFileSize(data?.memory?.used || 0)} /{' '} {convertFileSize(
{convertFileSize(data?.memory?.total || 0)} data?.memory?.used || data?.memory?.allocated || 0
)}{' '}
/ {convertFileSize(data?.memory?.total || 0)}
</span> </span>
</span> </span>
<span> <span>
<span> <span>
{intl.formatMessage({ id: 'resources.table.gpuutilization' })}:{' '} {intl.formatMessage({ id: 'resources.table.gpuutilization' })}:{' '}
</span> </span>
{_.round(data?.memory?.utilization_rate || 0, 2)}% {data?.memory?.used
? _.round(data?.memory?.utilization_rate || 0, 2)
: _.round(data.memory?.allocated / data.memory?.total, 2)}
%
</span> </span>
</> </>
)} )}
@@ -120,7 +120,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
} }
); );
if (result?.error) { if (result?.status_code !== 200) {
setTokenResult({ setTokenResult({
error: true, error: true,
errorMessage: errorMessage:
@@ -380,7 +380,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
style={{ height: '100%', overflow: 'auto' }} style={{ height: '100%', overflow: 'auto' }}
ref={scroller} ref={scroller}
> >
<> <div>
{!tokenResult && ( {!tokenResult && (
<div <div
style={{ style={{
@@ -409,7 +409,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
></AlertInfo> ></AlertInfo>
</div> </div>
)} )}
</> </div>
</div> </div>
{loading && ( {loading && (
<div style={{ width: '100%', flex: 1 }}> <div style={{ width: '100%', flex: 1 }}>
@@ -157,7 +157,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
console.log('result:', res); console.log('result:', res);
if (res?.error) { if (res?.status_code !== 200) {
setTokenResult({ setTokenResult({
error: true, error: true,
errorMessage: errorMessage:
@@ -212,14 +212,11 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
const res = await queryModelVoices({ const res = await queryModelVoices({
model: value model: value
}); });
if (res?.error) { if (res?.status_code !== 200) {
setVoiceError({ setVoiceError({
error: true, error: true,
errorMessage: errorMessage:
res?.data?.error?.message || res?.data?.error?.message || res?.data?.error || res?.detail || ''
res?.data?.error ||
res.error?.detail ||
''
}); });
setVoiceList([]); setVoiceList([]);
return; return;
@@ -248,7 +245,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
setVoiceError({ setVoiceError({
error: true, error: true,
errorMessage: errorMessage:
res?.error?.message || res?.data?.error || res.error?.detail || '' res?.error?.message || res?.data?.error || res?.detail || ''
}); });
} }
setVoiceList([]); setVoiceList([]);