Compare commits

...

4 Commits

Author SHA1 Message Date
jinjianming
791f14f25a Merge 3f06711501 into f9774698e9 2024-08-07 10:12:59 +08:00
longkeyy
f9774698e9 feat: synchronize with the official release of the groq model (#1677)
update groq add gemma2-9b-it llama3.1 family fixup price k/token -> m/token
2024-08-06 23:51:08 +08:00
TAKO
2af6f6a166 feat: add Cloudflare New Free Model Llama 3.1 8b (#1703) 2024-08-06 23:49:48 +08:00
jinjianmingming
3f06711501 feat: berry主题发送邮箱验证码添加loading效果和倒计时,修复多次点击导致发送多个验证码问题 2024-07-19 11:43:06 +08:00
2 changed files with 223 additions and 197 deletions

View File

@@ -1,6 +1,7 @@
package cloudflare
var ModelList = []string{
"@cf/meta/llama-3.1-8b-instruct",
"@cf/meta/llama-2-7b-chat-fp16",
"@cf/meta/llama-2-7b-chat-int8",
"@cf/mistral/mistral-7b-instruct-v0.1",

View File

@@ -3,13 +3,13 @@ import { useSelector } from 'react-redux';
import useRegister from 'hooks/useRegister';
import Turnstile from 'react-turnstile';
import { useSearchParams } from 'react-router-dom';
// import { useSelector } from 'react-redux';
// material-ui
import { useTheme } from '@mui/material/styles';
import {
Box,
Button,
CircularProgress,
FormControl,
FormHelperText,
Grid,
@@ -50,6 +50,9 @@ const RegisterForm = ({ ...others }) => {
const [strength, setStrength] = useState(0);
const [level, setLevel] = useState();
const [timer, setTimer] = useState(0);
const [loading, setLoading] = useState(false);
const handleClickShowPassword = () => {
setShowPassword(!showPassword);
};
@@ -74,11 +77,17 @@ const RegisterForm = ({ ...others }) => {
return;
}
setLoading(true); // Start loading
const { success, message } = await sendVerificationCode(email, turnstileToken);
setLoading(false); // Stop loading
if (!success) {
showError(message);
return;
}
setTimer(60); // Start the 60-second timer
};
useEffect(() => {
@@ -94,6 +103,17 @@ const RegisterForm = ({ ...others }) => {
}
}, [siteInfo]);
useEffect(() => {
let interval;
if (timer > 0) {
interval = setInterval(() => {
setTimer((prevTimer) => prevTimer - 1);
}, 1000);
}
return () => clearInterval(interval);
}, [timer]);
return (
<>
<Formik
@@ -240,8 +260,13 @@ const RegisterForm = ({ ...others }) => {
onChange={handleChange}
endAdornment={
<InputAdornment position="end">
<Button variant="contained" color="primary" onClick={() => handleSendCode(values.email)}>
发送验证码
<Button
variant="contained"
color="primary"
onClick={() => handleSendCode(values.email)}
disabled={timer > 0 || loading}
>
{loading ? <CircularProgress size={24} /> : timer > 0 ? `${timer}s` : '发送验证码'}
</Button>
</InputAdornment>
}