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

XFEstudio/gpt4free

Fix missing bucket cache file

3c546897
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

3 个文件 +10 -4
Modified g4f/gui/client/qrcode.html +5 -1
@@ -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 = '';
Modified g4f/gui/client/static/css/style.css +2 -0
@@ -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 {
Modified g4f/tools/files.py +3 -3
@@ -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