XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Add error message on Ratelimit

44289e1f
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +5 -21
Modified g4f/gui/client/static/js/chat.v1.js +5 -21
@@ -2420,27 +2420,11 @@ async function api(ressource, args=null, files=null, message_id=null, scroll=tru
2420 2420 });
2421 2421 // On Ratelimit
2422 2422 if (response.status == 429) {
2423 // They are still pending requests?
2424 for (let key in controller_storage) {
2425 if (!controller_storage[key].signal.aborted) {
2426 console.error(response);
2427 await finish_message();
2428 return;
2429 }
2430 }
2431 setTimeout(async () => {
2432 response = await fetch(url, {
2433 method: 'POST',
2434 signal: controller_storage[message_id].signal,
2435 headers: headers,
2436 body: body,
2437 });
2438 if (response.status != 200) {
2439 console.error(response);
2440 }
2441 await read_response(response, message_id, args.provider || null, scroll, finish_message);
2442 await finish_message();
2443 }, 20000) // Wait 20 secounds on rate limit
2423 const body = await response.text();
2424 const title = body.match(/<title>([^<]+?)<\/title>/)[1];
2425 const message = body.match(/<p>([^<]+?)<\/p>/)[1];
2426 error_storage[message_id] = `**${title}**\n${message}`;
2427 await finish_message();
2444 2428 } else {
2445 2429 await read_response(response, message_id, args.provider || null, scroll, finish_message);
2446 2430 await finish_message();