fix: image request error message
This commit is contained in:
@@ -95,6 +95,7 @@ export default {
|
|||||||
'playground.multiple.on': 'Enable',
|
'playground.multiple.on': 'Enable',
|
||||||
'playground.multiple.off': 'Disable',
|
'playground.multiple.off': 'Disable',
|
||||||
'playground.image.params.sampler': 'Sampler',
|
'playground.image.params.sampler': 'Sampler',
|
||||||
|
'playground.image.params.schedule': 'Schedule',
|
||||||
'playground.image.params.samplerSteps': 'Sampler Steps',
|
'playground.image.params.samplerSteps': 'Sampler Steps',
|
||||||
'playground.image.params.seed': 'Seed',
|
'playground.image.params.seed': 'Seed',
|
||||||
'playground.image.params.negativePrompt': 'Negative Prompt',
|
'playground.image.params.negativePrompt': 'Negative Prompt',
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ export default {
|
|||||||
'playground.multiple.on': '开启',
|
'playground.multiple.on': '开启',
|
||||||
'playground.multiple.off': '关闭',
|
'playground.multiple.off': '关闭',
|
||||||
'playground.image.params.sampler': '采样方法',
|
'playground.image.params.sampler': '采样方法',
|
||||||
|
'playground.image.params.schedule': '调度',
|
||||||
'playground.image.params.samplerSteps': '迭代步数',
|
'playground.image.params.samplerSteps': '迭代步数',
|
||||||
'playground.image.params.seed': '随机种子',
|
'playground.image.params.seed': '随机种子',
|
||||||
'playground.image.params.negativePrompt': '负向提示',
|
'playground.image.params.negativePrompt': '负向提示',
|
||||||
|
|||||||
@@ -236,14 +236,9 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
const setActionList = useCallback((record: ListItem) => {
|
const setActionList = useCallback((record: ListItem) => {
|
||||||
return _.filter(ActionList, (action: any) => {
|
return _.filter(ActionList, (action: any) => {
|
||||||
if (action.key === 'chat') {
|
if (action.key === 'chat') {
|
||||||
return record.ready_replicas > 0 && !record.embedding_only;
|
return record.ready_replicas > 0;
|
||||||
}
|
|
||||||
if (action.key === 'embedding') {
|
|
||||||
return (
|
|
||||||
(record.embedding_only || record.reranker) &&
|
|
||||||
record.ready_replicas > 0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
import { useIntl, useSearchParams } from '@umijs/max';
|
import { useIntl, useSearchParams } from '@umijs/max';
|
||||||
import { Button, Checkbox, Segmented, Tabs, Tooltip } from 'antd';
|
import { Button, Checkbox, Segmented, Tabs, Tooltip } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import _ from 'lodash';
|
||||||
import { PCA } from 'ml-pca';
|
import { PCA } from 'ml-pca';
|
||||||
import 'overlayscrollbars/overlayscrollbars.css';
|
import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
import { Resizable } from 're-resizable';
|
import { Resizable } from 're-resizable';
|
||||||
@@ -147,7 +148,8 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
setScatterData(list);
|
setScatterData(list);
|
||||||
const embeddingJson = embeddings.map((item, index) => {
|
const embeddingJson = embeddings.map((o, index) => {
|
||||||
|
const item = _.cloneDeep(o);
|
||||||
item.embedding = item.embedding.slice(0, 5);
|
item.embedding = item.embedding.slice(0, 5);
|
||||||
item.embedding.push(null);
|
item.embedding.push(null);
|
||||||
return item;
|
return item;
|
||||||
@@ -286,7 +288,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const dataLlist = text.split('\n').map((item: string) => {
|
const dataLlist = text.split('\n').map((item: string) => {
|
||||||
return {
|
return {
|
||||||
text: item?.trim(),
|
text: item?.trim(),
|
||||||
uid: setMessageId(),
|
uid: inputListRef.current?.setMessageId(),
|
||||||
name: ''
|
name: ''
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -300,7 +302,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
.map((item, index) => {
|
.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
uid: setMessageId()
|
uid: inputListRef.current?.setMessageId()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
setTextList(result);
|
setTextList(result);
|
||||||
@@ -449,8 +451,11 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
style={{ width: 60 }}
|
style={{ width: 60 }}
|
||||||
></Button>
|
></Button>
|
||||||
) : (
|
) : (
|
||||||
|
<Tooltip
|
||||||
|
title={intl.formatMessage({ id: 'common.button.stop' })}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
style={{ width: 80 }}
|
style={{ width: 60 }}
|
||||||
size="middle"
|
size="middle"
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={handleStopConversation}
|
onClick={handleStopConversation}
|
||||||
@@ -460,9 +465,8 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
className="font-size-12"
|
className="font-size-12"
|
||||||
></IconFont>
|
></IconFont>
|
||||||
}
|
}
|
||||||
>
|
></Button>
|
||||||
{intl.formatMessage({ id: 'common.button.stop' })}
|
</Tooltip>
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ const initialValues = {
|
|||||||
sampler: 'euler_a',
|
sampler: 'euler_a',
|
||||||
cfg_scale: 4.5,
|
cfg_scale: 4.5,
|
||||||
sample_steps: 10,
|
sample_steps: 10,
|
||||||
negative_prompt: null
|
negative_prompt: null,
|
||||||
|
schedule: 'discrete'
|
||||||
};
|
};
|
||||||
|
|
||||||
const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||||
@@ -241,9 +242,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
stream: true,
|
stream: true,
|
||||||
stream_options: {
|
stream_options: {},
|
||||||
// chunk_result: false
|
|
||||||
},
|
|
||||||
prompt: current?.content || currentPrompt || '',
|
prompt: current?.content || currentPrompt || '',
|
||||||
..._.omitBy(finalParameters, (value: string) => !value)
|
..._.omitBy(finalParameters, (value: string) => !value)
|
||||||
};
|
};
|
||||||
@@ -253,6 +252,15 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
url: `${CREAT_IMAGE_API}?t=${Date.now()}`,
|
url: `${CREAT_IMAGE_API}?t=${Date.now()}`,
|
||||||
signal: requestToken.current.signal
|
signal: requestToken.current.signal
|
||||||
});
|
});
|
||||||
|
if (result.error) {
|
||||||
|
setTokenResult({
|
||||||
|
error: true,
|
||||||
|
errorMessage:
|
||||||
|
result?.data?.error?.message || result?.data?.error || ''
|
||||||
|
});
|
||||||
|
setImageList([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { reader, decoder } = result;
|
const { reader, decoder } = result;
|
||||||
const imgSize = _.split(finalParameters.size, 'x');
|
const imgSize = _.split(finalParameters.size, 'x');
|
||||||
@@ -265,7 +273,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('imgItem.dataUrl:', chunk.data);
|
|
||||||
chunk?.data?.forEach((item: any) => {
|
chunk?.data?.forEach((item: any) => {
|
||||||
const imgItem = newImageList[item.index];
|
const imgItem = newImageList[item.index];
|
||||||
if (item.b64_json) {
|
if (item.b64_json) {
|
||||||
@@ -285,7 +292,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
setImageList([...newImageList]);
|
setImageList([...newImageList]);
|
||||||
console.log('newImageList:', newImageList);
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error:', error);
|
console.log('error:', error);
|
||||||
@@ -320,7 +326,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
sampler: 'euler_a',
|
sampler: 'euler_a',
|
||||||
cfg_scale: 4.5,
|
cfg_scale: 4.5,
|
||||||
sample_steps: 10,
|
sample_steps: 10,
|
||||||
negative_prompt: null
|
negative_prompt: null,
|
||||||
|
schedule: 'discrete'
|
||||||
});
|
});
|
||||||
setParams((pre: object) => {
|
setParams((pre: object) => {
|
||||||
return {
|
return {
|
||||||
@@ -329,7 +336,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
sampler: 'euler_a',
|
sampler: 'euler_a',
|
||||||
cfg_scale: 4.5,
|
cfg_scale: 4.5,
|
||||||
sample_steps: 10,
|
sample_steps: 10,
|
||||||
negative_prompt: null
|
negative_prompt: null,
|
||||||
|
schedule: 'discrete'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -342,7 +350,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
'sampler',
|
'sampler',
|
||||||
'cfg_scale',
|
'cfg_scale',
|
||||||
'sample_steps',
|
'sample_steps',
|
||||||
'negative_prompt'
|
'negative_prompt',
|
||||||
|
'schedule'
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -519,8 +528,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
})}
|
})}
|
||||||
actions={['clear']}
|
actions={['clear']}
|
||||||
defaultSize={{
|
defaultSize={{
|
||||||
minRows: 6,
|
minRows: 5,
|
||||||
maxRows: 6
|
maxRows: 5
|
||||||
}}
|
}}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={!parameters.model}
|
disabled={!parameters.model}
|
||||||
|
|||||||
@@ -294,6 +294,10 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
)}
|
)}
|
||||||
<div className="ground-left-footer">
|
<div className="ground-left-footer">
|
||||||
<MessageInput
|
<MessageInput
|
||||||
|
defaultSize={{
|
||||||
|
minRows: 5,
|
||||||
|
maxRows: 5
|
||||||
|
}}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={!parameters.model}
|
disabled={!parameters.model}
|
||||||
isEmpty={!messageList.length}
|
isEmpty={!messageList.length}
|
||||||
|
|||||||
@@ -365,6 +365,9 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
]
|
]
|
||||||
.filter((item) => item.text)
|
.filter((item) => item.text)
|
||||||
.map((item, index) => {
|
.map((item, index) => {
|
||||||
|
item.percent = undefined;
|
||||||
|
item.score = undefined;
|
||||||
|
item.rank = undefined;
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
uid: setMessageId()
|
uid: setMessageId()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import AlertInfo from '@/components/alert-info';
|
||||||
import AudioAnimation from '@/components/audio-animation';
|
import AudioAnimation from '@/components/audio-animation';
|
||||||
import AudioPlayer from '@/components/audio-player';
|
import AudioPlayer from '@/components/audio-player';
|
||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
@@ -54,7 +55,6 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const controllerRef = useRef<any>(null);
|
const controllerRef = useRef<any>(null);
|
||||||
const scroller = useRef<any>(null);
|
const scroller = useRef<any>(null);
|
||||||
const paramsRef = useRef<any>(null);
|
const paramsRef = useRef<any>(null);
|
||||||
const messageListLengthCache = useRef<number>(0);
|
|
||||||
const [audioPermissionOn, setAudioPermissionOn] = useState(true);
|
const [audioPermissionOn, setAudioPermissionOn] = useState(true);
|
||||||
const [audioData, setAudioData] = useState<any>(null);
|
const [audioData, setAudioData] = useState<any>(null);
|
||||||
const [audioChunks, setAudioChunks] = useState<any>({
|
const [audioChunks, setAudioChunks] = useState<any>({
|
||||||
@@ -113,7 +113,10 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
setTokenResult({
|
setTokenResult({
|
||||||
error: true,
|
error: true,
|
||||||
errorMessage:
|
errorMessage:
|
||||||
result?.data?.error?.message || result?.data?.message || ''
|
result?.data?.error?.message ||
|
||||||
|
result?.data?.message ||
|
||||||
|
result.error.detail ||
|
||||||
|
''
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -172,6 +175,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
async (data: { file: any; fileList: any }) => {
|
async (data: { file: any; fileList: any }) => {
|
||||||
const res = await readAudioFile(data.file);
|
const res = await readAudioFile(data.file);
|
||||||
setAudioData(res);
|
setAudioData(res);
|
||||||
|
setTokenResult(null);
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@@ -187,6 +191,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const handleOnRecord = useCallback((val: boolean) => {
|
const handleOnRecord = useCallback((val: boolean) => {
|
||||||
setIsRecording(val);
|
setIsRecording(val);
|
||||||
setAudioData(null);
|
setAudioData(null);
|
||||||
|
setTokenResult(null);
|
||||||
console.log('data===', val);
|
console.log('data===', val);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -326,6 +331,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
>
|
>
|
||||||
<div className="content" style={{ height: '100%' }}>
|
<div className="content" style={{ height: '100%' }}>
|
||||||
<>
|
<>
|
||||||
|
{!tokenResult && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
padding: '8px 14px',
|
padding: '8px 14px',
|
||||||
@@ -344,6 +350,15 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
{tokenResult && (
|
||||||
|
<div style={{ height: 40 }}>
|
||||||
|
<AlertInfo
|
||||||
|
type="danger"
|
||||||
|
message={tokenResult?.errorMessage}
|
||||||
|
></AlertInfo>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{loading && (
|
{loading && (
|
||||||
<Spin size="small">
|
<Spin size="small">
|
||||||
<div style={{ height: '46px' }}></div>
|
<div style={{ height: '46px' }}></div>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import AlertInfo from '@/components/alert-info';
|
||||||
import IconFont from '@/components/icon-font';
|
import IconFont from '@/components/icon-font';
|
||||||
import SealSelect from '@/components/seal-form/seal-select';
|
import SealSelect from '@/components/seal-form/seal-select';
|
||||||
import SpeechContent from '@/components/speech-content';
|
import SpeechContent from '@/components/speech-content';
|
||||||
@@ -25,7 +26,6 @@ import '../style/ground-left.less';
|
|||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import DynamicParams from './dynamic-params';
|
import DynamicParams from './dynamic-params';
|
||||||
import MessageInput from './message-input';
|
import MessageInput from './message-input';
|
||||||
import ReferenceParams from './reference-params';
|
|
||||||
import ViewCodeModal from './view-code-modal';
|
import ViewCodeModal from './view-code-modal';
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
@@ -96,7 +96,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const submitMessage = async (current?: { role: string; content: string }) => {
|
const submitMessage = async (current?: { role: string; content: string }) => {
|
||||||
await formRef.current?.form.validateFields();
|
// await formRef.current?.form.validateFields();
|
||||||
if (!parameters.model) return;
|
if (!parameters.model) return;
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -120,6 +120,19 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
console.log('result:', res);
|
console.log('result:', res);
|
||||||
|
|
||||||
|
if (res.error) {
|
||||||
|
setTokenResult({
|
||||||
|
error: true,
|
||||||
|
errorMessage:
|
||||||
|
res?.data?.error?.message ||
|
||||||
|
res?.data?.error ||
|
||||||
|
res.error?.detail ||
|
||||||
|
''
|
||||||
|
});
|
||||||
|
setMessageList([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setMessageList([
|
setMessageList([
|
||||||
{
|
{
|
||||||
input: current?.content || currentPrompt,
|
input: current?.content || currentPrompt,
|
||||||
@@ -132,7 +145,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.log('error:', error);
|
console.log('error:', error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -280,7 +293,10 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
</div>
|
</div>
|
||||||
{tokenResult && (
|
{tokenResult && (
|
||||||
<div style={{ height: 40 }}>
|
<div style={{ height: 40 }}>
|
||||||
<ReferenceParams usage={tokenResult}></ReferenceParams>
|
<AlertInfo
|
||||||
|
type="danger"
|
||||||
|
message={tokenResult?.errorMessage}
|
||||||
|
></AlertInfo>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="ground-left-footer">
|
<div className="ground-left-footer">
|
||||||
@@ -289,6 +305,10 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
checkLabel={intl.formatMessage({
|
checkLabel={intl.formatMessage({
|
||||||
id: 'playground.toolbar.autoplay'
|
id: 'playground.toolbar.autoplay'
|
||||||
})}
|
})}
|
||||||
|
defaultSize={{
|
||||||
|
minRows: 5,
|
||||||
|
maxRows: 5
|
||||||
|
}}
|
||||||
onCheck={handleOnCheckChange}
|
onCheck={handleOnCheckChange}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={!parameters.model}
|
disabled={!parameters.model}
|
||||||
|
|||||||
@@ -473,7 +473,10 @@ const MessageInput: React.FC<MessageInputProps> = forwardRef(
|
|||||||
{actions.includes('paste') ? (
|
{actions.includes('paste') ? (
|
||||||
<TextArea
|
<TextArea
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
autoSize={{ minRows: 3, maxRows: 8 }}
|
autoSize={{
|
||||||
|
minRows: defaultSize.minRows,
|
||||||
|
maxRows: defaultSize.maxRows
|
||||||
|
}}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
value={message.content}
|
value={message.content}
|
||||||
size="large"
|
size="large"
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ const MultiCompare: React.FC<MultiCompareProps> = ({ modelList, loaded }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<MessageInput
|
<MessageInput
|
||||||
scope="compare"
|
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
disabled={isLoading || !modelSelections.length || !modelList.length}
|
disabled={isLoading || !modelSelections.length || !modelList.length}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
@@ -303,8 +302,10 @@ const MultiCompare: React.FC<MultiCompareProps> = ({ modelList, loaded }) => {
|
|||||||
updateLayout={updateLayout}
|
updateLayout={updateLayout}
|
||||||
setModelSelections={handleUpdateModelSelections}
|
setModelSelections={handleUpdateModelSelections}
|
||||||
presetPrompt={handlePresetPrompt}
|
presetPrompt={handlePresetPrompt}
|
||||||
modelList={modelFullList}
|
defaultSize={{
|
||||||
showModelSelection={false}
|
minRows: 5,
|
||||||
|
maxRows: 5
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const ThumbImg: React.FC<{
|
|||||||
[onDelete]
|
[onDelete]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_.isEmpty(dataList)) {
|
if (!dataList?.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,6 +254,26 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'Select',
|
||||||
|
name: 'schedule',
|
||||||
|
options: [
|
||||||
|
{ label: 'discrete', value: 'discrete' },
|
||||||
|
{ label: 'karras', value: 'karras' },
|
||||||
|
{ label: 'exponential', value: 'exponential' },
|
||||||
|
{ label: 'ays', value: 'ays' },
|
||||||
|
{ label: 'gits', value: 'gits' }
|
||||||
|
],
|
||||||
|
label: {
|
||||||
|
text: 'playground.image.params.schedule',
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'InputNumber',
|
type: 'InputNumber',
|
||||||
name: 'sample_steps',
|
name: 'sample_steps',
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export const readLargeStreamData = async (
|
|||||||
let buffer = ''; // cache incomplete line
|
let buffer = ''; // cache incomplete line
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader?.read?.();
|
||||||
if (done) {
|
if (done) {
|
||||||
// Process remaining buffered data
|
// Process remaining buffered data
|
||||||
if (buffer.trim()) {
|
if (buffer.trim()) {
|
||||||
@@ -131,14 +131,14 @@ export const readLargeStreamData = async (
|
|||||||
buffer = lines.pop() || ''; // Keep last line (may be incomplete)
|
buffer = lines.pop() || ''; // Keep last line (may be incomplete)
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line === '[DONE]') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (line.startsWith('data: ')) {
|
if (line.startsWith('data: ')) {
|
||||||
const jsonStr = line.slice(6).trim();
|
const jsonStr = line.slice(6).trim();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (jsonStr !== '[DONE]') {
|
||||||
const jsonData = JSON.parse(jsonStr);
|
const jsonData = JSON.parse(jsonStr);
|
||||||
callback(jsonData);
|
callback(jsonData);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to parse JSON:', jsonStr, e);
|
console.error('Failed to parse JSON:', jsonStr, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user