Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

[Bug]: Please check that the input is correct, or you can resolve this issue by filing an issue #1489

Open
1 task done
Kiyliy opened this issue Aug 6, 2023 · 2 comments

Comments

@Kiyliy
Copy link

Kiyliy commented Aug 6, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

当我请求的时候, 出现了这个错误, 我认为是我的提示词的缘故, 当我将我的提示词换成了简单的"hi" , 工作起来一切正常
当时当我使用一个结构类似于json格式的str, 会出现这个错误
错误日志: (error log:)
""""""""""""""""""""""""""""
Traceback (most recent call last):
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 870, in __check_response
response.raise_for_status()
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for
url: https://bypass.churchless.tech/conversation

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "e:\Code_project\Python\reChatGPT\reChatGPT\dev_plugin0.1.py", line 35, in
for data in chatbot.ask(
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 757, in ask
yield from self.post_messages(
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 710, in post_messages
yield from self.__send_request(
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 545, in __send_request
self.__check_response(response)
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 102, in wrapper
out = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 877, in __check_response
raise error from ex
revChatGPT.typings.Error: OpenAI:

<style global>body{font-family:Arial,Helvetica,sans-serif}.container{align-items:center;display:flex;flex-direction:column;gap:2rem;height:100%;justify-content:center;width:100%}@Keyframes enlarge-appear{0%{opacity:0;transform:scale(75%) rotate(-90deg)}to{opacity:1;transform:scale(100%) rotate(0deg)}}.logo{color:#8e8ea0}.scale-appear{animation:enlarge-appear .4s ease-out}@media (min-width:768px){.scale-appear{height:48px;width:48px}}.data:empty{display:none}.data{border-radius:5px;color:#8e8ea0;text-align:center}@media (prefers-color-scheme:dark){body{background-color:#343541}.logo{color:#acacbe}}</style>

Please stand by, while we are checking your browser...

Redirecting...

Please turn JavaScript on and reload the page.

<script>(function(){window._cf_chl_opt={cvId: '2',cZone: 'chat.openai.com',cType: 'managed',cNounce: '77990',cRay: '7f27e678b9a240a1',cHash: 'f3adea6b44186c2',cUPMDTk: "\/backend-api\/conversation?__cf_chl_tk=Yf9aQ7N3DX6Utn1E1ocH1R2whZPJp2mjqOTkhshavHs-1691331413-0-gaNycGzNE3s",cFPWv: 'g',cTTimeMs: '1000',cMTimeMs: '0',cTplV: 1,cTplB: 'cf',cK: "",fa: "/backend-api/conversation?__cf_chl_f_tk=Yf9aQ7N3DX6Utn1E1ocH1R2whZPJp2mjqOTkhshavHs-1691331413-0-gaNycGzNE3s",md: "soM2tUn4Dez5lNoFOIJx.mhv5GGhOAg04JUjt3EoTSo-1691331413-0-ATOajQFcDmpGxD4xmF2FGJJ3K0fCfqEI73zT2U-eZSnenpyyUPF9YZzjRk6voZxGux_km1jcHmMMBGx2g44bbNnR26bk7o9GRr7XB98Mw35zvEkIJZr5e7GYjrOdUgcDI3DrcwzhGxazA0QplXP5wPvx-TWymzTJc3y_Kh3AGhjnK3bOjfhSLLZSDr1YYKVg72QJLRdYbkcoCPdRGc5VF6B675sbk-5snk9gQYy8J1qp1KEs3dJguq2Usq4ShaDwW4jWE0kTW5dMepctpOLivI7C89nog8x1fHeUT3CQ1eHhkGooBH15JKG5Y5xm1AY68iqo1JeagRj9J_ugUQ0DF-1i8SfVkOf1smN2NGmNwJRUIsbuQsJ4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'mGBZpaMyZw00fHQXcpYUBgJ+KCyEs/QzHNzI3gEGsxA=',i1: '6jBCFp9h9q7A5Uf9fBtOxw==',i2: 'MbA8WeRMBcQXiPVHf039mg==',zh: 'iuyN59AGNgeBFFEOPj72EN+xtBfXXvoCyd1dJnIVFAc=',uh: '2bOnWttJE7CWj6VkmurENcdFUnRVOci+2FAZ4DiyLeA=',hh: 'foaWmAUHGGlVCZaNUJIHhxzxFNzSPNnVe6rJjiQw728=',}};var cpo = document.createElement('script');cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/chl_page/v1?ray=7f27e678b9a240a1';window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;if (window.history && window.history.replaceState) {var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, null, "\/backend-api\/conversation?__cf_chl_rt_tk=Yf9aQ7N3DX6Utn1E1ocH1R2whZPJp2mjqOTkhshavHs-1691331413-0-gaNycGzNE3s" + window._cf_chl_opt.cOgUHash);cpo.onload = function() {history.replaceState(null, null, ogU);};}document.getElementsByTagName('head')[0].appendChild(cpo);}());</script>
<script>!function(){var e=document.createElement("iframe");function t(){var t=e.contentDocument||e.contentWindow.document;if(t){var n=t.createElement("script");n.nonce="",n.innerHTML="window['__CF$cv$params']={r:'79271b319741fa72',m:'sCXwl7Hde_jVE6GIOe0wKz4oMt3Lh8w0Eua1mDgehB0-1675216960-0-AYp1IKwNU5u8yMiuEYyoErcqoHVV4YDI+VMoX7mzAvt9fZ4EOB3++PlEm7wtksX3Xttwni3QWV/tKTeRlCy+/nY6nCAYRHzWlB1zXw1KXyx/+B5lo5mvtnyYfuCVVJEWfwzAUnF4MwJWDszLxIwECgs=',s:[0xb58b3307a5,0x39915b3715],u:'/cdn-cgi/challenge-platform/h/g'};var now=Date.now()/1000,offset=14400,ts=''+(Math.floor(now)-Math.floor(now%offset)),_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/h/g/scripts/alpha/invisible.js?ts='+ts,document.getElementsByTagName('head')[0].appendChild(_cpo);",t.getElementsByTagName("head")[0].appendChild(n)}}if(e.height=1,e.width=1,e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.border="none",e.style.visibility="hidden",document.body.appendChild(e),"loading"!==document.readyState)t();else if(window.addEventListener)document.addEventListener("DOMContentLoaded",t);else{var n=document.onreadystatechange||function(){};document.onreadystatechange=function(e){n(e),"loading"!==document.readyState&&(document.onreadystatechange=n,t())}}}();</script> (code: 403) Please check that the input is correct, or you can resolve this issue by filing an issue Project URL: https://github.com/acheong08/ChatGPT

Steps to reproduce the problem

1.运行这个代码便会出现这个错误
2. 将请求切换到 prompt_test= "hi" 一切正常, 说明是我的提示词的缘故
"""
from revChatGPT.V1 import Chatbot

