diff options
Diffstat (limited to 'g4f/gui')
-rw-r--r-- | g4f/gui/client/js/chat.v2.js | 11 | ||||
-rw-r--r-- | g4f/gui/server/backend.py | 5 |
2 files changed, 4 insertions, 12 deletions
diff --git a/g4f/gui/client/js/chat.v2.js b/g4f/gui/client/js/chat.v2.js index 24f2e45b..f052b7e6 100644 --- a/g4f/gui/client/js/chat.v2.js +++ b/g4f/gui/client/js/chat.v2.js @@ -144,10 +144,6 @@ const ask_gpt = async (message) => { chunk = new TextDecoder().decode(value); - if (chunk.includes('<form id="challenge-form" action="/backend-api/v2/conversation?"')) { - chunk = `cloudflare token expired, please refresh the page.`; - } - text += chunk; document.getElementById(`gpt_${window.token}`).innerHTML = @@ -160,12 +156,7 @@ const ask_gpt = async (message) => { message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" }); } - // if text contains : - if (text.includes("instead. Maintaining this website and API costs a lot of money")) { - document.getElementById(`gpt_${window.token}`).innerHTML = "An error occured, please reload / refresh cache and try again or use a differnet browser"; - } - - if (text.includes(`anerroroccuredmf`)) { + if (text.includes(`G4F_ERROR`)) { document.getElementById(`gpt_${window.token}`).innerHTML = "An error occured, please try again, if the problem persists, please reload / refresh cache or use a differnet browser"; } diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index a76ca12b..7b5e9f0d 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -33,7 +33,7 @@ class Backend_Api: conversation = request.json['meta']['content']['conversation'] prompt = request.json['meta']['content']['parts'][0] model = request.json['model'] - provider = request.json.get('provider').split("g4f.Provider.")[1] + provider = request.json.get('provider').split('g4f.Provider.')[1] messages = special_instructions[jailbreak] + conversation + search(internet_access, prompt) + [prompt] @@ -52,6 +52,7 @@ class Backend_Api: except Exception as e: return { + 'code' : 'G4F_ERROR', '_action': '_ask', 'success': False, - "error": f"an error occured {str(e)}"}, 400
\ No newline at end of file + 'error' : f'an error occured {str(e)}'}, 400
\ No newline at end of file |