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