diff --git a/src/locales/en-US/playground.ts b/src/locales/en-US/playground.ts index a6b4c976..1aeb50db 100644 --- a/src/locales/en-US/playground.ts +++ b/src/locales/en-US/playground.ts @@ -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.' }; diff --git a/src/locales/zh-CN/playground.ts b/src/locales/zh-CN/playground.ts index ec1b6581..886ad3bd 100644 --- a/src/locales/zh-CN/playground.ts +++ b/src/locales/zh-CN/playground.ts @@ -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': + '图表中,点之间的距离表示对应文档之间的相似度。' }; diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 8ccff5a8..4a48f723 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -423,80 +423,83 @@ const Models: React.FC = ({ [] ); - const renderModelTags = useCallback((record: ListItem) => { - if (record.reranker) { - return ( - - Reranker - - ); - } + const renderModelTags = useCallback( + (record: ListItem) => { + if (record.reranker) { + return ( + + Reranker + + ); + } - if (record.embedding_only && !record.reranker) { - return ( - - Embedding Only - - ); - } - if (record.text_to_speech) { - return ( - - {intl.formatMessage({ id: 'playground.audio.texttospeech' })} - - ); - } - if (record.speech_to_text) { - return ( - - {intl.formatMessage({ id: 'playground.audio.speechtotext' })} - - ); - } - if (record.image_only) { - return ( - - Image Only - - ); - } - return null; - }, []); + if (record.embedding_only && !record.reranker) { + return ( + + Embedding Only + + ); + } + if (record.text_to_speech) { + return ( + + {intl.formatMessage({ id: 'playground.audio.texttospeech' })} + + ); + } + if (record.speech_to_text) { + return ( + + {intl.formatMessage({ id: 'playground.audio.speechtotext' })} + + ); + } + if (record.image_only) { + return ( + + Image Only + + ); + } + return null; + }, + [intl] + ); const renderChildren = useCallback( (list: any, parent?: any) => { return ( diff --git a/src/pages/llmodels/config/llama-config.ts b/src/pages/llmodels/config/llama-config.ts index f4497545..d5b94633 100644 --- a/src/pages/llmodels/config/llama-config.ts +++ b/src/pages/llmodels/config/llama-config.ts @@ -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'] } ]; diff --git a/src/pages/playground/components/ground-embedding.tsx b/src/pages/playground/components/ground-embedding.tsx index 0e688bdc..76f5017d 100644 --- a/src/pages/playground/components/ground-embedding.tsx +++ b/src/pages/playground/components/ground-embedding.tsx @@ -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 = forwardRef((props, ref) => { ]); const [scatterData, setScatterData] = useState([]); + const resizeMaxHeight = 400; const { initialize, updateScrollerPosition: updateDocumentScrollerPosition } = useOverlayScroller(); @@ -252,7 +254,10 @@ const GroundEmbedding: React.FC = 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 = 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 = forwardRef((props, ref) => { })} - {/* - { - multiplePasteEnable.current = checked; - }} - /> - */} + + + ) }} - maxHeight={300} + maxHeight={resizeMaxHeight} minHeight={180} onResizeStop={handleScaleOutputSize} > diff --git a/src/pages/playground/components/ground-images.tsx b/src/pages/playground/components/ground-images.tsx index 826f2811..ad350561 100644 --- a/src/pages/playground/components/ground-images.tsx +++ b/src/pages/playground/components/ground-images.tsx @@ -231,7 +231,7 @@ const GroundImages: React.FC = 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 = 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 = 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 }; }); diff --git a/src/pages/playground/components/ground-reranker.tsx b/src/pages/playground/components/ground-reranker.tsx index dd87308c..05c9c5f0 100644 --- a/src/pages/playground/components/ground-reranker.tsx +++ b/src/pages/playground/components/ground-reranker.tsx @@ -350,17 +350,19 @@ const GroundReranker: React.FC = 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 = forwardRef((props, ref) => { })} - {/* - { - multiplePasteEnable.current = checked; - }} - /> - */}