def echo(str):
return str

chatbot = Chatbot(config={
"access_token": "<YOUR_ACCESS_TOKEN>"
})

print("Chatbot: ")
prev_text = ""
User_question = input("User: ")
prompt_test ="hi"
prompt = r"""{
{"role": "system","content":"You are a function_selector engine,
you can only selecte one function from the following functions,and cannot interpret or explain user questions:
```json
1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
3.{{echo(str)}}
4.{{Translation(text=TEXT)}}
5.{{AiDrawPrompt()}}
6.{{QuestionAnswer()}}(default function)
7.{{CodeInterpret()}}}","""+"""{{"role": "user","content": "select function to assistant user,
please do not explain anything,user question:{0}, select function like {{exampleFunction()}}"}},""".format(User_question)
print(prompt)
print("type(prompt)=",type(prompt))
print("type(prompt_test)=",type(prompt_test))

for data in chatbot.ask(
prompt_test,
):

message = data["message"][len(prev_text):]
print(message, end="", flush=True)
prev_text = data["message"]

print()
print("message=",message)
print("prev_text=",prev_text)
print("data=",data)

What should have happened?

得到ChatGPT的回复

Version where the problem happens

"""""""""""""
Name: revChatGPT
Version: 6.8.6
Summary: ChatGPT is a reverse engineering of OpenAI's ChatGPT API
Home-page: https://github.com/acheong08/ChatGPT
Author: Antonio Cheong
Author-email: [email protected]
License: GNU General Public License v2.0
Location: E:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages
Requires: httpx, openai, OpenAIAuth, prompt-toolkit, requests, rich, tiktoken
Required-by
""""""""""""""

