chore: image edit invert painting area

This commit is contained in:
jialin
2025-03-04 17:52:14 +08:00
parent bb47b4475e
commit 8a98aef28c
15 changed files with 171 additions and 45 deletions
+4 -6
View File
@@ -3,6 +3,8 @@ import { initialPasswordAtom, userAtom } from '@/atoms/user';
import LangSelect from '@/components/lang-select';
import SealInput from '@/components/seal-form/seal-input';
import {
CRYPT_TEXT,
REMEMBER_ME_KEY,
getRememberMe,
rememberMe,
removeRememberMe
@@ -12,14 +14,11 @@ import { useIntl, useModel } from '@umijs/max';
import { Button, Checkbox, Form } from 'antd';
import CryptoJS from 'crypto-js';
import { useAtom } from 'jotai';
import { memo, useEffect, useMemo } from 'react';
import { useEffect, useMemo } from 'react';
import { flushSync } from 'react-dom';
import { login } from '../apis';
import { checkDefaultPage } from '../utils';
const REMEMBER_ME_KEY = 'r_m';
const CRYPT_TEXT = 'seal';
const LoginForm = () => {
const [userInfo, setUserInfo] = useAtom(userAtom);
const [initialPassword, setInitialPassword] = useAtom(initialPasswordAtom);
@@ -27,7 +26,6 @@ const LoginForm = () => {
const intl = useIntl();
const [form] = Form.useForm();
console.log('initialState+++++++=login', userInfo, initialState);
const renderWelCome = useMemo(() => {
return (
<div
@@ -206,4 +204,4 @@ const LoginForm = () => {
);
};
export default memo(LoginForm);
export default LoginForm;
+1 -3
View File
@@ -1,6 +1,7 @@
import { initialPasswordAtom, userAtom } from '@/atoms/user';
import SealInput from '@/components/seal-form/seal-input';
import { PasswordReg } from '@/config';
import { CRYPT_TEXT } from '@/utils/localstore/index';
import { GlobalOutlined, LockOutlined } from '@ant-design/icons';
import { SelectLang, useIntl } from '@umijs/max';
import { Button, Form, message } from 'antd';
@@ -9,8 +10,6 @@ import { useAtom } from 'jotai';
import { updatePassword } from '../apis';
import { checkDefaultPage } from '../utils';
const CRYPT_TEXT = 'seal';
const PasswordForm: React.FC = () => {
const intl = useIntl();
const [form] = Form.useForm();
@@ -28,7 +27,6 @@ const PasswordForm: React.FC = () => {
};
const handleSubmit = async (values: any) => {
console.log('values', values, form);
try {
await updatePassword({
new_password: values.new_password,
@@ -132,6 +132,7 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
onValuesChange={handleValuesChange}
onFinish={handleOnFinish}
onFinishFailed={handleOnFinishFailed}
initialValues={initialValues}
>
<div>
{
+23 -5
View File
@@ -157,11 +157,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
}, [finalParameters, currentPrompt, parameters.size]);
const handleClear = () => {
// setImageList([]);
// setTokenResult(null);
// setMask('');
// setImage('');
// setUploadList([]);
setCurrentPrompt('');
};
@@ -393,11 +388,33 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
editable={false}
autoBgColor={false}
onClick={() => handleOnImgClick(uploadList[0], true)}
label={<span>Origin</span>}
></SingleImage>
</>
);
}, [uploadList, handleOnImgClick]);
const renderMaskImage = useMemo(() => {
if (!maskUpload.length) {
return null;
}
return (
<>
<SingleImage
{...maskUpload[0]}
height={125}
maxHeight={125}
preview={false}
loading={false}
autoSize={false}
editable={false}
autoBgColor={false}
label={<span>Mask</span>}
></SingleImage>
</>
);
}, [maskUpload]);
return (
<div className="ground-left-wrapper">
<div className="ground-left">
@@ -428,6 +445,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
alignItems: 'center'
}}
>
<div className="m-r-10">{renderMaskImage}</div>
{renderOriginImage}
{imageList.length > 0 && (
<>
+50 -2
View File
@@ -553,7 +553,7 @@ export const ChatParamsConfig: ParamsSchema[] = [
},
attrs: {
max: 2,
step: 0.1,
step: 0.01,
inputnumber: true
},
rules: [
@@ -599,7 +599,55 @@ export const ChatParamsConfig: ParamsSchema[] = [
},
attrs: {
max: 1,
step: 0.1,
step: 0.01,
inputnumber: true
},
rules: [
{
required: false
}
]
},
{
type: 'Slider',
name: 'frequency_penalty',
label: {
text: 'Frequency Penalty',
isLocalized: false
},
description: {
text: 'playground.params.frequency_penalty.tips',
html: false,
isLocalized: true
},
attrs: {
max: 2,
min: -2,
step: 0.01,
inputnumber: true
},
rules: [
{
required: false
}
]
},
{
type: 'Slider',
name: 'presence_penalty',
label: {
text: 'Presence Penalty',
isLocalized: false
},
description: {
text: 'playground.params.presence_penalty.tips',
html: false,
isLocalized: true
},
attrs: {
max: 2,
min: -2,
step: 0.01,
inputnumber: true
},
rules: [
+6 -2
View File
@@ -5,7 +5,9 @@ export const LLM_METAKEYS: Record<string, any> = {
top_p: 'top_p',
n_ctx: 'n_ctx',
n_slot: 'n_slot',
max_model_len: 'max_model_len'
max_model_len: 'max_model_len',
frequency_penalty: 'frequency_penalty',
presence_penalty: 'presence_penalty'
};
export const IMG_METAKEYS = [
@@ -23,7 +25,9 @@ export const llmInitialValues = {
stop: null,
temperature: 1,
top_p: 1,
max_tokens: null
max_tokens: null,
frequency_penalty: null,
presence_penalty: null
};
export const advancedFieldsDefaultValus = {
+5 -1
View File
@@ -433,7 +433,11 @@ const Workers: React.FC = () => {
</span>
<span>
{intl.formatMessage({ id: 'resources.table.used' })}:{' '}
{convertFileSize(record?.status?.memory?.used, 0)}
{convertFileSize(
record?.status?.memory?.used ||
record?.status.memory?.allocated,
0
)}
</span>
</span>
}