mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 01:33:43 +08:00
Compare commits
4 Commits
6298b83e16
...
791f14f25a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
791f14f25a | ||
|
|
f9774698e9 | ||
|
|
2af6f6a166 | ||
|
|
3f06711501 |
@@ -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",
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user