refactor: adjust playground pages dir
This commit is contained in:
+5
-5
@@ -32,7 +32,7 @@ export default [
|
|||||||
icon: 'icon-chat',
|
icon: 'icon-chat',
|
||||||
selectedIcon: 'icon-chat-filled',
|
selectedIcon: 'icon-chat-filled',
|
||||||
defaultIcon: 'icon-chat',
|
defaultIcon: 'icon-chat',
|
||||||
component: './playground/index'
|
component: './playground/chat/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'embedding',
|
name: 'embedding',
|
||||||
@@ -42,7 +42,7 @@ export default [
|
|||||||
icon: 'icon-embedding',
|
icon: 'icon-embedding',
|
||||||
selectedIcon: 'icon-embedding-filled',
|
selectedIcon: 'icon-embedding-filled',
|
||||||
defaultIcon: 'icon-embedding',
|
defaultIcon: 'icon-embedding',
|
||||||
component: './playground/embedding'
|
component: './playground/embedding/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rerank',
|
name: 'rerank',
|
||||||
@@ -52,7 +52,7 @@ export default [
|
|||||||
icon: 'icon-reranker',
|
icon: 'icon-reranker',
|
||||||
selectedIcon: 'icon-reranker-filled',
|
selectedIcon: 'icon-reranker-filled',
|
||||||
defaultIcon: 'icon-reranker',
|
defaultIcon: 'icon-reranker',
|
||||||
component: './playground/rerank'
|
component: './playground/rerank/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'text2images',
|
name: 'text2images',
|
||||||
@@ -62,7 +62,7 @@ export default [
|
|||||||
icon: 'icon-image1',
|
icon: 'icon-image1',
|
||||||
selectedIcon: 'icon-image-filled',
|
selectedIcon: 'icon-image-filled',
|
||||||
defaultIcon: 'icon-image1',
|
defaultIcon: 'icon-image1',
|
||||||
component: './playground/images'
|
component: './playground/images/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'speech',
|
name: 'speech',
|
||||||
@@ -72,7 +72,7 @@ export default [
|
|||||||
icon: 'icon-audio1',
|
icon: 'icon-audio1',
|
||||||
selectedIcon: 'icon-audio-filled',
|
selectedIcon: 'icon-audio-filled',
|
||||||
defaultIcon: 'icon-audio1',
|
defaultIcon: 'icon-audio1',
|
||||||
component: './playground/speech'
|
component: './playground/speech/index'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundLLM from './components/ground-llm';
|
import MultipleChat from '../components/multiple-chat';
|
||||||
import MultipleChat from './components/multiple-chat';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import '../style/play-ground.less';
|
||||||
import './style/play-ground.less';
|
import GroundChat from './page';
|
||||||
|
|
||||||
const Playground: React.FC = () => {
|
const Playground: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
@@ -65,7 +65,7 @@ const Playground: React.FC = () => {
|
|||||||
label: 'Chat',
|
label: 'Chat',
|
||||||
icon: <MessageOutlined />,
|
icon: <MessageOutlined />,
|
||||||
children: (
|
children: (
|
||||||
<GroundLLM ref={groundLeftRef} modelList={modelList}></GroundLLM>
|
<GroundChat ref={groundLeftRef} modelList={modelList}></GroundChat>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -8,8 +8,14 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { CHAT_API } from '../apis';
|
import { CHAT_API } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import MessageInput from '../components/message-input';
|
||||||
|
import MessageContent from '../components/multiple-chat/message-content';
|
||||||
|
import SystemMessage from '../components/multiple-chat/system-message';
|
||||||
|
import ReferenceParams from '../components/reference-params';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { Roles, generateMessagesByListContent } from '../config';
|
import { Roles, generateMessagesByListContent } from '../config';
|
||||||
import { ChatParamsConfig } from '../config/params-config';
|
|
||||||
import { MessageItem, MessageItemAction } from '../config/types';
|
import { MessageItem, MessageItemAction } from '../config/types';
|
||||||
import { LLM_METAKEYS, llmInitialValues } from '../hooks/config';
|
import { LLM_METAKEYS, llmInitialValues } from '../hooks/config';
|
||||||
import useChatCompletion from '../hooks/use-chat-completion';
|
import useChatCompletion from '../hooks/use-chat-completion';
|
||||||
@@ -17,13 +23,7 @@ import { useInitLLmMeta } from '../hooks/use-init-meta';
|
|||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { generateLLMCode } from '../view-code/llm';
|
import { generateLLMCode } from '../view-code/llm';
|
||||||
import DynamicParams from './dynamic-params';
|
import { ChatParamsConfig } from './params-config';
|
||||||
import MessageInput from './message-input';
|
|
||||||
import MessageContent from './multiple-chat/message-content';
|
|
||||||
import SystemMessage from './multiple-chat/system-message';
|
|
||||||
import ReferenceParams from './reference-params';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -57,7 +57,6 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const {
|
const {
|
||||||
handleOnValuesChange,
|
handleOnValuesChange,
|
||||||
formRef,
|
formRef,
|
||||||
paramsRef,
|
|
||||||
paramsConfig,
|
paramsConfig,
|
||||||
initialValues,
|
initialValues,
|
||||||
parameters
|
parameters
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
import { ParamsSchema } from '../config/types';
|
||||||
|
|
||||||
|
export const ChatParamsConfig: ParamsSchema[] = [
|
||||||
|
{
|
||||||
|
type: 'Slider',
|
||||||
|
name: 'temperature',
|
||||||
|
label: {
|
||||||
|
text: 'Temperature',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.temperature.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
max: 2,
|
||||||
|
step: 0.01,
|
||||||
|
labelWidth: 314,
|
||||||
|
inputnumber: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Slider',
|
||||||
|
name: 'max_tokens',
|
||||||
|
label: {
|
||||||
|
text: 'Max Tokens',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.maxtokens.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
max: 1024,
|
||||||
|
step: 1,
|
||||||
|
labelWidth: 314,
|
||||||
|
inputnumber: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Slider',
|
||||||
|
name: 'top_p',
|
||||||
|
label: {
|
||||||
|
text: 'Top P',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.topp.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
labelWidth: 314,
|
||||||
|
inputnumber: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Slider',
|
||||||
|
name: 'frequency_penalty',
|
||||||
|
label: {
|
||||||
|
text: 'Frequency Penalty',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.frequency_penalty.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
max: 2,
|
||||||
|
min: -2,
|
||||||
|
step: 0.01,
|
||||||
|
labelWidth: 314,
|
||||||
|
inputnumber: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Slider',
|
||||||
|
name: 'presence_penalty',
|
||||||
|
label: {
|
||||||
|
text: 'Presence Penalty',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.presence_penalty.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
max: 2,
|
||||||
|
min: -2,
|
||||||
|
step: 0.01,
|
||||||
|
labelWidth: 314,
|
||||||
|
inputnumber: true
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'InputNumber',
|
||||||
|
name: 'seed',
|
||||||
|
label: {
|
||||||
|
text: 'Seed',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.seed.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
attrs: {
|
||||||
|
min: 0
|
||||||
|
},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'Input',
|
||||||
|
name: 'stop',
|
||||||
|
label: {
|
||||||
|
text: 'Stop Sequence',
|
||||||
|
isLocalized: false
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
text: 'playground.params.stop.tips',
|
||||||
|
html: false,
|
||||||
|
isLocalized: true
|
||||||
|
},
|
||||||
|
formItemAttrs: {
|
||||||
|
normalize(value: string) {
|
||||||
|
return value || null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attrs: {},
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
@@ -24,9 +24,9 @@ import React, {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import 'simplebar-react/dist/simplebar.min.css';
|
import 'simplebar-react/dist/simplebar.min.css';
|
||||||
import { CHAT_API } from '../../apis';
|
import { CHAT_API } from '../../apis';
|
||||||
|
import { ChatParamsConfig } from '../../chat/params-config';
|
||||||
import { Roles, generateMessagesByListContent } from '../../config';
|
import { Roles, generateMessagesByListContent } from '../../config';
|
||||||
import CompareContext from '../../config/compare-context';
|
import CompareContext from '../../config/compare-context';
|
||||||
import { ChatParamsConfig } from '../../config/params-config';
|
|
||||||
import { MessageItem, ModelSelectionItem } from '../../config/types';
|
import { MessageItem, ModelSelectionItem } from '../../config/types';
|
||||||
import { LLM_METAKEYS, llmInitialValues } from '../../hooks/config';
|
import { LLM_METAKEYS, llmInitialValues } from '../../hooks/config';
|
||||||
import useChatCompletion from '../../hooks/use-chat-completion';
|
import useChatCompletion from '../../hooks/use-chat-completion';
|
||||||
|
|||||||
@@ -490,173 +490,3 @@ export const CustomSizeConfig: ParamsSchema[] = [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ChatParamsConfig: ParamsSchema[] = [
|
|
||||||
{
|
|
||||||
type: 'Slider',
|
|
||||||
name: 'temperature',
|
|
||||||
label: {
|
|
||||||
text: 'Temperature',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.temperature.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
max: 2,
|
|
||||||
step: 0.01,
|
|
||||||
labelWidth: 314,
|
|
||||||
inputnumber: true
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Slider',
|
|
||||||
name: 'max_tokens',
|
|
||||||
label: {
|
|
||||||
text: 'Max Tokens',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.maxtokens.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
max: 1024,
|
|
||||||
step: 1,
|
|
||||||
labelWidth: 314,
|
|
||||||
inputnumber: true
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Slider',
|
|
||||||
name: 'top_p',
|
|
||||||
label: {
|
|
||||||
text: 'Top P',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.topp.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
max: 1,
|
|
||||||
step: 0.01,
|
|
||||||
labelWidth: 314,
|
|
||||||
inputnumber: true
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Slider',
|
|
||||||
name: 'frequency_penalty',
|
|
||||||
label: {
|
|
||||||
text: 'Frequency Penalty',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.frequency_penalty.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
max: 2,
|
|
||||||
min: -2,
|
|
||||||
step: 0.01,
|
|
||||||
labelWidth: 314,
|
|
||||||
inputnumber: true
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Slider',
|
|
||||||
name: 'presence_penalty',
|
|
||||||
label: {
|
|
||||||
text: 'Presence Penalty',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.presence_penalty.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
max: 2,
|
|
||||||
min: -2,
|
|
||||||
step: 0.01,
|
|
||||||
labelWidth: 314,
|
|
||||||
inputnumber: true
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'InputNumber',
|
|
||||||
name: 'seed',
|
|
||||||
label: {
|
|
||||||
text: 'Seed',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.seed.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
min: 0
|
|
||||||
},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Input',
|
|
||||||
name: 'stop',
|
|
||||||
label: {
|
|
||||||
text: 'Stop Sequence',
|
|
||||||
isLocalized: false
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
text: 'playground.params.stop.tips',
|
|
||||||
html: false,
|
|
||||||
isLocalized: true
|
|
||||||
},
|
|
||||||
formItemAttrs: {
|
|
||||||
normalize(value: string) {
|
|
||||||
return value || null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
attrs: {},
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundEmbedding from './components/ground-embedding';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import useCollapseLayout from '../hooks/use-collapse-layout';
|
||||||
import useCollapseLayout from './hooks/use-collapse-layout';
|
import '../style/play-ground.less';
|
||||||
import './style/play-ground.less';
|
import GroundEmbedding from './page';
|
||||||
|
|
||||||
const PlaygroundEmbedding: React.FC = () => {
|
const PlaygroundEmbedding: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
+6
-7
@@ -26,6 +26,12 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { EMBEDDING_API, handleEmbedding } from '../apis';
|
import { EMBEDDING_API, handleEmbedding } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import FileList from '../components/file-list';
|
||||||
|
import InputList from '../components/input-list';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import TokenUsage from '../components/token-usage';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { extractErrorMessage } from '../config';
|
import { extractErrorMessage } from '../config';
|
||||||
import { embeddingSamples } from '../config/samples';
|
import { embeddingSamples } from '../config/samples';
|
||||||
import { LLM_METAKEYS } from '../hooks/config';
|
import { LLM_METAKEYS } from '../hooks/config';
|
||||||
@@ -34,12 +40,6 @@ import { useInitLLmMeta } from '../hooks/use-init-meta';
|
|||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/rerank.less';
|
import '../style/rerank.less';
|
||||||
import { generateEmbeddingCode } from '../view-code/embedding';
|
import { generateEmbeddingCode } from '../view-code/embedding';
|
||||||
import DynamicParams from './dynamic-params';
|
|
||||||
import FileList from './file-list';
|
|
||||||
import InputList from './input-list';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import TokenUsage from './token-usage';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -109,7 +109,6 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
paramsConfig,
|
paramsConfig,
|
||||||
initialValues,
|
initialValues,
|
||||||
parameters,
|
parameters,
|
||||||
paramsRef,
|
|
||||||
modelMeta,
|
modelMeta,
|
||||||
formFields
|
formFields
|
||||||
} = useInitLLmMeta(
|
} = useInitLLmMeta(
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import useOverlayScroller from '@/hooks/use-overlay-scroller';
|
|
||||||
import {
|
import {
|
||||||
CustomSizeConfig,
|
CustomSizeConfig,
|
||||||
ImageCountConfig,
|
ImageCountConfig,
|
||||||
@@ -59,9 +58,6 @@ export const useInitLLmMeta = (
|
|||||||
});
|
});
|
||||||
const [paramsConfig, setParamsConfig] =
|
const [paramsConfig, setParamsConfig] =
|
||||||
useState<ParamsSchema[]>(defaultParamsConfig);
|
useState<ParamsSchema[]>(defaultParamsConfig);
|
||||||
const paramsRef = useRef<any>(null);
|
|
||||||
|
|
||||||
const { initialize: innitializeParams } = useOverlayScroller();
|
|
||||||
|
|
||||||
const defaultModel = useMemo(() => {
|
const defaultModel = useMemo(() => {
|
||||||
if (isChat) {
|
if (isChat) {
|
||||||
@@ -172,12 +168,6 @@ export const useInitLLmMeta = (
|
|||||||
}
|
}
|
||||||
}, [defaultModel, modelList.length]);
|
}, [defaultModel, modelList.length]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
extractLLMMeta,
|
extractLLMMeta,
|
||||||
handleOnModelChange,
|
handleOnModelChange,
|
||||||
@@ -191,7 +181,6 @@ export const useInitLLmMeta = (
|
|||||||
initialValues,
|
initialValues,
|
||||||
parameters,
|
parameters,
|
||||||
modelMeta,
|
modelMeta,
|
||||||
paramsRef,
|
|
||||||
formFields
|
formFields
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const ODD_STRING = 'AAAABJRU5ErkJgg===';
|
|||||||
|
|
||||||
export default function useTextImage(props: any) {
|
export default function useTextImage(props: any) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { scroller, paramsRef, chunkFields, API } = props;
|
const { scroller, chunkFields, API } = props;
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [tokenResult, setTokenResult] = useState<any>(null);
|
const [tokenResult, setTokenResult] = useState<any>(null);
|
||||||
const [imageList, setImageList] = useState<
|
const [imageList, setImageList] = useState<
|
||||||
@@ -35,7 +35,6 @@ export default function useTextImage(props: any) {
|
|||||||
const messageId = useRef<number>(0);
|
const messageId = useRef<number>(0);
|
||||||
const requestToken = useRef<any>(null);
|
const requestToken = useRef<any>(null);
|
||||||
const { initialize } = useOverlayScroller();
|
const { initialize } = useOverlayScroller();
|
||||||
const { initialize: innitializeParams } = useOverlayScroller();
|
|
||||||
const streamReaderRef = useRef<any>(null);
|
const streamReaderRef = useRef<any>(null);
|
||||||
const requestIdRef = useRef<number>(0);
|
const requestIdRef = useRef<number>(0);
|
||||||
|
|
||||||
@@ -44,11 +43,6 @@ export default function useTextImage(props: any) {
|
|||||||
initialize(scroller.current);
|
initialize(scroller.current);
|
||||||
}
|
}
|
||||||
}, [initialize]);
|
}, [initialize]);
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
const updateRequestId = () => {
|
const updateRequestId = () => {
|
||||||
requestIdRef.current = requestIdRef.current + 1;
|
requestIdRef.current = requestIdRef.current + 1;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { createVideo } from '../apis';
|
|||||||
|
|
||||||
export default function useTextVideo(props: any) {
|
export default function useTextVideo(props: any) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { scroller, paramsRef } = props;
|
const { scroller } = props;
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [tokenResult, setTokenResult] = useState<any>(null);
|
const [tokenResult, setTokenResult] = useState<any>(null);
|
||||||
const [videoList, setVideoList] = useState<
|
const [videoList, setVideoList] = useState<
|
||||||
@@ -25,7 +25,6 @@ export default function useTextVideo(props: any) {
|
|||||||
const messageId = useRef<number>(0);
|
const messageId = useRef<number>(0);
|
||||||
const requestToken = useRef<any>(null);
|
const requestToken = useRef<any>(null);
|
||||||
const { initialize } = useOverlayScroller();
|
const { initialize } = useOverlayScroller();
|
||||||
const { initialize: innitializeParams } = useOverlayScroller();
|
|
||||||
const requestIdRef = useRef<number>(0);
|
const requestIdRef = useRef<number>(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -33,11 +32,6 @@ export default function useTextVideo(props: any) {
|
|||||||
initialize(scroller.current);
|
initialize(scroller.current);
|
||||||
}
|
}
|
||||||
}, [initialize]);
|
}, [initialize]);
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
const updateRequestId = () => {
|
const updateRequestId = () => {
|
||||||
requestIdRef.current = requestIdRef.current + 1;
|
requestIdRef.current = requestIdRef.current + 1;
|
||||||
|
|||||||
+4
-6
@@ -18,15 +18,15 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { CREAT_IMAGE_API } from '../apis';
|
import { CREAT_IMAGE_API } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import MessageInput from '../components/message-input';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { useInitImageMeta } from '../hooks/use-init-meta';
|
import { useInitImageMeta } from '../hooks/use-init-meta';
|
||||||
import useTextImage from '../hooks/use-text-image';
|
import useTextImage from '../hooks/use-text-image';
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { generateImageCode, generateOpenaiImageCode } from '../view-code/image';
|
import { generateImageCode, generateOpenaiImageCode } from '../view-code/image';
|
||||||
import DynamicParams from './dynamic-params';
|
|
||||||
import MessageInput from './message-input';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -41,7 +41,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const [collapse, setCollapse] = useState(false);
|
const [collapse, setCollapse] = useState(false);
|
||||||
const scroller = useRef<any>(null);
|
const scroller = useRef<any>(null);
|
||||||
const paramsRef = useRef<any>(null);
|
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -69,7 +68,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
submitMessage
|
submitMessage
|
||||||
} = useTextImage({
|
} = useTextImage({
|
||||||
scroller,
|
scroller,
|
||||||
paramsRef,
|
|
||||||
chunkFields: ['stream_options', 'chunk_results'],
|
chunkFields: ['stream_options', 'chunk_results'],
|
||||||
API: CREAT_IMAGE_API
|
API: CREAT_IMAGE_API
|
||||||
});
|
});
|
||||||
+4
-6
@@ -21,16 +21,16 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { EDIT_IMAGE_API } from '../apis';
|
import { EDIT_IMAGE_API } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import MessageInput from '../components/message-input';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { EDIT_IMAGE_ACCEPT, scaleImageSize } from '../config';
|
import { EDIT_IMAGE_ACCEPT, scaleImageSize } from '../config';
|
||||||
import { useInitImageMeta } from '../hooks/use-init-meta';
|
import { useInitImageMeta } from '../hooks/use-init-meta';
|
||||||
import useTextImage from '../hooks/use-text-image';
|
import useTextImage from '../hooks/use-text-image';
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { generateImageCode, generateOpenaiImageCode } from '../view-code/image';
|
import { generateImageCode, generateOpenaiImageCode } from '../view-code/image';
|
||||||
import DynamicParams from './dynamic-params';
|
|
||||||
import MessageInput from './message-input';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -45,7 +45,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const [collapse, setCollapse] = useState(false);
|
const [collapse, setCollapse] = useState(false);
|
||||||
const scroller = useRef<any>(null);
|
const scroller = useRef<any>(null);
|
||||||
const paramsRef = useRef<any>(null);
|
|
||||||
const inputRef = useRef<any>(null);
|
const inputRef = useRef<any>(null);
|
||||||
const [image, setImage] = useState<string>('');
|
const [image, setImage] = useState<string>('');
|
||||||
const [mask, setMask] = useState<string | null>(null);
|
const [mask, setMask] = useState<string | null>(null);
|
||||||
@@ -95,7 +94,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
submitMessage
|
submitMessage
|
||||||
} = useTextImage({
|
} = useTextImage({
|
||||||
scroller,
|
scroller,
|
||||||
paramsRef,
|
|
||||||
chunkFields: ['stream_options_chunk_result'],
|
chunkFields: ['stream_options_chunk_result'],
|
||||||
API: EDIT_IMAGE_API
|
API: EDIT_IMAGE_API
|
||||||
});
|
});
|
||||||
@@ -11,12 +11,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundImages from './components/ground-images';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import ImageEdit from './components/image-edit';
|
import '../style/play-ground.less';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import ImageCreate from './create';
|
||||||
import './style/play-ground.less';
|
import ImageEdit from './edit';
|
||||||
|
|
||||||
const TabsValueMap = {
|
const TabsValueMap = {
|
||||||
Tab1: 'generate',
|
Tab1: 'generate',
|
||||||
@@ -68,10 +68,7 @@ const TextToImages: React.FC = () => {
|
|||||||
key: TabsValueMap.Tab1,
|
key: TabsValueMap.Tab1,
|
||||||
label: 'Generate',
|
label: 'Generate',
|
||||||
children: (
|
children: (
|
||||||
<GroundImages
|
<ImageCreate ref={groundTabRef1} modelList={modelList}></ImageCreate>
|
||||||
ref={groundTabRef1}
|
|
||||||
modelList={modelList}
|
|
||||||
></GroundImages>
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -8,12 +8,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundReranker from './components/ground-reranker';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import useCollapseLayout from '../hooks/use-collapse-layout';
|
||||||
import useCollapseLayout from './hooks/use-collapse-layout';
|
import '../style/play-ground.less';
|
||||||
import './style/play-ground.less';
|
import GroundReranker from './page';
|
||||||
|
|
||||||
const PlaygroundRerank: React.FC = () => {
|
const PlaygroundRerank: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
+6
-7
@@ -32,21 +32,21 @@ import React, {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { RERANKER_API, rerankerQuery } from '../apis';
|
import { RERANKER_API, rerankerQuery } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import InputList from '../components/input-list';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import TokenUsage from '../components/token-usage';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { extractErrorMessage } from '../config';
|
import { extractErrorMessage } from '../config';
|
||||||
import { rerankerSamples } from '../config/samples';
|
import { rerankerSamples } from '../config/samples';
|
||||||
import { ParamsSchema } from '../config/types';
|
import { ParamsSchema } from '../config/types';
|
||||||
import { LLM_METAKEYS } from '../hooks/config';
|
import { LLM_METAKEYS } from '../hooks/config';
|
||||||
import { useInitLLmMeta } from '../hooks/use-init-meta';
|
import { useInitLLmMeta } from '../hooks/use-init-meta';
|
||||||
import useRerankerResponse from '../reranker/hooks/use-reranker-response';
|
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/rerank.less';
|
import '../style/rerank.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { generateRerankCode } from '../view-code/rerank';
|
import { generateRerankCode } from '../view-code/rerank';
|
||||||
import DynamicParams from './dynamic-params';
|
import useRerankerResponse from './hooks/use-reranker-response';
|
||||||
import InputList from './input-list';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import TokenUsage from './token-usage';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
@@ -152,7 +152,6 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
paramsConfig,
|
paramsConfig,
|
||||||
initialValues,
|
initialValues,
|
||||||
parameters,
|
parameters,
|
||||||
paramsRef,
|
|
||||||
modelMeta,
|
modelMeta,
|
||||||
formFields
|
formFields
|
||||||
} = useInitLLmMeta(
|
} = useInitLLmMeta(
|
||||||
@@ -12,12 +12,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundSTT from './components/ground-stt';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import GroundTTS from './components/ground-tts';
|
import '../style/play-ground.less';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import GroundSTT from './stt';
|
||||||
import './style/play-ground.less';
|
import GroundTTS from './tts';
|
||||||
|
|
||||||
const TabsValueMap = {
|
const TabsValueMap = {
|
||||||
Tab1: 'tts',
|
Tab1: 'tts',
|
||||||
+4
-12
@@ -24,6 +24,10 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { AUDIO_SPEECH_TO_TEXT_API, speechToText } from '../apis';
|
import { AUDIO_SPEECH_TO_TEXT_API, speechToText } from '../apis';
|
||||||
|
import AudioInput from '../components/audio-input';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import {
|
import {
|
||||||
SpeechToTextFormat,
|
SpeechToTextFormat,
|
||||||
defaultLanguages,
|
defaultLanguages,
|
||||||
@@ -36,10 +40,6 @@ import '../style/ground-llm.less';
|
|||||||
import '../style/speech-to-text.less';
|
import '../style/speech-to-text.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { speechToTextCode } from '../view-code/audio';
|
import { speechToTextCode } from '../view-code/audio';
|
||||||
import AudioInput from './audio-input';
|
|
||||||
import DynamicParams from './dynamic-params';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -68,7 +68,6 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const [tokenResult, setTokenResult] = useState<any>(null);
|
const [tokenResult, setTokenResult] = useState<any>(null);
|
||||||
const [collapse, setCollapse] = useState(false);
|
const [collapse, setCollapse] = useState(false);
|
||||||
const scroller = useRef<any>(null);
|
const scroller = useRef<any>(null);
|
||||||
const paramsRef = useRef<any>(null);
|
|
||||||
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>({
|
||||||
@@ -81,7 +80,6 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
useCancelToken();
|
useCancelToken();
|
||||||
|
|
||||||
const { initialize, updateScrollerPosition } = useOverlayScroller();
|
const { initialize, updateScrollerPosition } = useOverlayScroller();
|
||||||
const { initialize: innitializeParams } = useOverlayScroller();
|
|
||||||
const [modelMeta, setModelMeta] = useState<any>(null);
|
const [modelMeta, setModelMeta] = useState<any>(null);
|
||||||
const [fieldsConfig, setFieldsConfig] =
|
const [fieldsConfig, setFieldsConfig] =
|
||||||
useState<ParamsSchema[]>(paramsConfig);
|
useState<ParamsSchema[]>(paramsConfig);
|
||||||
@@ -328,12 +326,6 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
}, [initialize]);
|
}, [initialize]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
updateScrollerPosition();
|
updateScrollerPosition();
|
||||||
+9
-23
@@ -22,20 +22,20 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { AUDIO_TEXT_TO_SPEECH_API, CHAT_API, textToSpeech } from '../apis';
|
import { AUDIO_TEXT_TO_SPEECH_API, CHAT_API, textToSpeech } from '../apis';
|
||||||
import { RefAudioFormItem } from '../audio/form';
|
import DynamicParams from '../components/dynamic-params';
|
||||||
import {
|
import MessageInput from '../components/message-input';
|
||||||
TTSParamsConfig as paramsConfig,
|
import RightContainer from '../components/right-container';
|
||||||
TTSAdvancedParamsConfig
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
} from '../audio/params-config';
|
|
||||||
import { extractErrorMessage } from '../config';
|
import { extractErrorMessage } from '../config';
|
||||||
import { MessageItem, ParamsSchema } from '../config/types';
|
import { MessageItem, ParamsSchema } from '../config/types';
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { TextToSpeechCode } from '../view-code/audio';
|
import { TextToSpeechCode } from '../view-code/audio';
|
||||||
import DynamicParams from './dynamic-params';
|
import { RefAudioFormItem } from './form';
|
||||||
import MessageInput from './message-input';
|
import {
|
||||||
import RightContainer from './right-container';
|
TTSParamsConfig as paramsConfig,
|
||||||
import ViewCommonCode from './view-common-code';
|
TTSAdvancedParamsConfig
|
||||||
|
} from './params-config';
|
||||||
|
|
||||||
const MetaFields = [
|
const MetaFields = [
|
||||||
'task_type',
|
'task_type',
|
||||||
@@ -83,7 +83,6 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const [collapse, setCollapse] = useState(false);
|
const [collapse, setCollapse] = useState(false);
|
||||||
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 checkvalueRef = useRef<any>(true);
|
const checkvalueRef = useRef<any>(true);
|
||||||
const [currentPrompt, setCurrentPrompt] = useState<string>('');
|
const [currentPrompt, setCurrentPrompt] = useState<string>('');
|
||||||
const [voiceDataList, setVoiceList] = useState<Global.BaseOption<string>[]>(
|
const [voiceDataList, setVoiceList] = useState<Global.BaseOption<string>[]>(
|
||||||
@@ -93,7 +92,6 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
const formRef = useRef<any>(null);
|
const formRef = useRef<any>(null);
|
||||||
|
|
||||||
const { initialize } = useOverlayScroller();
|
const { initialize } = useOverlayScroller();
|
||||||
const { initialize: innitializeParams } = useOverlayScroller();
|
|
||||||
const [activeKey, setActiveKey] = useState<string | string[]>(
|
const [activeKey, setActiveKey] = useState<string | string[]>(
|
||||||
'advanced_config'
|
'advanced_config'
|
||||||
);
|
);
|
||||||
@@ -301,12 +299,6 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
[handleSelectModel]
|
[handleSelectModel]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
const handleOnCheckChange = (e: any) => {
|
const handleOnCheckChange = (e: any) => {
|
||||||
checkvalueRef.current = e.target.checked;
|
checkvalueRef.current = e.target.checked;
|
||||||
};
|
};
|
||||||
@@ -409,12 +401,6 @@ const GroundTTS: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
}, [initialize]);
|
}, [initialize]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (paramsRef.current) {
|
|
||||||
innitializeParams(paramsRef.current);
|
|
||||||
}
|
|
||||||
}, [innitializeParams]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ground-left-wrapper">
|
<div className="ground-left-wrapper">
|
||||||
<div className="ground-left">
|
<div className="ground-left">
|
||||||
@@ -8,12 +8,12 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { PageContainerInner } from '../_components/page-box';
|
import { PageContainerInner } from '../../_components/page-box';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from '../apis';
|
||||||
import GroundVideo from './components/ground-video';
|
import ViewCodeButtons from '../components/view-code-buttons';
|
||||||
import ViewCodeButtons from './components/view-code-buttons';
|
import useCollapseLayout from '../hooks/use-collapse-layout';
|
||||||
import useCollapseLayout from './hooks/use-collapse-layout';
|
import '../style/play-ground.less';
|
||||||
import './style/play-ground.less';
|
import GroundVideo from './page';
|
||||||
|
|
||||||
const PlaygroundRerank: React.FC = () => {
|
const PlaygroundRerank: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
+4
-5
@@ -15,15 +15,15 @@ import React, {
|
|||||||
useState
|
useState
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { CREATE_VIDEO_API } from '../apis';
|
import { CREATE_VIDEO_API } from '../apis';
|
||||||
|
import DynamicParams from '../components/dynamic-params';
|
||||||
|
import MessageInput from '../components/message-input';
|
||||||
|
import RightContainer from '../components/right-container';
|
||||||
|
import ViewCommonCode from '../components/view-common-code';
|
||||||
import { useInitVideoMeta } from '../hooks/use-init-video-meta';
|
import { useInitVideoMeta } from '../hooks/use-init-video-meta';
|
||||||
import useTextVideo from '../hooks/use-text-video';
|
import useTextVideo from '../hooks/use-text-video';
|
||||||
import '../style/ground-llm.less';
|
import '../style/ground-llm.less';
|
||||||
import '../style/system-message-wrap.less';
|
import '../style/system-message-wrap.less';
|
||||||
import { generateCode } from '../view-code/video';
|
import { generateCode } from '../view-code/video';
|
||||||
import DynamicParams from './dynamic-params';
|
|
||||||
import MessageInput from './message-input';
|
|
||||||
import RightContainer from './right-container';
|
|
||||||
import ViewCommonCode from './view-common-code';
|
|
||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
@@ -66,7 +66,6 @@ const GroundVideo: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
submitMessage
|
submitMessage
|
||||||
} = useTextVideo({
|
} = useTextVideo({
|
||||||
scroller,
|
scroller,
|
||||||
paramsRef,
|
|
||||||
API: CREATE_VIDEO_API
|
API: CREATE_VIDEO_API
|
||||||
});
|
});
|
||||||
|
|
||||||
Reference in New Issue
Block a user