From 17bd3b3ac632768126fa8c27874aa05e48fcd24b Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:12:34 +0100 Subject: Fix report errors --- g4f/gui/client/static/js/chat.v1.js | 5 ++--- g4f/gui/server/backend_api.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 148a5344..51d2af11 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -545,7 +545,7 @@ const prepare_messages = (messages, message_index = -1, do_continue = false, do_ } // Include only not regenerated messages if (new_message) { - // Remove generated images from history + // Remove generated images from content if (new_message.content) { new_message.content = filter_message(new_message.content); } @@ -565,7 +565,6 @@ const prepare_messages = (messages, message_index = -1, do_continue = false, do_ } } }); - console.log(4, final_messages); return final_messages; } @@ -2301,7 +2300,7 @@ async function api(ressource, args=null, files=null, message_id=null, scroll=tru if (appStorage.getItem("report_error") != "true") { return; } - url = `https://roxky-g4f-demo.hf.space${url}"`; + url = `https://roxky-g4f-demo.hf.space${url}`; } headers['content-type'] = 'application/json'; response = await fetch(url, { diff --git a/g4f/gui/server/backend_api.py b/g4f/gui/server/backend_api.py index 6bda5b2a..639e3733 100644 --- a/g4f/gui/server/backend_api.py +++ b/g4f/gui/server/backend_api.py @@ -178,8 +178,9 @@ class Backend_Api(Api): cache_dir = Path(get_cookies_dir()) / ".logging" cache_file = cache_dir / f"{datetime.date.today()}.jsonl" cache_dir.mkdir(parents=True, exist_ok=True) + data = {"origin": request.headers.get("origin"), **request.json} with cache_file.open("a" if cache_file.exists() else "w") as f: - f.write(f"{json.dumps(request.json)}\n") + f.write(f"{json.dumps(data)}\n") return {} @app.route('/backend-api/v2/memory/', methods=['POST']) -- cgit v1.2.3