Giter VIP home page Giter VIP logo

pygpt's Introduction

pygpt's People

Contributors

monk1337 avatar pawanosman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pygpt's Issues

Hello, I can access chatgpt normally, and the session is only obtained. Why would you run your program and report the following error.

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

That model doesn't exist

I found that the web GPT model changed into text-moderation-playground now, it seems that it was text-davinci-002-render before. Maybe this?

image
image

client_session: <aiohttp.client.ClientSession object at 0x7f56a8351450>

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'

Restore old chat from site

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?

Disconnected from server

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

socketio.exceptions.TimeoutError Frequently

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

socketio.exceptions.ConnectionError: Unexpected status code 503 in server response

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

Hello, I upgraded chatgpt to the plus version, and the program has the following error. This error also occurs when I try not to use the plus version, how should I deal with this problem.

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.