fix: models compare system message sync to all

This commit is contained in:
jialin
2024-09-30 11:45:42 +08:00
parent 3978ec683d
commit 5f77a0082c
18 changed files with 51 additions and 25 deletions
@@ -238,6 +238,15 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
</Form.Item>
<Form.Item<FormData> name="backend_parameters">
<ListInput
placeholder={
backend === backendOptionsMap.llamaBox
? intl.formatMessage({
id: 'models.form.backend_parameters.llamabox.placeholder'
})
: intl.formatMessage({
id: 'models.form.backend_parameters.vllm.placeholder'
})
}
btnText="common.button.addParams"
label={intl.formatMessage({ id: 'models.form.backend_parameters' })}
dataList={form.getFieldValue('backend_parameters') || []}
+1 -1
View File
@@ -6,7 +6,7 @@ const options = [
{
label: '--ctx-size',
value: '--ctx-size',
options: ['8192']
options: []
},
{
label: '--flash-attn',
+1 -1
View File
@@ -183,7 +183,7 @@ const options = [
{
label: '--max-model-len',
value: '--max-model-len',
options: ['8192']
options: []
},
{
label: '--guided-decoding-backend',
@@ -2,7 +2,7 @@ import { CloseOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button, Checkbox, Divider, Input, Tooltip } from 'antd';
import classNames from 'classnames';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import '../../style/sys-message.less';
interface SystemMessageProps {
@@ -17,7 +17,7 @@ const SystemMessage: React.FC<SystemMessageProps> = (props) => {
const { systemMessage, showApplyToAll, setSystemMessage, style, applyToAll } =
props;
const intl = useIntl();
const [isChange, setIsChange] = useState(false);
const [applyToAllModels, setApplyToAllModels] = useState(false);
const systemMessageRef = React.useRef<any>(null);
const [autoSize, setAutoSize] = useState<{
minRows: number;
@@ -44,12 +44,10 @@ const SystemMessage: React.FC<SystemMessageProps> = (props) => {
maxRows: 1,
focus: false
});
setIsChange(false);
};
const handleOnChange = (e: any) => {
setSystemMessage(e.target.value);
setIsChange(true);
};
const handleClearSystemMessage = () => {
@@ -58,13 +56,14 @@ const SystemMessage: React.FC<SystemMessageProps> = (props) => {
const handleClickCheckbox = (e?: any) => {
e.preventDefault();
setApplyToAllModels(!applyToAllModels);
};
const handleApplyToAllModels = (e: any) => {
if (e.target.checked) {
useEffect(() => {
if (applyToAllModels) {
applyToAll?.(systemMessage);
}
};
}, [applyToAllModels]);
return (
<div
@@ -100,13 +99,14 @@ const SystemMessage: React.FC<SystemMessageProps> = (props) => {
allowClear={false}
onChange={handleOnChange}
></Input.TextArea>
{isChange && showApplyToAll && (
{showApplyToAll && (
<span className="apply-check" onMouseDown={handleClickCheckbox}>
<Checkbox onChange={handleApplyToAllModels}>
<span className="m-r-5">
{intl.formatMessage({
id: 'playground.compare.applytoall'
})}
</Checkbox>
</span>
<Checkbox checked={applyToAllModels}></Checkbox>
</span>
)}
<Divider style={{ margin: '0' }}></Divider>
+4 -1
View File
@@ -8,10 +8,13 @@
.apply-check {
position: absolute;
bottom: 10px;
display: flex;
right: 10px;
direction: rtl;
background-color: var(--color-white-1);
box-shadow: var(--ant-box-shadow-tertiary);
align-items: center;
padding: 1px 4px;
cursor: pointer;
}
.sys-content-wrap {