mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-03 00:26:40 +08:00
更新token的计算方式,优化请求逻辑
This commit is contained in:
parent
e214302817
commit
2c488675c6
@ -1268,8 +1268,10 @@ function _Chat() {
|
|||||||
setAttachImages(images);
|
setAttachImages(images);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载状态结束,获取token
|
||||||
|
const [loadingChange, setLoadingChange] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoading) {
|
if (!isLoading && loadingChange) {
|
||||||
try {
|
try {
|
||||||
fetch("/api/logs/get_current_token", {
|
fetch("/api/logs/get_current_token", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@ -1284,10 +1286,11 @@ function _Chat() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
console.log("加载消息完成。获取token");
|
|
||||||
}
|
}
|
||||||
}, [isLoading]);
|
return () => {
|
||||||
|
setLoadingChange(isLoading);
|
||||||
|
};
|
||||||
|
}, [isLoading, loadingChange]);
|
||||||
|
|
||||||
// const [ voiceInputText, setVoiceInputText ] = useState("");
|
// const [ voiceInputText, setVoiceInputText ] = useState("");
|
||||||
// const [ voiceInputLoading, setVoiceInputLoading ] = useState(false);
|
// const [ voiceInputLoading, setVoiceInputLoading ] = useState(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user