返回提交历史
Modified
g4f/gui/client/qrcode.html
+5
-1
Modified
g4f/gui/client/static/css/style.css
+2
-0
Modified
g4f/tools/files.py
+3
-3
XFEstudio/gpt4free
Fix missing bucket cache file
3c546897
代码差异
3 个文件
+10
-4
@@ -81,13 +81,17 @@
81
81
const chat_id = generate_uuid();
82
82
83
83
const url = `${share_url}/backend-api/v2/chat/${encodeURI(chat_id)}`;
84
fetch(url, {
84
const response = fetch(url, {
85
85
method: 'POST',
86
86
headers: {'content-type': 'application/json'},
87
87
body: localStorage.getItem(`conversation:${conversation_id}`)
88
88
});
89
89
const share = `${share_url}/chat/${encodeURI(chat_id)}/${encodeURI(conversation_id)}`;
90
90
const qrcodeStatus = document.getElementById('qrcode-status');
91
if (response.status !== 200) {
92
qrcodeStatus.innerText = 'Error generating QR code';
93
return;
94
}
91
95
qrcodeStatus.innerText = share;
92
96
qrcodeStatus.href = share;
93
97
document.getElementById("qrcode").innerHTML = '';
@@ -57,6 +57,8 @@ html,
57
57
body {
58
58
scroll-behavior: smooth;
59
59
overflow: hidden;
60
max-height: 100%;
61
max-width: 100%;
60
62
}
61
63
62
64
body {
@@ -254,14 +254,14 @@ def read_bucket(bucket_dir: Path):
254
254
bucket_dir = Path(bucket_dir)
255
255
cache_file = bucket_dir / PLAIN_CACHE
256
256
spacy_file = bucket_dir / f"spacy_0001.cache"
257
if not spacy_file.exists():
257
if not spacy_file.is_file() and cache_file.is_file():
258
258
yield cache_file.read_text(errors="replace")
259
259
for idx in range(1, 1000):
260
260
spacy_file = bucket_dir / f"spacy_{idx:04d}.cache"
261
261
plain_file = bucket_dir / f"plain_{idx:04d}.cache"
262
if spacy_file.exists():
262
if spacy_file.is_file():
263
263
yield spacy_file.read_text(errors="replace")
264
elif plain_file.exists():
264
elif plain_file.is_file():
265
265
yield plain_file.read_text(errors="replace")
266
266
else:
267
267
break