diff --git a/src/assets/styles/common.less b/src/assets/styles/common.less
index 5d30537e..2077d7c3 100644
--- a/src/assets/styles/common.less
+++ b/src/assets/styles/common.less
@@ -42,6 +42,14 @@
margin-left: 40px;
}
+.m-t-16 {
+ margin-top: 16px;
+}
+
+.m-t-10 {
+ margin-top: 10px;
+}
+
.m-r-10 {
margin-right: 10px;
}
diff --git a/src/constants/external-links.ts b/src/constants/external-links.ts
index c0a337c5..278cebbb 100644
--- a/src/constants/external-links.ts
+++ b/src/constants/external-links.ts
@@ -9,5 +9,5 @@ const externalLinks = {
export default externalLinks;
export const externalRefer = {
- audioPermission: `${externalLinks.documentation}latest/user-guide/playground/#audio-playground`
+ audioPermission: `${externalLinks.documentation}latest/user-guide/playground/#audio-speech-to-text`
};
diff --git a/src/global.less b/src/global.less
index 5c728fbc..c2bc70ab 100644
--- a/src/global.less
+++ b/src/global.less
@@ -713,6 +713,17 @@ body {
}
}
+.full-wrap::after {
+ content: '';
+ display: flex;
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ z-index: 1;
+}
+
.login-wrapper {
position: fixed;
top: 0;
diff --git a/src/locales/en-US/playground.ts b/src/locales/en-US/playground.ts
index bfdd7c11..6053d66e 100644
--- a/src/locales/en-US/playground.ts
+++ b/src/locales/en-US/playground.ts
@@ -77,6 +77,7 @@ export default {
'playground.rerank.score': 'Score',
'playground.rerank.query.holder': 'Input your query',
'playground.image.prompt': 'Text Prompt',
+ 'playground.audio.textinput': 'Text Input',
'playground.audio.texttospeech': 'Text to Speech',
'playground.audio.speechtotext': 'Speech to Text',
'playground.audio.texttospeech.tips': 'Generated speech will appear here',
@@ -121,5 +122,7 @@ export default {
'playgorund.audio.voice.error':
'Voices are unavailable. The model may still be initializing. Please refresh after a brief wait.',
'playground.params.size.description':
- 'The maximum size of the generated image is controlled by the deployment parameters of the model. Refer to'
+ 'The maximum size of the generated image is controlled by the deployment parameters of the model. Refer to',
+ 'playground.documents.verify.embedding': 'At least add two pieces of text.',
+ 'playground.documents.verify.rerank': 'The documents cannot be empty.'
};
diff --git a/src/locales/zh-CN/playground.ts b/src/locales/zh-CN/playground.ts
index ff04b288..966893b6 100644
--- a/src/locales/zh-CN/playground.ts
+++ b/src/locales/zh-CN/playground.ts
@@ -77,6 +77,7 @@ export default {
'playground.rerank.score': '分数',
'playground.rerank.query.holder': '输入查询',
'playground.image.prompt': '输入提示',
+ 'playground.audio.textinput': '输入文本',
'playground.audio.texttospeech': '文本转语音',
'playground.audio.speechtotext': '语音转文本',
'playground.audio.texttospeech.tips': '生成的语音将出现在这里',
@@ -118,5 +119,7 @@ export default {
'playgorund.audio.voice.error':
'声音无法使用。该模型可能仍在初始化。请稍候后刷新。',
'playground.params.size.description':
- '图片生成的最大尺寸受控于模型的部署参数。参考文档'
+ '图片生成的最大尺寸受控于模型的部署参数。参考文档',
+ 'playground.documents.verify.embedding': '至少输入两条文本',
+ 'playground.documents.verify.rerank': '文档不能为空'
};
diff --git a/src/pages/playground/components/ground-embedding.tsx b/src/pages/playground/components/ground-embedding.tsx
index fc0c821e..68f0b96a 100644
--- a/src/pages/playground/components/ground-embedding.tsx
+++ b/src/pages/playground/components/ground-embedding.tsx
@@ -339,6 +339,10 @@ const GroundEmbedding: React.FC = forwardRef((props, ref) => {
setScatterData([]);
setTokenResult(null);
setLessTwoInput(false);
+ setEmbeddingData({
+ code: '',
+ copyValue: ''
+ });
};
const handleOutputTypeChange = (value: string) => {
@@ -522,7 +526,9 @@ const GroundEmbedding: React.FC = forwardRef((props, ref) => {
{lessTwoInput && (
)}
diff --git a/src/pages/playground/components/ground-reranker.tsx b/src/pages/playground/components/ground-reranker.tsx
index c887d41f..70c94b22 100644
--- a/src/pages/playground/components/ground-reranker.tsx
+++ b/src/pages/playground/components/ground-reranker.tsx
@@ -1,3 +1,4 @@
+import AlertInfo from '@/components/alert-info';
import HotKeys, { KeyMap } from '@/config/hotkeys';
import useOverlayScroller from '@/hooks/use-overlay-scroller';
import useRequestToken from '@/hooks/use-request-token';
@@ -86,6 +87,7 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
const requestToken = useRef(null);
const formRef = useRef(null);
const multiplePasteEnable = useRef(true);
+ const [isEmptyText, setIsEmptyText] = useState(false);
const [fileList, setFileList] = useState<
{
text: string;
@@ -200,6 +202,15 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
await formRef.current?.form.validateFields();
if (!parameters.model) return;
try {
+ const documentList: any[] = [...textList, ...fileList];
+
+ const validDocus = documentList.filter((item) => item.text);
+
+ if (!validDocus.length) {
+ setIsEmptyText(true);
+ return;
+ }
+ setIsEmptyText(false);
setLoading(true);
setMessageId();
setTokenResult(null);
@@ -210,8 +221,6 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
contentRef.current = current?.content || '';
- const documentList: any[] = [...textList, ...fileList];
-
const result: any = await rerankerQuery(
{
model: parameters.model,
@@ -422,6 +431,7 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
]);
setFileList([]);
setTokenResult(null);
+ setIsEmptyText(false);
};
useHotkeys(
@@ -489,16 +499,9 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
}
>
-
+
}
placeholder={intl.formatMessage({
@@ -569,6 +572,16 @@ const GroundReranker: React.FC = forwardRef((props, ref) => {
extra={renderPercent}
onPaste={handleOnPaste}
>
+ {isEmptyText && (
+
+ )}
diff --git a/src/pages/playground/components/ground-tts.tsx b/src/pages/playground/components/ground-tts.tsx
index f434f2f7..e4faa0b0 100644
--- a/src/pages/playground/components/ground-tts.tsx
+++ b/src/pages/playground/components/ground-tts.tsx
@@ -392,6 +392,11 @@ const GroundLeft: React.FC = forwardRef((props, ref) => {
minRows: 5,
maxRows: 5
}}
+ title={
+
+ {intl.formatMessage({ id: 'playground.audio.textinput' })}
+
+ }
onCheck={handleOnCheckChange}
loading={loading}
disabled={!parameters.model}
diff --git a/src/pages/playground/components/message-input.tsx b/src/pages/playground/components/message-input.tsx
index ca53f9d8..09afe96c 100644
--- a/src/pages/playground/components/message-input.tsx
+++ b/src/pages/playground/components/message-input.tsx
@@ -85,6 +85,7 @@ interface MessageInputProps {
submitIcon?: React.ReactNode;
presetPrompt?: (list: CurrentMessage[]) => void;
addMessage?: (message: CurrentMessage) => void;
+ title?: React.ReactNode;
tools?: React.ReactNode;
loading: boolean;
disabled: boolean;
@@ -107,6 +108,7 @@ const MessageInput: React.FC = forwardRef(
updateLayout,
addMessage,
onCheck,
+ title,
loading,
disabled,
isEmpty,