fix(style): compare sroll
This commit is contained in:
@@ -70,6 +70,10 @@
|
|||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-l-8 {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.flex {
|
.flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({
|
|||||||
htmlstr = (
|
htmlstr = (
|
||||||
<Image
|
<Image
|
||||||
src={token.href}
|
src={token.href}
|
||||||
|
alt={token.text}
|
||||||
preview={{
|
preview={{
|
||||||
mask: <EyeOutlined />
|
mask: <EyeOutlined />
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding-block: 20px 0;
|
padding-block: 20px 0;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
&.no-wrapper-style {
|
&.no-wrapper-style {
|
||||||
padding-block: 0;
|
padding-block: 0;
|
||||||
|
|||||||
@@ -518,6 +518,14 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-dropdown-menu
|
||||||
|
.ant-dropdown-menu-item.ant-dropdown-menu-item-danger:not(
|
||||||
|
.ant-dropdown-menu-item-disabled
|
||||||
|
):hover {
|
||||||
|
background-color: var(--ant-color-error-bg) !important;
|
||||||
|
color: var(--ant-color-error) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.ant-message-notice-wrapper {
|
.ant-message-notice-wrapper {
|
||||||
.ant-message-notice-error {
|
.ant-message-notice-error {
|
||||||
.ant-message-notice-content {
|
.ant-message-notice-content {
|
||||||
|
|||||||
@@ -219,10 +219,10 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
filterOption
|
filterOption
|
||||||
defaultActiveFirstOption
|
defaultActiveFirstOption
|
||||||
disabled={action === PageAction.EDIT}
|
disabled={action === PageAction.EDIT}
|
||||||
|
options={ollamaModelOptions}
|
||||||
label={intl.formatMessage({ id: 'model.form.ollama.model' })}
|
label={intl.formatMessage({ id: 'model.form.ollama.model' })}
|
||||||
placeholder={intl.formatMessage({ id: 'model.form.ollamaholder' })}
|
placeholder={intl.formatMessage({ id: 'model.form.ollamaholder' })}
|
||||||
required
|
required
|
||||||
options={ollamaModelOptions}
|
|
||||||
></SealAutoComplete>
|
></SealAutoComplete>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
width={width}
|
width={width}
|
||||||
footer={false}
|
footer={false}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex', height: '100%' }}>
|
||||||
{SEARCH_SOURCE.includes(props.source) && (
|
{SEARCH_SOURCE.includes(props.source) && (
|
||||||
<>
|
<>
|
||||||
<div style={{ display: 'flex', flex: 1 }}>
|
<div style={{ display: 'flex', flex: 1 }}>
|
||||||
|
|||||||
@@ -6,30 +6,40 @@ import '../style/gpu-card.less';
|
|||||||
|
|
||||||
const GPUCard: React.FC<{
|
const GPUCard: React.FC<{
|
||||||
data: any;
|
data: any;
|
||||||
}> = ({ data }) => {
|
header?: React.ReactNode;
|
||||||
|
info?: React.ReactNode;
|
||||||
|
}> = ({ data, header, info }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
return (
|
return (
|
||||||
<div className="gpu-card">
|
<div className="gpu-card">
|
||||||
<div className="header">
|
<div className="header">
|
||||||
{data.label}({data.worker_name})[
|
{header ?? (
|
||||||
{intl.formatMessage({ id: 'resources.table.index' })}:{data.index}]
|
<>
|
||||||
|
{data.label}({data.worker_name})[
|
||||||
|
{intl.formatMessage({ id: 'resources.table.index' })}:{data.index}]
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="info">
|
<div className="info">
|
||||||
<span>
|
{info ?? (
|
||||||
{intl.formatMessage({ id: 'resources.table.vram' })}(
|
<>
|
||||||
{intl.formatMessage({ id: 'resources.table.used' })}/
|
<span>
|
||||||
{intl.formatMessage({ id: 'resources.table.total' })}):{' '}
|
{intl.formatMessage({ id: 'resources.table.vram' })}(
|
||||||
<span>
|
{intl.formatMessage({ id: 'resources.table.used' })}/
|
||||||
{convertFileSize(data?.memory?.used || 0)} /{' '}
|
{intl.formatMessage({ id: 'resources.table.total' })}):{' '}
|
||||||
{convertFileSize(data?.memory?.total || 0)}
|
<span>
|
||||||
</span>
|
{convertFileSize(data?.memory?.used || 0)} /{' '}
|
||||||
</span>
|
{convertFileSize(data?.memory?.total || 0)}
|
||||||
<span>
|
</span>
|
||||||
<span>
|
</span>
|
||||||
{intl.formatMessage({ id: 'resources.table.gpuutilization' })}:{' '}
|
<span>
|
||||||
</span>
|
<span>
|
||||||
{_.round(data?.memory?.utilization_rate || 0, 2)}%
|
{intl.formatMessage({ id: 'resources.table.gpuutilization' })}:{' '}
|
||||||
</span>
|
</span>
|
||||||
|
{_.round(data?.memory?.utilization_rate || 0, 2)}%
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ const ModelCard: React.FC<{
|
|||||||
const getModelCardData = async () => {
|
const getModelCardData = async () => {
|
||||||
if (!props.selectedModel.name) {
|
if (!props.selectedModel.name) {
|
||||||
setModelData(null);
|
setModelData(null);
|
||||||
|
setReadmeText(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
requestToken.current?.cancel?.();
|
requestToken.current?.cancel?.();
|
||||||
@@ -191,7 +192,7 @@ const ModelCard: React.FC<{
|
|||||||
<div className="card-wrapper">
|
<div className="card-wrapper">
|
||||||
{modelData ? (
|
{modelData ? (
|
||||||
<div className="model-card-wrap">
|
<div className="model-card-wrap">
|
||||||
<div className="flex-between flex-center">
|
<div className="flex-center">
|
||||||
{modelData.config?.model_type && (
|
{modelData.config?.model_type && (
|
||||||
<Tag className="tag-item" color="gold">
|
<Tag className="tag-item" color="gold">
|
||||||
<span style={{ opacity: 0.65 }}>
|
<span style={{ opacity: 0.65 }}>
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ export const ollamaModelOptions = [
|
|||||||
tags: ['7B'],
|
tags: ['7B'],
|
||||||
id: 'mistral'
|
id: 'mistral'
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// label: 'llava',
|
label: 'llava',
|
||||||
// value: 'llava',
|
value: 'llava',
|
||||||
// name: 'llava',
|
name: 'llava',
|
||||||
// tags: ['7B', '13B', '34B'],
|
tags: ['7B', '13B', '34B'],
|
||||||
// id: 'llava'
|
id: 'llava'
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
label: 'qwen2',
|
label: 'qwen2',
|
||||||
value: 'qwen2',
|
value: 'qwen2',
|
||||||
|
|||||||
@@ -5,14 +5,15 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
border-radius: 0 2px 0 0;
|
border-radius: 0 2px 0 0;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: -10px;
|
left: -13px;
|
||||||
width: 22px;
|
width: 24px;
|
||||||
height: 22px;
|
height: 24px;
|
||||||
border: 2px solid var(--ant-color-split);
|
border: 2px solid var(--ant-color-split);
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
background-color: var(--color-white-1);
|
background-color: var(--color-white-1);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
clip-path: polygon(0 -1px, 24px 0, 24px 23px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,13 +93,11 @@ const GroundLeft: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const joinMessage = (chunk: any) => {
|
const joinMessage = (chunk: any) => {
|
||||||
if (!chunk) {
|
setTokenResult({
|
||||||
return;
|
...(chunk?.usage ?? {})
|
||||||
}
|
});
|
||||||
if (!_.get(chunk, 'choices', []).length) {
|
|
||||||
setTokenResult({
|
if (!chunk || !_.get(chunk, 'choices', []).length) {
|
||||||
...chunk?.usage
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
contentRef.current =
|
contentRef.current =
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
HotKeys.SUBMIT,
|
HotKeys.SUBMIT,
|
||||||
() => {
|
(e: any) => {
|
||||||
console.log('submit message', loading);
|
console.log('submit message', loading);
|
||||||
inputRef.current?.blur?.();
|
e.preventDefault();
|
||||||
handleSendMessage();
|
handleSendMessage();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -307,8 +307,6 @@ const MessageInput: React.FC<MessageInputProps> = ({
|
|||||||
(e: any) => {
|
(e: any) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
console.log('add message', loading);
|
|
||||||
inputRef.current?.blur?.();
|
|
||||||
handleAddMessage();
|
handleAddMessage();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -252,24 +252,26 @@ 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">
|
<div className="chat-list">
|
||||||
<CompareContext.Provider
|
<div className="chat-list-inner">
|
||||||
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>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<MessageInput
|
<MessageInput
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import IconFont from '@/components/icon-font';
|
|||||||
import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data';
|
import { fetchChunkedData, readStreamData } from '@/utils/fetch-chunk-data';
|
||||||
import {
|
import {
|
||||||
ClearOutlined,
|
ClearOutlined,
|
||||||
CloseOutlined,
|
DeleteOutlined,
|
||||||
MoreOutlined,
|
MoreOutlined,
|
||||||
SettingOutlined
|
SettingOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
@@ -11,7 +11,6 @@ import { Button, Checkbox, Dropdown, Popover, Select, Spin } from 'antd';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, {
|
import React, {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
useCallback,
|
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
@@ -81,18 +80,17 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const joinMessage = (chunk: any) => {
|
const joinMessage = (chunk: any) => {
|
||||||
if (!chunk) {
|
setTokenResult({
|
||||||
return;
|
...(chunk?.usage ?? {})
|
||||||
}
|
});
|
||||||
if (!_.get(chunk, 'choices', [].length)) {
|
|
||||||
setTokenResult({
|
if (!chunk || !_.get(chunk, 'choices', [].length)) {
|
||||||
...chunk?.usage
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentRef.current =
|
contentRef.current =
|
||||||
contentRef.current + _.get(chunk, 'choices.0.delta.content', '');
|
contentRef.current + _.get(chunk, 'choices.0.delta.content', '');
|
||||||
console.log('currentMessage==========5', messageList);
|
|
||||||
setMessageList([
|
setMessageList([
|
||||||
...messageList,
|
...messageList,
|
||||||
...currentMessageRef.current,
|
...currentMessageRef.current,
|
||||||
@@ -202,15 +200,10 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
setLoadingStatus(instanceId, false);
|
setLoadingStatus(instanceId, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleDropdownAction = useCallback(({ key }: { key: string }) => {
|
|
||||||
if (key === 'clear') {
|
const handleDelete = () => {
|
||||||
setMessageList([]);
|
handleDeleteModel(instanceId);
|
||||||
setSystemMessage('');
|
};
|
||||||
}
|
|
||||||
if (key === 'viewCode') {
|
|
||||||
setShow(true);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleSubmit = (currentMessage: Omit<MessageItem, 'uid'>) => {
|
const handleSubmit = (currentMessage: Omit<MessageItem, 'uid'>) => {
|
||||||
const currentMsg =
|
const currentMsg =
|
||||||
@@ -234,7 +227,6 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
changeValues: any,
|
changeValues: any,
|
||||||
allValues: Record<string, any>
|
allValues: Record<string, any>
|
||||||
) => {
|
) => {
|
||||||
console.log('value:', allValues, isApplyToAllModels.current);
|
|
||||||
if (isApplyToAllModels.current) {
|
if (isApplyToAllModels.current) {
|
||||||
setParams({
|
setParams({
|
||||||
...params,
|
...params,
|
||||||
@@ -256,7 +248,6 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
setTokenResult(null);
|
setTokenResult(null);
|
||||||
setSystemMessage('');
|
setSystemMessage('');
|
||||||
currentMessageRef.current = [];
|
currentMessageRef.current = [];
|
||||||
console.log('clear message', systemMessage);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCloseViewCode = () => {
|
const handleCloseViewCode = () => {
|
||||||
@@ -285,16 +276,48 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
setMessageList(messages);
|
setMessageList(messages);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = () => {
|
|
||||||
handleDeleteModel(instanceId);
|
|
||||||
};
|
|
||||||
|
|
||||||
const modelOptions = useMemo(() => {
|
const modelOptions = useMemo(() => {
|
||||||
return modelFullList.filter((item) => {
|
return modelFullList.filter((item) => {
|
||||||
return item.type !== 'empty';
|
return item.type !== 'empty';
|
||||||
});
|
});
|
||||||
}, [modelFullList]);
|
}, [modelFullList]);
|
||||||
|
|
||||||
|
const actionItems = useMemo(() => {
|
||||||
|
const list = [
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({ id: 'common.button.clear' }),
|
||||||
|
key: 'clear',
|
||||||
|
icon: <ClearOutlined />,
|
||||||
|
danger: false,
|
||||||
|
onClick: () => {
|
||||||
|
setMessageList([]);
|
||||||
|
setSystemMessage('');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({ id: 'playground.viewcode' }),
|
||||||
|
key: 'viewcode',
|
||||||
|
icon: <IconFont type="icon-code" />,
|
||||||
|
onClick: () => {
|
||||||
|
setShow(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (modelList.length > 2) {
|
||||||
|
list.push({
|
||||||
|
label: intl.formatMessage({ id: 'common.button.delete' }),
|
||||||
|
key: 'delete',
|
||||||
|
icon: <DeleteOutlined />,
|
||||||
|
danger: true,
|
||||||
|
onClick: () => {
|
||||||
|
handleDelete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}, [modelList]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('globalParams:', globalParams.model, globalParams);
|
console.log('globalParams:', globalParams.model, globalParams);
|
||||||
setParams({
|
setParams({
|
||||||
@@ -327,7 +350,7 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
<div className="header">
|
<div className="header">
|
||||||
<span className="title">
|
<span className="title">
|
||||||
<Select
|
<Select
|
||||||
style={{ minWidth: '120px' }}
|
style={{ minWidth: '120px', maxWidth: '200px' }}
|
||||||
variant="borderless"
|
variant="borderless"
|
||||||
options={modelFullList}
|
options={modelFullList}
|
||||||
onChange={handleModelChange}
|
onChange={handleModelChange}
|
||||||
@@ -338,24 +361,7 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
<span className="action">
|
<span className="action">
|
||||||
<Dropdown
|
<Dropdown
|
||||||
menu={{
|
menu={{
|
||||||
items: [
|
items: actionItems
|
||||||
{
|
|
||||||
label: intl.formatMessage({ id: 'common.button.clear' }),
|
|
||||||
key: 'clear',
|
|
||||||
icon: <ClearOutlined />,
|
|
||||||
onClick: () => {
|
|
||||||
handleDropdownAction({ key: 'clear' });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: intl.formatMessage({ id: 'playground.viewcode' }),
|
|
||||||
key: 'viewcode',
|
|
||||||
icon: <IconFont type="icon-code" />,
|
|
||||||
onClick: () => {
|
|
||||||
handleDropdownAction({ key: 'viewCode' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}}
|
}}
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
>
|
>
|
||||||
@@ -396,14 +402,6 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
|
|||||||
size="small"
|
size="small"
|
||||||
></Button>
|
></Button>
|
||||||
</Popover>
|
</Popover>
|
||||||
{modelList.length > 2 && (
|
|
||||||
<Button
|
|
||||||
type="text"
|
|
||||||
icon={<CloseOutlined />}
|
|
||||||
size="small"
|
|
||||||
onClick={handleDelete}
|
|
||||||
></Button>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<SystemMessage
|
<SystemMessage
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
border-bottom: 1px solid var(--ant-color-border);
|
border-bottom: 1px solid var(--ant-color-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
|||||||
@@ -5,7 +5,14 @@
|
|||||||
|
|
||||||
.chat-list {
|
.chat-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
padding-inline: var(--layout-content-inlinepadding);
|
padding-inline: var(--layout-content-inlinepadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-list-inner {
|
||||||
|
min-height: calc(100vh - 199px);
|
||||||
|
max-height: max-content;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user