pawanosman / pygpt Goto Github PK
View Code? Open in Web Editor NEWPython implementation of Unofficial ChatGPT Client
License: MIT License
Python implementation of Unofficial ChatGPT Client
License: MIT License
HI,
i used your repo for a long time and it works very well , realy appreciate it.
I have a question that i copied an existed conversationId from url https://chat.openai.com/chat/beace48a-4b6d-4cd2-b83c-9cf7d2005ce7 and set it to parmas
answer = await chat_gpt.ask('hello', id='beace48a-4b6d-4cd2-b83c-9cf7d2005ce7')
but in fact it created a new conversation, how to use old conversions?
Hello, I can access chatgpt normally, and the session is only obtained. Why would you run your program and report the following error.
Connected to server
Task exception was never retrieved
future: <Task finished name='Task-14' coro=<PyGPT.check_tokens() done, defined at /Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py:39> exception=TimeoutError()>
Traceback (most recent call last):
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py", line 48, in check_tokens
await self.get_tokens()
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py", line 109, in get_tokens
data = await self.socket.call(event='getSession', data=self.session_token, timeout=self.timeout)
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/socketio/asyncio_client.py", line 297, in call
raise exceptions.TimeoutError() from None
socketio.exceptions.TimeoutError
Hi,
I installed PyGPT by pip3 install --upgrade PyGPT, and it is indeed appeared in pip3 list. But i cant import it. Im not python dev, so im not sure it was my PC's problem or PyGPT problem. By the way, other packages works normal. The same occurred on my google cloud platform instance.
It was fine when I tried your example for the first time.
But I got this error when I run the code second time.
Connected to server
Ready!!
packet queue is empty, aborting
Traceback (most recent call last):
File "/home/seolhwa/PycharmProjects/respective/chatgpt_conv.py", line 113, in <module>
main()
File "/home/seolhwa/PycharmProjects/respective/chatgpt_conv.py", line 107, in main
asyncio.run(async_main(args))
File "/home/seolhwa/miniconda3/envs/chatgpt/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/seolhwa/miniconda3/envs/chatgpt/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/seolhwa/PycharmProjects/respective/chatgpt_conv.py", line 26, in async_main
answer = await chat_gpt.ask(q[0])
File "/home/seolhwa/PycharmProjects/respective/pygpt.py", line 95, in ask
conversation['conversation_id'] = data['conversationId']
KeyError: 'conversationId'
Is there a way to use either conversation ID or parent ID to call up the content of the old chat that originally came from the site?
I used __Secure-next-auth.session-token
, but I can't connect to the server, and my proxy is working fine. Not ChatGPT Plus btw.
Connected to server
Ready!!
The capital of France is Paris.
Disconnected from server
Hi PawanOsman,
Thanks for your great api!
Here I have a problem. I'm always getting socketio.exceptions.TimeoutError
while asking for a long answer.
Foer example, when I send prompts like following text, which means that I want chatgpt to generate 5 nonprofit qustions about children's charity.
生成5道公益问题,问题主要针对儿童的健康保护,希望和关注自闭症儿童或者关注儿童教育相关。同时需要满足以下条件:
1)题目具有公益性
2)有2至4个选项
3)题目最多24个字
4)选项最多11个字
5)只有一个正确选项
6)包含解析,解析最多126个字
I will get socketio.exceptions.TimeoutError when I request with above text. However, if I change the 5 nonprofit qustions
to 1 nonprofit qustions
, the api is more likely to give me a response. Could you help me with this?
Besides, the error is like:
packet queue is empty, aborting
2023-01-06 14:52:02,188 - engineio.client - ERROR - packet queue is empty, aborting
----------------------------------------
Exception occurred during processing of request from ('127.0.0.1', 33162)
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.9/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/root/miniconda3/lib/python3.9/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/root/miniconda3/lib/python3.9/site-packages/wechatrobot/WeChatRobot.py", line 43, in __init__
super().__init__(*args, **kwargs)
File "/root/miniconda3/lib/python3.9/socketserver.py", line 747, in __init__
self.handle()
File "/root/miniconda3/lib/python3.9/site-packages/wechatrobot/WeChatRobot.py", line 105, in handle
self.receive_callback(msg)
File "/root/miniconda3/lib/python3.9/site-packages/wechatrobot/WeChatRobot.py", line 89, in receive_callback
Bus.emit("group_msg", msg)
File "/root/miniconda3/lib/python3.9/site-packages/wechatrobot/Bus.py", line 14, in emit
results.append(f(*args, **kwargs))
File "/usr/games/wechat_gpt/wxbot_v2.py", line 340, in on_group_msg
call_back(message, sender, wxid, exclude_groups=groups)
File "/usr/games/wechat_gpt/wxbot_v2.py", line 273, in call_back
reply = asyncio.run(poapi(PyGPT(current_bot["session_id"]), query_data, bot, sender, db))
File "/root/miniconda3/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/root/miniconda3/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/usr/games/wechat_gpt/chatgpt/poChatgpt_async.py", line 12, in poapi
reply = await chat_gpt.ask(query_data)
File "/usr/games/wechat_gpt/chatgpt/poChatgpt_async.py", line 77, in ask
data = await self.socket.call('askQuestion', ask_data)
File "/root/miniconda3/lib/python3.9/site-packages/socketio/asyncio_client.py", line 297, in call
raise exceptions.TimeoutError() from None
socketio.exceptions.TimeoutError
Regards,
Ulysses
dear author,
I met this problem when I try to use this tool. If you can help me, I am very appreciated it. Thank you so much~
Traceback (most recent call last):
File "/home/user/app/main.py", line 17, in
asyncio.run(main())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/home/user/app/main.py", line 10, in main
await chat_gpt.connect()
File "/usr/local/lib/python3.10/dist-packages/pygpt.py", line 72, in connect
await self.socket.connect(f'{self.bypass_node}/?client=python&version=1.0.5&versionCode=105')
File "/usr/local/lib/python3.10/dist-packages/socketio/asyncio_client.py", line 149, in connect
raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: Unexpected status code 503 in server response
Connected to server
Token expired, getting new token
Getting tokens...
Ready!!
Error: An error ocurred. Try refreshing your browser.
packet queue is empty, aborting
Traceback (most recent call last):
File "/Users/wzq/Desktop/word_medi/event_extraction/models/ie/uie.py", line 13, in
asyncio.run(main())
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/Users/wzq/Desktop/word_medi/event_extraction/models/ie/uie.py", line 8, in main
answer = await chat_gpt.ask('What is the capital of France?')
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py", line 149, in ask
conversation['conversation_id'] = data['conversationId']
KeyError: 'conversationId'
Exception in thread Thread-1:
Traceback (most recent call last):
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/threading.py", line 980, in _bootstrap_inner
self.run()
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/threading.py", line 917, in run
self._target(*self._args, **self._kwargs)
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py", line 69, in save_interval
self.save()
File "/Users/wzq/opt/anaconda3/envs/chatgpt/lib/python3.9/site-packages/pygpt.py", line 45, in save
conversation['last_active'] = conversation['last_active'].isoformat()
AttributeError: 'str' object has no attribute 'isoformat'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x10e0689d0>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.