fix: rerank clear failed
This commit is contained in:
@@ -98,5 +98,10 @@ export default {
|
|||||||
'playground.image.params.cfgScale': 'Scale Factor',
|
'playground.image.params.cfgScale': 'Scale Factor',
|
||||||
'playground.image.params.custom': 'Custom',
|
'playground.image.params.custom': 'Custom',
|
||||||
'playground.image.params.custom.tips': 'Parameter definition',
|
'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.cfgScale': '缩放因子',
|
||||||
'playground.image.params.custom': '自定义',
|
'playground.image.params.custom': '自定义',
|
||||||
'playground.image.params.custom.tips': '参数定义',
|
'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) => {
|
const renderModelTags = useCallback(
|
||||||
if (record.reranker) {
|
(record: ListItem) => {
|
||||||
return (
|
if (record.reranker) {
|
||||||
<Tag
|
return (
|
||||||
style={{
|
<Tag
|
||||||
margin: 0,
|
style={{
|
||||||
opacity: 0.8,
|
margin: 0,
|
||||||
transform: 'scale(0.9)'
|
opacity: 0.8,
|
||||||
}}
|
transform: 'scale(0.9)'
|
||||||
color="geekblue"
|
}}
|
||||||
>
|
color="geekblue"
|
||||||
Reranker
|
>
|
||||||
</Tag>
|
Reranker
|
||||||
);
|
</Tag>
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (record.embedding_only && !record.reranker) {
|
if (record.embedding_only && !record.reranker) {
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
transform: 'scale(0.9)'
|
transform: 'scale(0.9)'
|
||||||
}}
|
}}
|
||||||
color="geekblue"
|
color="geekblue"
|
||||||
>
|
>
|
||||||
Embedding Only
|
Embedding Only
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (record.text_to_speech) {
|
if (record.text_to_speech) {
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
transform: 'scale(0.9)'
|
transform: 'scale(0.9)'
|
||||||
}}
|
}}
|
||||||
color="geekblue"
|
color="geekblue"
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'playground.audio.texttospeech' })}
|
{intl.formatMessage({ id: 'playground.audio.texttospeech' })}
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (record.speech_to_text) {
|
if (record.speech_to_text) {
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
transform: 'scale(0.9)'
|
transform: 'scale(0.9)'
|
||||||
}}
|
}}
|
||||||
color="geekblue"
|
color="geekblue"
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'playground.audio.speechtotext' })}
|
{intl.formatMessage({ id: 'playground.audio.speechtotext' })}
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (record.image_only) {
|
if (record.image_only) {
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
transform: 'scale(0.9)'
|
transform: 'scale(0.9)'
|
||||||
}}
|
}}
|
||||||
color="geekblue"
|
color="geekblue"
|
||||||
>
|
>
|
||||||
Image Only
|
Image Only
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}, []);
|
},
|
||||||
|
[intl]
|
||||||
|
);
|
||||||
const renderChildren = useCallback(
|
const renderChildren = useCallback(
|
||||||
(list: any, parent?: any) => {
|
(list: any, parent?: any) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -27,6 +27,55 @@ const options = [
|
|||||||
{
|
{
|
||||||
label: '--images',
|
label: '--images',
|
||||||
value: '--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 {
|
import {
|
||||||
ClearOutlined,
|
ClearOutlined,
|
||||||
HolderOutlined,
|
HolderOutlined,
|
||||||
|
InfoCircleOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
SendOutlined
|
SendOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useIntl, useSearchParams } from '@umijs/max';
|
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 classNames from 'classnames';
|
||||||
import { PCA } from 'ml-pca';
|
import { PCA } from 'ml-pca';
|
||||||
import 'overlayscrollbars/overlayscrollbars.css';
|
import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
@@ -98,6 +99,7 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const [scatterData, setScatterData] = useState<any[]>([]);
|
const [scatterData, setScatterData] = useState<any[]>([]);
|
||||||
|
const resizeMaxHeight = 400;
|
||||||
|
|
||||||
const { initialize, updateScrollerPosition: updateDocumentScrollerPosition } =
|
const { initialize, updateScrollerPosition: updateDocumentScrollerPosition } =
|
||||||
useOverlayScroller();
|
useOverlayScroller();
|
||||||
@@ -252,7 +254,10 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
d: any
|
d: any
|
||||||
) => {
|
) => {
|
||||||
console.log('handleScaleOutputSize', e, direction, ref, d);
|
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);
|
setOutputHeight(d.height + outputHeight);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -277,18 +282,19 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
if (!multiplePasteEnable.current) return;
|
if (!multiplePasteEnable.current) return;
|
||||||
const text = e.clipboardData.getData('text');
|
const text = e.clipboardData.getData('text');
|
||||||
if (text) {
|
if (text) {
|
||||||
console.log('text:', text);
|
const dataLlist = text.split('\n').map((item: string) => {
|
||||||
const dataLlist = text
|
return {
|
||||||
.split('\n')
|
text: item?.trim(),
|
||||||
.map((item: string) => {
|
uid: inputListRef.current?.setMessageId(),
|
||||||
return {
|
name: ''
|
||||||
text: item?.trim(),
|
};
|
||||||
uid: inputListRef.current?.setMessageId(),
|
});
|
||||||
name: ''
|
const result = [
|
||||||
};
|
...textList.slice(0, index),
|
||||||
})
|
...dataLlist,
|
||||||
.filter((item: any) => item.text);
|
...textList.slice(index + 1)
|
||||||
setTextList([...textList.slice(0, index), ...dataLlist]);
|
].filter((item) => item.text);
|
||||||
|
setTextList(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[textList]
|
[textList]
|
||||||
@@ -408,24 +414,6 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
})}
|
})}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</Button>
|
</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}>
|
<Button size="middle" onClick={handleAddText}>
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
{intl.formatMessage({ id: 'playground.embedding.addtext' })}
|
{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">
|
<h3 className="m-l-10 flex-between flex-center font-size-14 line-24 m-b-16">
|
||||||
<div className="flex gap-20">
|
<div className="flex gap-20">
|
||||||
<span>
|
<span className="flex-center">
|
||||||
{intl.formatMessage({ id: 'playground.embedding.output' })}
|
{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>
|
</span>
|
||||||
<AlertInfo
|
<AlertInfo
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -529,21 +537,27 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
}}
|
}}
|
||||||
handleComponent={{
|
handleComponent={{
|
||||||
top: (
|
top: (
|
||||||
<Button
|
<Tooltip
|
||||||
size="small"
|
title={intl.formatMessage({
|
||||||
className="drag-handler"
|
id: 'playground.embedding.handler.tips'
|
||||||
color="default"
|
})}
|
||||||
variant="filled"
|
>
|
||||||
icon={
|
<Button
|
||||||
<HolderOutlined
|
size="small"
|
||||||
rotate={90}
|
className="drag-handler"
|
||||||
style={{ fontSize: 'var(--font-size-14)' }}
|
color="default"
|
||||||
/>
|
variant="filled"
|
||||||
}
|
icon={
|
||||||
></Button>
|
<HolderOutlined
|
||||||
|
rotate={90}
|
||||||
|
style={{ fontSize: 'var(--font-size-14)' }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
></Button>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
maxHeight={300}
|
maxHeight={resizeMaxHeight}
|
||||||
minHeight={180}
|
minHeight={180}
|
||||||
onResizeStop={handleScaleOutputSize}
|
onResizeStop={handleScaleOutputSize}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
|
|
||||||
const result: any = await fetchChunkedData({
|
const result: any = await fetchChunkedData({
|
||||||
data: params,
|
data: params,
|
||||||
url: CREAT_IMAGE_API,
|
url: `${CREAT_IMAGE_API}?t=${Date.now()}`,
|
||||||
signal: requestToken.current.signal
|
signal: requestToken.current.signal
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -301,8 +301,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
form.current?.form?.setFieldsValue({
|
form.current?.form?.setFieldsValue({
|
||||||
seed: null,
|
seed: null,
|
||||||
sampler: 'euler_a',
|
sampler: 'euler_a',
|
||||||
cfg_scale: 1,
|
cfg_scale: 4.5,
|
||||||
sample_steps: 5,
|
sample_steps: 10,
|
||||||
negative_prompt: null
|
negative_prompt: null
|
||||||
});
|
});
|
||||||
setParams((pre: object) => {
|
setParams((pre: object) => {
|
||||||
@@ -310,8 +310,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
..._.omit(pre, ['quality', 'style']),
|
..._.omit(pre, ['quality', 'style']),
|
||||||
seed: null,
|
seed: null,
|
||||||
sampler: 'euler_a',
|
sampler: 'euler_a',
|
||||||
cfg_scale: 1,
|
cfg_scale: 4.5,
|
||||||
sample_steps: 5,
|
sample_steps: 10,
|
||||||
negative_prompt: null
|
negative_prompt: null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -350,17 +350,19 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const text = e.clipboardData.getData('text');
|
const text = e.clipboardData.getData('text');
|
||||||
if (text) {
|
if (text) {
|
||||||
console.log('text:', text);
|
console.log('text:', text);
|
||||||
const dataLlist = text
|
const dataLlist = text.split('\n').map((item: string) => {
|
||||||
.split('\n')
|
return {
|
||||||
.map((item: string) => {
|
text: item?.trim(),
|
||||||
return {
|
uid: inputListRef.current?.setMessageId(),
|
||||||
text: item?.trim(),
|
name: ''
|
||||||
uid: inputListRef.current?.setMessageId(),
|
};
|
||||||
name: ''
|
});
|
||||||
};
|
const result = [
|
||||||
})
|
...textList.slice(0, index),
|
||||||
.filter((item: any) => item.text);
|
...dataLlist,
|
||||||
setTextList([...textList.slice(0, index), ...dataLlist]);
|
...textList.slice(index + 1)
|
||||||
|
].filter((item) => item.text);
|
||||||
|
setTextList(result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[textList]
|
[textList]
|
||||||
@@ -475,24 +477,6 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
})}
|
})}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</Button>
|
</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}>
|
<Button size="middle" onClick={handleAddText}>
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
{intl.formatMessage({ id: 'playground.embedding.addtext' })}
|
{intl.formatMessage({ id: 'playground.embedding.addtext' })}
|
||||||
@@ -508,6 +492,7 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="docs-wrapper">
|
<div className="docs-wrapper">
|
||||||
<InputList
|
<InputList
|
||||||
|
key={messageId.current}
|
||||||
sortIndex={sortIndexMap}
|
sortIndex={sortIndexMap}
|
||||||
ref={inputListRef}
|
ref={inputListRef}
|
||||||
textList={textList}
|
textList={textList}
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="content">
|
<div className="content" style={{ maxWidth: 1000 }}>
|
||||||
{messageList.length ? (
|
{messageList.length ? (
|
||||||
<SpeechContent dataList={messageList} loading={loading} />
|
<SpeechContent dataList={messageList} loading={loading} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
|||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 100
|
max: 100,
|
||||||
|
defaultValue: 10
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@@ -275,13 +276,14 @@ export const ImageAdvancedParamsConfig: ParamsSchema[] = [
|
|||||||
type: 'InputNumber',
|
type: 'InputNumber',
|
||||||
name: 'cfg_scale',
|
name: 'cfg_scale',
|
||||||
label: {
|
label: {
|
||||||
text: 'playground.image.params.cfgScale',
|
text: 'CFG Scale',
|
||||||
isLocalized: true
|
isLocalized: false
|
||||||
},
|
},
|
||||||
attrs: {
|
attrs: {
|
||||||
min: 1.0,
|
min: 1.0,
|
||||||
max: 10,
|
max: 10,
|
||||||
step: 0.1
|
step: 0.1,
|
||||||
|
defaulValue: 4.5
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user