fix: rerank clear failed
This commit is contained in:
@@ -98,5 +98,10 @@ export default {
|
||||
'playground.image.params.cfgScale': 'Scale Factor',
|
||||
'playground.image.params.custom': 'Custom',
|
||||
'playground.image.params.custom.tips': 'Parameter definition',
|
||||
'playground.image.params.openai': 'OpenAI Compatible'
|
||||
'playground.image.params.openai': 'OpenAI Compatible',
|
||||
'playground.embedding.handler.tips': 'Resize Height',
|
||||
'playground.embedding.pcatips1':
|
||||
'PCA is used to reduce the dimensionality of document vectors, projecting new data into PCA space.',
|
||||
'playground.embedding.pcatips2':
|
||||
'In the chart, the distance between points represents the similarity between documents.'
|
||||
};
|
||||
|
||||
@@ -96,5 +96,10 @@ export default {
|
||||
'playground.image.params.cfgScale': '缩放因子',
|
||||
'playground.image.params.custom': '自定义',
|
||||
'playground.image.params.custom.tips': '参数定义',
|
||||
'playground.image.params.openai': 'OpenAI 兼容'
|
||||
'playground.image.params.openai': 'OpenAI 兼容',
|
||||
'playground.embedding.handler.tips': '高度调节',
|
||||
'playground.embedding.pcatips1':
|
||||
'采用主成分分析(PCA)对文档向量化后的数据降维,将新数据投射到PCA 空间中。',
|
||||
'playground.embedding.pcatips2':
|
||||
'图表中,点之间的距离表示对应文档之间的相似度。'
|
||||
};
|
||||
|
||||
@@ -423,80 +423,83 @@ const Models: React.FC<ModelsProps> = ({
|
||||
[]
|
||||
);
|
||||
|
||||
const renderModelTags = useCallback((record: ListItem) => {
|
||||
if (record.reranker) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Reranker
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
const renderModelTags = useCallback(
|
||||
(record: ListItem) => {
|
||||
if (record.reranker) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Reranker
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
|
||||
if (record.embedding_only && !record.reranker) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Embedding Only
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.text_to_speech) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
{intl.formatMessage({ id: 'playground.audio.texttospeech' })}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.speech_to_text) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
{intl.formatMessage({ id: 'playground.audio.speechtotext' })}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.image_only) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Image Only
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}, []);
|
||||
if (record.embedding_only && !record.reranker) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Embedding Only
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.text_to_speech) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
{intl.formatMessage({ id: 'playground.audio.texttospeech' })}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.speech_to_text) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
{intl.formatMessage({ id: 'playground.audio.speechtotext' })}
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
if (record.image_only) {
|
||||
return (
|
||||
<Tag
|
||||
style={{
|
||||
margin: 0,
|
||||
opacity: 0.8,
|
||||
transform: 'scale(0.9)'
|
||||
}}
|
||||
color="geekblue"
|
||||
>
|
||||
Image Only
|
||||
</Tag>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
[intl]
|
||||
);
|
||||
const renderChildren = useCallback(
|
||||
(list: any, parent?: any) => {
|
||||
return (
|
||||
|
||||
@@ -27,6 +27,55 @@ const options = [
|
||||
{
|
||||
label: '--images',
|
||||
value: '--images'
|
||||
},
|
||||
{
|
||||
label: '--image-max-batch',
|
||||
value: '--image-max-batch'
|
||||
},
|
||||
{
|
||||
label: '--image-max-height',
|
||||
value: '--image-max-height'
|
||||
},
|
||||
{
|
||||
label: '--image-max-width',
|
||||
value: '--image-max-width'
|
||||
},
|
||||
{
|
||||
label: '--image-guidance',
|
||||
value: '--image-guidance'
|
||||
},
|
||||
{
|
||||
label: '--image-strength',
|
||||
value: '--image-strength'
|
||||
},
|
||||
{
|
||||
label: '--image-sampler',
|
||||
value: '--image-sampler',
|
||||
options: [
|
||||
'euler_a',
|
||||
'euler',
|
||||
'heun',
|
||||
'dpm2',
|
||||
'dpm++2s_a',
|
||||
'dpm++2m',
|
||||
'dpm++2mv2',
|
||||
'ipndm',
|
||||
'ipndm_v',
|
||||
'lcm'
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '--image-sampler-steps',
|
||||
value: '--image-sample-steps'
|
||||
},
|
||||
{
|
||||
label: '--image-cfg-scale',
|
||||
value: '--image-cfg-scale'
|
||||
},
|
||||
{
|
||||
label: '--image-schedule',
|
||||
value: '--image-schedule',
|
||||
options: ['default', 'discrete', 'karras', 'exponential', 'ays', 'gits']
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ import useRequestToken from '@/hooks/use-request-token';
|
||||
import {
|
||||
ClearOutlined,
|
||||
HolderOutlined,
|
||||
InfoCircleOutlined,
|
||||
PlusOutlined,
|
||||
SendOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { useIntl, useSearchParams } from '@umijs/max';
|
||||
import { Button, Checkbox, Segmented, Tabs } from 'antd';
|
||||
import { Button, Checkbox, Segmented, Tabs, Tooltip } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import { PCA } from 'ml-pca';
|
||||
import 'overlayscrollbars/overlayscrollbars.css';
|
||||
@@ -98,6 +99,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
]);
|
||||
|
||||
const [scatterData, setScatterData] = useState<any[]>([]);
|
||||
const resizeMaxHeight = 400;
|
||||
|
||||
const { initialize, updateScrollerPosition: updateDocumentScrollerPosition } =
|
||||
useOverlayScroller();
|
||||
@@ -252,7 +254,10 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
d: any
|
||||
) => {
|
||||
console.log('handleScaleOutputSize', e, direction, ref, d);
|
||||
if (d.height + outputHeight <= 300 && d.height + outputHeight >= 180) {
|
||||
if (
|
||||
d.height + outputHeight <= resizeMaxHeight &&
|
||||
d.height + outputHeight >= 180
|
||||
) {
|
||||
setOutputHeight(d.height + outputHeight);
|
||||
}
|
||||
};
|
||||
@@ -277,18 +282,19 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
if (!multiplePasteEnable.current) return;
|
||||
const text = e.clipboardData.getData('text');
|
||||
if (text) {
|
||||
console.log('text:', text);
|
||||
const dataLlist = text
|
||||
.split('\n')
|
||||
.map((item: string) => {
|
||||
return {
|
||||
text: item?.trim(),
|
||||
uid: inputListRef.current?.setMessageId(),
|
||||
name: ''
|
||||
};
|
||||
})
|
||||
.filter((item: any) => item.text);
|
||||
setTextList([...textList.slice(0, index), ...dataLlist]);
|
||||
const dataLlist = text.split('\n').map((item: string) => {
|
||||
return {
|
||||
text: item?.trim(),
|
||||
uid: inputListRef.current?.setMessageId(),
|
||||
name: ''
|
||||
};
|
||||
});
|
||||
const result = [
|
||||
...textList.slice(0, index),
|
||||
...dataLlist,
|
||||
...textList.slice(index + 1)
|
||||
].filter((item) => item.text);
|
||||
setTextList(result);
|
||||
}
|
||||
},
|
||||
[textList]
|
||||
@@ -408,24 +414,6 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
})}
|
||||
</Checkbox>
|
||||
</Button>
|
||||
{/* <Tooltip
|
||||
title={intl.formatMessage({
|
||||
id: 'playground.input.multiplePaste'
|
||||
})}
|
||||
>
|
||||
<Switch
|
||||
checkedChildren={intl.formatMessage({
|
||||
id: 'playground.multiple.on'
|
||||
})}
|
||||
unCheckedChildren={intl.formatMessage({
|
||||
id: 'playground.multiple.off'
|
||||
})}
|
||||
defaultChecked={multiplePasteEnable.current}
|
||||
onChange={(checked) => {
|
||||
multiplePasteEnable.current = checked;
|
||||
}}
|
||||
/>
|
||||
</Tooltip> */}
|
||||
<Button size="middle" onClick={handleAddText}>
|
||||
<PlusOutlined />
|
||||
{intl.formatMessage({ id: 'playground.embedding.addtext' })}
|
||||
@@ -497,8 +485,28 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
>
|
||||
<h3 className="m-l-10 flex-between flex-center font-size-14 line-24 m-b-16">
|
||||
<div className="flex gap-20">
|
||||
<span>
|
||||
<span className="flex-center">
|
||||
{intl.formatMessage({ id: 'playground.embedding.output' })}
|
||||
<Tooltip
|
||||
title={
|
||||
<span className="flex-column">
|
||||
<span>
|
||||
1.
|
||||
{intl.formatMessage({
|
||||
id: 'playground.embedding.pcatips1'
|
||||
})}
|
||||
</span>
|
||||
<span>
|
||||
2.{' '}
|
||||
{intl.formatMessage({
|
||||
id: 'playground.embedding.pcatips2'
|
||||
})}
|
||||
</span>
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<InfoCircleOutlined className="m-l-4" />
|
||||
</Tooltip>
|
||||
</span>
|
||||
<AlertInfo
|
||||
type="danger"
|
||||
@@ -529,21 +537,27 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
}}
|
||||
handleComponent={{
|
||||
top: (
|
||||
<Button
|
||||
size="small"
|
||||
className="drag-handler"
|
||||
color="default"
|
||||
variant="filled"
|
||||
icon={
|
||||
<HolderOutlined
|
||||
rotate={90}
|
||||
style={{ fontSize: 'var(--font-size-14)' }}
|
||||
/>
|
||||
}
|
||||
></Button>
|
||||
<Tooltip
|
||||
title={intl.formatMessage({
|
||||
id: 'playground.embedding.handler.tips'
|
||||
})}
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
className="drag-handler"
|
||||
color="default"
|
||||
variant="filled"
|
||||
icon={
|
||||
<HolderOutlined
|
||||
rotate={90}
|
||||
style={{ fontSize: 'var(--font-size-14)' }}
|
||||
/>
|
||||
}
|
||||
></Button>
|
||||
</Tooltip>
|
||||
)
|
||||
}}
|
||||
maxHeight={300}
|
||||
maxHeight={resizeMaxHeight}
|
||||
minHeight={180}
|
||||
onResizeStop={handleScaleOutputSize}
|
||||
>
|
||||
|
||||
@@ -231,7 +231,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
|
||||
const result: any = await fetchChunkedData({
|
||||
data: params,
|
||||
url: CREAT_IMAGE_API,
|
||||
url: `${CREAT_IMAGE_API}?t=${Date.now()}`,
|
||||
signal: requestToken.current.signal
|
||||
});
|
||||
|
||||
@@ -301,8 +301,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
form.current?.form?.setFieldsValue({
|
||||
seed: null,
|
||||
sampler: 'euler_a',
|
||||
cfg_scale: 1,
|
||||
sample_steps: 5,
|
||||
cfg_scale: 4.5,
|
||||
sample_steps: 10,
|
||||
negative_prompt: null
|
||||
});
|
||||
setParams((pre: object) => {
|
||||
@@ -310,8 +310,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
..._.omit(pre, ['quality', 'style']),
|
||||
seed: null,
|
||||
sampler: 'euler_a',
|
||||
cfg_scale: 1,
|
||||
sample_steps: 5,
|
||||
cfg_scale: 4.5,
|
||||
sample_steps: 10,
|
||||
negative_prompt: null
|
||||
};
|
||||
});
|
||||
|
||||
@@ -350,17 +350,19 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
const text = e.clipboardData.getData('text');
|
||||
if (text) {
|
||||
console.log('text:', text);
|
||||
const dataLlist = text
|
||||
.split('\n')
|
||||
.map((item: string) => {
|
||||
return {
|
||||
text: item?.trim(),
|
||||
uid: inputListRef.current?.setMessageId(),
|
||||
name: ''
|
||||
};
|
||||
})
|
||||
.filter((item: any) => item.text);
|
||||
setTextList([...textList.slice(0, index), ...dataLlist]);
|
||||
const dataLlist = text.split('\n').map((item: string) => {
|
||||
return {
|
||||
text: item?.trim(),
|
||||
uid: inputListRef.current?.setMessageId(),
|
||||
name: ''
|
||||
};
|
||||
});
|
||||
const result = [
|
||||
...textList.slice(0, index),
|
||||
...dataLlist,
|
||||
...textList.slice(index + 1)
|
||||
].filter((item) => item.text);
|
||||
setTextList(result);
|
||||
}
|
||||
},
|
||||
[textList]
|
||||
@@ -475,24 +477,6 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
})}
|
||||
</Checkbox>
|
||||
</Button>
|
||||
{/* <Tooltip
|
||||
title={intl.formatMessage({
|
||||
id: 'playground.input.multiplePaste'
|
||||
})}
|
||||
>
|
||||
<Switch
|
||||
checkedChildren={intl.formatMessage({
|
||||
id: 'playground.multiple.on'
|
||||
})}
|
||||
unCheckedChildren={intl.formatMessage({
|
||||
id: 'playground.multiple.off'
|
||||
})}
|
||||
defaultChecked={multiplePasteEnable.current}
|
||||
onChange={(checked) => {
|
||||
multiplePasteEnable.current = checked;
|
||||
}}
|
||||
/>
|
||||
</Tooltip> */}
|
||||
<Button size="middle" onClick={handleAddText}>
|
||||
<PlusOutlined />
|
||||
{intl.formatMessage({ id: 'playground.embedding.addtext' })}
|
||||
@@ -508,6 +492,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
</div>
|
||||
<div className="docs-wrapper">
|
||||
<InputList
|
||||
key={messageId.current}
|
||||
sortIndex={sortIndexMap}
|
||||
ref={inputListRef}
|
||||
textList={textList}
|
||||
|
||||
@@ -253,7 +253,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
alignItems: 'center'
|
||||
}}
|
||||
>
|
||||
<div className="content">
|
||||
<div className="content" style={{ maxWidth: 1000 }}>
|
||||
{messageList.length ? (
|
||||
<SpeechContent dataList={messageList} loading={loading} />
|
||||
) : (
|
||||
|
||||
@@ -263,7 +263,8 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
||||
},
|
||||
attrs: {
|
||||
min: 1,
|
||||
max: 100
|
||||
max: 100,
|
||||
defaultValue: 10
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
@@ -275,13 +276,14 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
||||
type: 'InputNumber',
|
||||
name: 'cfg_scale',
|
||||
label: {
|
||||
text: 'playground.image.params.cfgScale',
|
||||
isLocalized: true
|
||||
text: 'CFG Scale',
|
||||
isLocalized: false
|
||||
},
|
||||
attrs: {
|
||||
min: 1.0,
|
||||
max: 10,
|
||||
step: 0.1
|
||||
step: 0.1,
|
||||
defaulValue: 4.5
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user