style: no available models tips
This commit is contained in:
@@ -44,7 +44,7 @@ export default {
|
|||||||
'playground.input.holder': 'Type <kbd>/</kbd> to input message',
|
'playground.input.holder': 'Type <kbd>/</kbd> to input message',
|
||||||
'playground.compare.apply': 'Apply',
|
'playground.compare.apply': 'Apply',
|
||||||
'playground.compare.applytoall': 'Apply to all models',
|
'playground.compare.applytoall': 'Apply to all models',
|
||||||
'playground.model.noavailable': 'No available models.',
|
'playground.model.noavailable': 'No available models',
|
||||||
'playground.model.noavailable.tips':
|
'playground.model.noavailable.tips':
|
||||||
'Please deploy a model first, and it should not be an embedding-only model.'
|
'Please deploy a model first, and it should not be an embedding-only model.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useIntl, useNavigate } from '@umijs/max';
|
import { useIntl, useNavigate } from '@umijs/max';
|
||||||
import { Button, Empty, Typography } from 'antd';
|
import { Empty, Typography } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const EmptyModels: React.FC<{
|
const EmptyModels: React.FC<{
|
||||||
@@ -13,7 +13,7 @@ const EmptyModels: React.FC<{
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="flex-center justify-center"
|
className="flex-center justify-center"
|
||||||
style={{
|
style={{
|
||||||
...style
|
...style
|
||||||
}}
|
}}
|
||||||
@@ -25,16 +25,9 @@ const EmptyModels: React.FC<{
|
|||||||
<Typography.Text type="secondary">
|
<Typography.Text type="secondary">
|
||||||
{intl.formatMessage({ id: 'playground.model.noavailable' })}
|
{intl.formatMessage({ id: 'playground.model.noavailable' })}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Typography.Text type="secondary">
|
|
||||||
{intl.formatMessage({ id: 'playground.model.noavailable.tips' })}
|
|
||||||
</Typography.Text>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
></Empty>
|
||||||
<Button type="primary" onClick={handleDeployModel}>
|
|
||||||
{intl.formatMessage({ id: 'models.button.deploy' })}
|
|
||||||
</Button>
|
|
||||||
</Empty>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import ViewCodeModal from './view-code-modal';
|
|||||||
|
|
||||||
interface MessageProps {
|
interface MessageProps {
|
||||||
modelList: Global.BaseOption<string>[];
|
modelList: Global.BaseOption<string>[];
|
||||||
|
loaded?: boolean;
|
||||||
ref?: any;
|
ref?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,38 +254,40 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
<div className="ground-left-wrapper">
|
<div className="ground-left-wrapper">
|
||||||
<div className="ground-left">
|
<div className="ground-left">
|
||||||
<div className="message-list-wrap" ref={scroller}>
|
<div className="message-list-wrap" ref={scroller}>
|
||||||
<div
|
<>
|
||||||
style={{
|
<div
|
||||||
marginBottom: 20
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SystemMessage
|
|
||||||
style={{
|
style={{
|
||||||
borderRadius: 'var(--border-radius-mini)',
|
marginBottom: 20
|
||||||
overflow: 'hidden'
|
|
||||||
}}
|
}}
|
||||||
systemMessage={systemMessage}
|
>
|
||||||
setSystemMessage={setSystemMessage}
|
<SystemMessage
|
||||||
></SystemMessage>
|
style={{
|
||||||
</div>
|
borderRadius: 'var(--border-radius-mini)',
|
||||||
|
overflow: 'hidden'
|
||||||
|
}}
|
||||||
|
systemMessage={systemMessage}
|
||||||
|
setSystemMessage={setSystemMessage}
|
||||||
|
></SystemMessage>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<MessageContent
|
<MessageContent
|
||||||
spans={{
|
spans={{
|
||||||
span: 24,
|
span: 24,
|
||||||
count: 1
|
count: 1
|
||||||
}}
|
}}
|
||||||
messageList={messageList}
|
messageList={messageList}
|
||||||
setMessageList={setMessageList}
|
setMessageList={setMessageList}
|
||||||
editable={true}
|
editable={true}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
{loading && (
|
{loading && (
|
||||||
<Spin size="small">
|
<Spin size="small">
|
||||||
<div style={{ height: '46px' }}></div>
|
<div style={{ height: '46px' }}></div>
|
||||||
</Spin>
|
</Spin>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
</div>
|
</div>
|
||||||
{tokenResult && (
|
{tokenResult && (
|
||||||
<div style={{ height: 40 }}>
|
<div style={{ height: 40 }}>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|||||||
return disabled
|
return disabled
|
||||||
? true
|
? true
|
||||||
: !message.content && isEmpty && !message.imgs?.length;
|
: !message.content && isEmpty && !message.imgs?.length;
|
||||||
}, [disabled, message.content, isEmpty]);
|
}, [disabled, message, isEmpty]);
|
||||||
|
|
||||||
const resetMessage = () => {
|
const resetMessage = () => {
|
||||||
setMessage({
|
setMessage({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import CompareContext from '../../config/compare-context';
|
import CompareContext from '../../config/compare-context';
|
||||||
import { MessageItem, ModelSelectionItem } from '../../config/types';
|
import { MessageItem, ModelSelectionItem } from '../../config/types';
|
||||||
import '../../style/multiple-chat.less';
|
import '../../style/multiple-chat.less';
|
||||||
|
import EmptyModels from '../empty-models';
|
||||||
import MessageInput from '../message-input';
|
import MessageInput from '../message-input';
|
||||||
import ActiveModels from './active-models';
|
import ActiveModels from './active-models';
|
||||||
|
|
||||||
@@ -12,10 +13,10 @@ type CurrentMessage = Omit<MessageItem, 'uid'>;
|
|||||||
|
|
||||||
interface MultiCompareProps {
|
interface MultiCompareProps {
|
||||||
modelList: (Global.BaseOption<string> & { type?: string })[];
|
modelList: (Global.BaseOption<string> & { type?: string })[];
|
||||||
spans?: number;
|
loaded?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MultiCompare: React.FC<MultiCompareProps> = ({ modelList }) => {
|
const MultiCompare: React.FC<MultiCompareProps> = ({ modelList, loaded }) => {
|
||||||
const { initialize } = useOverlayScroller();
|
const { initialize } = useOverlayScroller();
|
||||||
const [loadingStatus, setLoadingStatus] = useState<Record<symbol, boolean>>(
|
const [loadingStatus, setLoadingStatus] = useState<Record<symbol, boolean>>(
|
||||||
{}
|
{}
|
||||||
@@ -262,30 +263,41 @@ const MultiCompare: React.FC<MultiCompareProps> = ({ modelList }) => {
|
|||||||
return (
|
return (
|
||||||
<div className="multiple-chat" style={{ height: boxHeight }}>
|
<div className="multiple-chat" style={{ height: boxHeight }}>
|
||||||
<div className="chat-list" ref={chatListScrollRef}>
|
<div className="chat-list" ref={chatListScrollRef}>
|
||||||
<CompareContext.Provider
|
{modelList.length > 0 ? (
|
||||||
value={{
|
<CompareContext.Provider
|
||||||
spans,
|
value={{
|
||||||
globalParams,
|
spans,
|
||||||
loadingStatus,
|
globalParams,
|
||||||
modelFullList: modelList,
|
loadingStatus,
|
||||||
handleApplySystemChangeToAll,
|
modelFullList: modelList,
|
||||||
setGlobalParams,
|
handleApplySystemChangeToAll,
|
||||||
setLoadingStatus: handleSetLoadingStatus,
|
setGlobalParams,
|
||||||
handleDeleteModel: handleDeleteModel
|
setLoadingStatus: handleSetLoadingStatus,
|
||||||
}}
|
handleDeleteModel: handleDeleteModel
|
||||||
>
|
}}
|
||||||
<ActiveModels
|
>
|
||||||
spans={spans}
|
<ActiveModels
|
||||||
modelSelections={modelSelections}
|
spans={spans}
|
||||||
setModelRefs={setModelRefs}
|
modelSelections={modelSelections}
|
||||||
></ActiveModels>
|
setModelRefs={setModelRefs}
|
||||||
</CompareContext.Provider>
|
></ActiveModels>
|
||||||
|
</CompareContext.Provider>
|
||||||
|
) : (
|
||||||
|
loaded && (
|
||||||
|
<EmptyModels
|
||||||
|
style={{
|
||||||
|
height: '100%',
|
||||||
|
paddingBottom: 60
|
||||||
|
}}
|
||||||
|
></EmptyModels>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<MessageInput
|
<MessageInput
|
||||||
scope="compare"
|
scope="compare"
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
disabled={isLoading || modelSelections.length === 0}
|
disabled={isLoading || !modelSelections.length || !modelList.length}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
addMessage={handleAddMessage}
|
addMessage={handleAddMessage}
|
||||||
handleAbortFetch={handleAbortFetch}
|
handleAbortFetch={handleAbortFetch}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import _ from 'lodash';
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { queryModelsList } from './apis';
|
import { queryModelsList } from './apis';
|
||||||
import EmptyModels from './components/empty-models';
|
|
||||||
import GroundLeft from './components/ground-left';
|
import GroundLeft from './components/ground-left';
|
||||||
import MultipleChat from './components/multiple-chat';
|
import MultipleChat from './components/multiple-chat';
|
||||||
import './style/play-ground.less';
|
import './style/play-ground.less';
|
||||||
@@ -52,7 +51,7 @@ const Playground: React.FC = () => {
|
|||||||
{
|
{
|
||||||
key: 'compare',
|
key: 'compare',
|
||||||
label: 'Compare',
|
label: 'Compare',
|
||||||
children: <MultipleChat modelList={modelList} />
|
children: <MultipleChat modelList={modelList} loaded={loaded} />
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ const Playground: React.FC = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const renderExtra = () => {
|
const renderExtra = () => {
|
||||||
if (activeKey === 'compare' || modelList.length === 0) {
|
if (activeKey === 'compare') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -123,14 +122,14 @@ const Playground: React.FC = () => {
|
|||||||
title: (
|
title: (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
{intl.formatMessage({ id: 'menu.playground' })}
|
{intl.formatMessage({ id: 'menu.playground' })}
|
||||||
{modelList.length > 0 && (
|
{
|
||||||
<Segmented
|
<Segmented
|
||||||
options={optionsList}
|
options={optionsList}
|
||||||
size="middle"
|
size="middle"
|
||||||
className="m-l-40"
|
className="m-l-40"
|
||||||
onChange={(key) => setActiveKey(key)}
|
onChange={(key) => setActiveKey(key)}
|
||||||
></Segmented>
|
></Segmented>
|
||||||
)}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@@ -142,15 +141,7 @@ const Playground: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<div className="play-ground">
|
<div className="play-ground">
|
||||||
<div className="chat">
|
<div className="chat">
|
||||||
{modelList.length > 0 ? (
|
<Tabs items={items} activeKey={activeKey}></Tabs>
|
||||||
<Tabs items={items} activeKey={activeKey}></Tabs>
|
|
||||||
) : (
|
|
||||||
loaded && (
|
|
||||||
<EmptyModels
|
|
||||||
style={{ height: 'calc(100vh - 72px)', paddingBottom: 100 }}
|
|
||||||
></EmptyModels>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user