feat: playground add submenu

This commit is contained in:
jialin
2024-11-22 10:00:34 +08:00
parent 22f90a505c
commit e05ec3d2d5
22 changed files with 1141 additions and 207 deletions
+10 -5
View File
@@ -29,7 +29,7 @@ const Playground: React.FC = () => {
const [loaded, setLoaded] = useState(false);
const optionsList = [
{
label: intl.formatMessage({ id: 'menu.chat' }),
label: intl.formatMessage({ id: 'menu.playground.chat' }),
value: 'chat',
icon: <MessageOutlined />
},
@@ -46,8 +46,12 @@ const Playground: React.FC = () => {
];
const handleViewCode = useCallback(() => {
groundLeftRef.current?.viewCode?.();
}, [groundLeftRef]);
if (activeKey === 'reranker') {
groundRerankerRef.current?.viewCode?.();
} else if (activeKey === 'chat') {
groundLeftRef.current?.viewCode?.();
}
}, [groundLeftRef, groundRerankerRef, activeKey]);
const handleToggleCollapse = useCallback(() => {
if (activeKey === 'reranker') {
@@ -186,7 +190,7 @@ const Playground: React.FC = () => {
header={{
title: (
<div className="flex items-center">
{intl.formatMessage({ id: 'menu.playground' })}
{intl.formatMessage({ id: 'menu.playground.chat' })}
{
<Segmented
options={optionsList}
@@ -196,7 +200,8 @@ const Playground: React.FC = () => {
></Segmented>
}
</div>
)
),
breadcrumb: {}
}}
extra={renderExtra()}
className={classNames('playground-container', {