mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 09:43:42 +08:00
Compare commits
4 Commits
6298b83e16
...
791f14f25a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
791f14f25a | ||
|
|
f9774698e9 | ||
|
|
2af6f6a166 | ||
|
|
3f06711501 |
@@ -1,6 +1,7 @@
|
|||||||
package cloudflare
|
package cloudflare
|
||||||
|
|
||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
|
"@cf/meta/llama-3.1-8b-instruct",
|
||||||
"@cf/meta/llama-2-7b-chat-fp16",
|
"@cf/meta/llama-2-7b-chat-fp16",
|
||||||
"@cf/meta/llama-2-7b-chat-int8",
|
"@cf/meta/llama-2-7b-chat-int8",
|
||||||
"@cf/mistral/mistral-7b-instruct-v0.1",
|
"@cf/mistral/mistral-7b-instruct-v0.1",
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { useSelector } from 'react-redux';
|
|||||||
import useRegister from 'hooks/useRegister';
|
import useRegister from 'hooks/useRegister';
|
||||||
import Turnstile from 'react-turnstile';
|
import Turnstile from 'react-turnstile';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
// import { useSelector } from 'react-redux';
|
|
||||||
|
|
||||||
// material-ui
|
// material-ui
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
|
CircularProgress,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
Grid,
|
Grid,
|
||||||
@@ -50,6 +50,9 @@ const RegisterForm = ({ ...others }) => {
|
|||||||
const [strength, setStrength] = useState(0);
|
const [strength, setStrength] = useState(0);
|
||||||
const [level, setLevel] = useState();
|
const [level, setLevel] = useState();
|
||||||
|
|
||||||
|
const [timer, setTimer] = useState(0);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleClickShowPassword = () => {
|
const handleClickShowPassword = () => {
|
||||||
setShowPassword(!showPassword);
|
setShowPassword(!showPassword);
|
||||||
};
|
};
|
||||||
@@ -74,11 +77,17 @@ const RegisterForm = ({ ...others }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setLoading(true); // Start loading
|
||||||
|
|
||||||
const { success, message } = await sendVerificationCode(email, turnstileToken);
|
const { success, message } = await sendVerificationCode(email, turnstileToken);
|
||||||
|
setLoading(false); // Stop loading
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
showError(message);
|
showError(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimer(60); // Start the 60-second timer
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -94,6 +103,17 @@ const RegisterForm = ({ ...others }) => {
|
|||||||
}
|
}
|
||||||
}, [siteInfo]);
|
}, [siteInfo]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let interval;
|
||||||
|
if (timer > 0) {
|
||||||
|
interval = setInterval(() => {
|
||||||
|
setTimer((prevTimer) => prevTimer - 1);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, [timer]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Formik
|
<Formik
|
||||||
@@ -240,8 +260,13 @@ const RegisterForm = ({ ...others }) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
endAdornment={
|
endAdornment={
|
||||||
<InputAdornment position="end">
|
<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>
|
</Button>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user