What Python version are you running this with?

Python : 3.11.4

What is your operating system ?

No response

Command Line Arguments

No

Console logs

Chatbot: 
User: hi
{
    {"role": "system","content":"You are a function_selector engine,
 you can only selecte one function from the following functions,and cannot interpret or explain user questions:
    
    1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
    2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
    3.{{echo(str)}}
    4.{{Translation(text=TEXT)}}
    5.{{AiDrawPrompt()}}
    6.{{QuestionAnswer()}}(default function)
    7.{{CodeInterpret()}}}",{"role": "user","content": "select 
function to assistant user,
please do not explain anything,user question:hi, select function like {exampleFunction()}"},
type(prompt)= <class 'str'>
type(prompt_test)= <class 'str'>
Traceback (most recent call last):
  File "e:\Code_project\Python\reChatGPT\venv_reChatGPT\Lib\site-packages\revChatGPT\V1.py", line 870, in __check_response    
    response.raise_for_status()

Additional information

No response

@Kiyliy
Copy link
Author

Kiyliy commented Aug 6, 2023

我修改了我的User_question, 于是出现了使用英文提问可以, 使用中文提问不行的情况
User_question = input("User: ")
prompt = r"""{
{"role": "system","content":"You are a function_selector engine,
you can only selecte one function from the following functions,and cannot interpret or explain user questions:
```json
1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
3.{{echo(str)}}
4.{{Translation(text=TEXT)}}
5.{{AiDrawPrompt()}}
6.{{QuestionAnswer()}}(default function)
7.{{CodeInterpret()}}}",{{"role": "user","content": "select function to assistant user,
please do not explain anything,user question:"""+f"{{{{"{User_question}"}}}}"+""" select function like {{exampleFunction()}}"}}"""

@Kiyliy
Copy link
Author

Kiyliy commented Aug 6, 2023

我又做了更多的测试, 并略微修改了一下提示词, 我确信这是一个bug:
你们可以尝试下面的代码, 会发现无论如何都会报错, 但是当我在提示词的末尾, """}}select function, 添加一个空格, 变成""" }}select function, 这个代码就会变成下面的情况

  1. "英文" : 正常, 示例: "hi"
  2. "中文: error ,示例: "你好"
  3. 中文+英文 ,正常 , 示例: 你好 hi
  4. 英文+ 中文, error, 示例, hi 你好
    """""""""""""

from revChatGPT.V1 import Chatbot

def echo(str):
return str

chatbot = Chatbot(config={
"access_token": "token"
})

print("Chatbot: ")
prev_text = ""
User_question = input("User: ")
prompt_test ="hi"
prompt = r"""{
{"role": "system","content":"You are a function_selector engine,
you can only selecte one function from the following functions,and cannot interpret or explain user questions:
```json
1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
3.{{echo(str)}}
4.{{Translation(text=TEXT)}}
5.{{AiDrawPrompt()}}
6.{{QuestionAnswer()}}(default function)
7.{{CodeInterpret()}}}",{{"role": "user","content": "select function to assistant user,
please do not explain anything,user question:{{"""+f"{User_question}"+"""}}select function like {{exampleFunction()}}"}}"""
print(prompt)
print("type(prompt)=",type(prompt))
print("type(prompt_test)=",type(prompt_test))

for data in chatbot.ask(
prompt,
):

message = data["message"][len(prev_text):]
print(message, end="", flush=True)
prev_text = data["message"]

print()
print("message=",message)
print("prev_text=",prev_text)
print("data=",data)
""""""""""""

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant