bupticybee / ChineseAiDungeonChatGPT

中文版的ai地牢,直接使用的openai的ChatGPT api作为讲故事的模型。
1.39k stars 141 forks source link

我该如何换上自己的账号和密钥呢? #21

Closed guoodddd closed 1 year ago

guoodddd commented 1 year ago

如题,我有自己的号。请问是在代码哪一块修改呢?

guoodddd commented 1 year ago

Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 761, in _update_chunk_length self.chunk_left = int(line, 16) ^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 444, in _error_catcher yield File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 828, in read_chunked self._update_chunk_length() File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 765, in _update_chunk_length raise InvalidChunkLength(self, line) urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 816, in generate yield from self.raw.stream(chunk_size, decode_content=True) File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 624, in stream for line in self.read_chunked(amt, decode_content=decode_content): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 816, in read_chunked with self._error_catcher(): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\response.py", line 461, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\ChineseAiDungeonChatGPT-main\example_story.py", line 8, in story_teller.interactive() File "D:\ChineseAiDungeonChatGPT-main\story.py", line 37, in interactive self.action(action) File "D:\ChineseAiDungeonChatGPT-main\story.py", line 30, in action resp = self.chatbot.get_chat_response(prompt) # Sends a request to the API and returns the response by OpenAI ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 221, in get_chat_response return self.get_chat_text(data) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 159, in get_chat_text response = s.post( ^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 635, in post return self.request("POST", url, data=data, json=json, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 745, in send r.content File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 899, in content self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 818, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

guoodddd commented 1 year ago

顺便问下这个报错有人遇到过吗?

bupticybee commented 1 year ago

我今天看下这个错

bupticybee commented 1 year ago

可以直接运行app.py,里边会让你填写账号密码

zxypro1 commented 1 year ago

我把cli也加上登陆注册功能吧

bupticybee commented 1 year ago

我把cli也加上登陆注册功能吧

好呀感谢呀

guoodddd commented 1 year ago

我是修改了你代码中的文本字符串出的这个错

bupticybee commented 1 year ago

我是修改了你代码中的文本字符串出的这个错

Hmm那我也母鸡是什么问题,理论上不应该

bupticybee commented 1 year ago

我是修改了你代码中的文本字符串出的这个错

可能是编码问题

guoodddd commented 1 year ago

应该是超出了 tokens的单次上限导致的。

guoodddd commented 1 year ago

突然自己的tokens都用不了,不知怎么回事,头疼。

guoodddd commented 1 year ago

IndexError: list index out of range

The above exception was the direct cause of the following exception: 会出现这个报错。

guoodddd commented 1 year ago

Missing necessary credentials 和这个。

bupticybee commented 1 year ago

能不能把就是错误全部截取出来,应该还有其他报错

guoodddd commented 1 year ago

OpenAI][8][CRITICAL] Access Token: Not found Auth0 did not issue an access token. [OpenAI][9] Attempting to get access token from: https://chat.openai.com/api/auth/session [OpenAI][9] Access Token: Not found, Please try again with a proxy (or use a new proxy if you are using one)

Credentials have been refreshed. Exception in thread Thread-1 (_on_login): Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(self._args, self._kwargs) File "D:\ChineseAiDungeonChatGPT-main\app.py", line 207, in _on_login self.register_storyteller(use_default=False) File "D:\ChineseAiDungeonChatGPT-main\app.py", line 214, in register_storyteller self.show_background_window() File "D:\ChineseAiDungeonChatGPT-main\app.py", line 170, in show_background_window result = tkinter.simpledialog.askstring( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\tkinter\simpledialog.py", line 411, in askstring d = _QueryString(title, prompt, kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\tkinter\simpledialog.py", line 388, in init _QueryDialog.init(self, args, **kw) File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\tkinter\simpledialog.py", line 283, in init Dialog.init(self, parent, title) File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\tkinter\simpledialog.py", line 143, in init self.wait_visibility() File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\tkinter__init__.py", line 752, in wait_visibility self.tk.call('tkwait', 'visibility', window._w) _tkinter.TclError: window ".!_querystring" was deleted before its visibility changed Exception in thread Thread-3 (_on_enter_pressed): Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 164, in get_chat_text response = response.text.splitlines()[-4]


IndexError: list index out of range

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

Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 177, in get_chat_text raise Exception( Exception: Missing necessary credentials

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

Traceback (most recent call last): File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "D:\ChineseAiDungeonChatGPT-main\app.py", line 272, in _on_enter_pressed self._insert_message(msg, "你") File "D:\ChineseAiDungeonChatGPT-main\app.py", line 287, in _insert_message self.story_teller.action(msg) File "D:\ChineseAiDungeonChatGPT-main\story.py", line 30, in action resp = self.chatbot.get_chat_response(prompt) # Sends a request to the API and returns the response by OpenAI ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 221, in get_chat_response return self.get_chat_text(data) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\24195\AppData\Local\Programs\Python\Python311\Lib\site-packages\revChatGPT\revChatGPT.py", line 180, in get_chat_text raise Exception("Not a JSON response") from exc2 Exception: Not a JSON response

guoodddd commented 1 year ago

不好意思,刚吃晚饭没看到大佬你的回答

guoodddd commented 1 year ago

我把之改过的全删除了,重新解压后也是这样

guoodddd commented 1 year ago

顺便问下,您能出个用gpt3模型的api的版本吗?或您有思路吗?我感觉gpt3的链接更稳定,这个chatgpt的api不知道哪天就没了

guoodddd commented 1 year ago

或着您能有偿教学吗?

guoodddd commented 1 year ago

在您现有这个程序的基础上把接口替换成gpt3的

bupticybee commented 1 year ago

按照报错里面的这个提示,应该是login的时候open AI会,就是读你的IP,必须得不在中国地区才能登录进去

bupticybee commented 1 year ago

所以考虑在运行程序的时候挂一个全局梯子

bupticybee commented 1 year ago

我猜应该就可以解这个问题

guoodddd commented 1 year ago

可我确实挂着梯子,开了全局的,挂靠在日本。

zxypro1 commented 1 year ago

目前cli也更新了登录功能,可以尝试一下。可以通过api自动获取token。

guoodddd commented 1 year ago

大佬,没事了,我不懂得全部靠问chatgpt弄懂了,我在它的帮助下已经搭建起了自己的应用。

bupticybee commented 1 year ago

大佬,没事了,我不懂得全部靠问chatgpt弄懂了,我在它的帮助下已经搭建起了自己的应用。

厉害啦,那我先关闭这个issue