acheong08 / ChatGPT

Reverse engineered ChatGPT API
GNU General Public License v2.0
28k stars 4.48k forks source link

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

Open Kiyliy opened 1 year ago

Kiyliy commented 1 year ago

Is there an existing issue for this?

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:

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

(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.运行这个代码便会出现这个错误

  1. 将请求切换到 prompt_test= "hi" 一切正常, 说明是我的提示词的缘故 """ from revChatGPT.V1 import Chatbot

def echo(str): return str

chatbot = Chatbot(config={ "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:

    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: acheong@student.dalat.org
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

```Shell
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 commented 1 year ago

我修改了我的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:


    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 commented 1 year ago

我又做了更多的测试, 并略微修改了一下提示词, 我确信这是一个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:


    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)
""""""""""""