Comments (12)
from revChatGPT.revChatGPT import Chatbot
import json
# Get config
config = open("config.json", "r").read()
config = json.loads(config)
# Create a chatbot object
chatbot = Chatbot(config)
chatbot.refresh_session()
# Get a response
response = chatbot.get_chat_response("What is an egg?", output="text")
conversation = response['conversation_id']
parent_id = response['parent_id']
message = response['message']
print(message)
del chatbot
chatbot = Chatbot(config)
chatbot.conversation_id = conversation
chatbot.parent_id = parent_id
response = chatbot.get_chat_response("continue", output="text")
message = response['message']
print(message)
$ python3 GPT.py
Logging in...
An egg is a fertilized or unfertilized reproductive cell produced by birds, reptiles, and some amphibians. In birds and reptiles, the egg contains a developing embryo, which is fed by a yolk. The egg is surrounded by a hard shell that protects the embryo and helps to regulate its temperature. In some species, the egg is also covered in a protective outer layer called the chorion. Eggs are a source of nutrition for many animals and are also used as a food by humans.
Eggs are an important food for many animals, including birds and reptiles, which use them to provide nourishment to their young. For humans, eggs are a rich source of protein, vitamins, and minerals, and are often used in cooking. They can be prepared in a variety of ways, including boiling, frying, and scrambling. Eggs are also used in many processed foods, such as baked goods and pasta. Some people also use eggs as a source of food for their pets, such as birds and reptiles.
from chatgpt.
{"detail":"Too many requests, please slow down"}
This is a sign of rate limiting. There was a limit of 48 requests per minute I think. It might have been reduced.
from chatgpt.
That's why I'm confused. It never seems to stop rate limiting me and my first response always goes through fine. It just gives me "too many requests" only after I start passing a "conversation_id". I've waited over 10 minutes and I still get the same error. As soon as I take out the "conversation_id" parameter, I can generate replies without issue.
from chatgpt.
Replicated. If you try to put a conversation_id manually, it fails. It might be that it compares the parent_id to the conversation_id on the server side. Try setting the correct parent_id as well as conversation_id
from chatgpt.
Yeah, I'm not rate limited anymore but it seems like it forgets it's previous replies for me (i.e, I ask it to write code and to modify it's last response and it doesn't understand).
I'm caching off "conversation_id" and "parent_id", then reusing both values on the next invocation of "get_chat_response".
from chatgpt.
Does it work if you run it from the command line?
$ python3 -m revChatGPT
ChatGPT - A command-line interface to OpenAI's ChatGPT (https://chat.openai.com/chat)
Repo: github.com/acheong08/ChatGPT
Type '!exit' to exit
Press enter twice to submit your question.
You: Hello
Chatbot: Hello! I'm Assistant, a large language model trained by OpenAI. I'm here to help you with any questions you may have. What can I help you with today?
0
You: What is an egg
Chatbot: An egg is a reproductive body produced by female birds, reptiles, insects, and other animals. It consists of a protective outer layer called the shell, a nutrient-rich white or yellowish substance called the albumen, and a central yolk that contains the egg's genetic material. Some eggs are also fertilized by a male, in which case the egg contains a developing embryo. Eggs are a common ingredient in many types of food, and they are also a good source of protein and other nutrients.
0
You: continue
Chatbot: Sure! Is there anything specific you would like me to continue talking about regarding eggs? For example, I can talk more about the different types of eggs, how they are used in cooking, or their nutritional value. Let me know if there's anything specific you're interested in.
0
You:
from chatgpt.
Yes, It does. I must be doing something very wrong in my code. I'm basically doing something like so:
chatbot = Chatbot(self.chatbot_cfg, conversation_id=saved_convo_id)
if parent_id:
chatbot.parent_id = saved_parent_id
resp = chatbot.get_chat_response("prompt")
Both my "saved_convo_id" and "saved_parent_id" are the same ones from the original reply, but the replies I get seem to forget I've been talking to it.
from chatgpt.
self.parent_id = response["message"]["id"]
self.conversation_id = response["conversation_id"]
message = response["message"]["content"]["parts"][0]
return {'message':message, 'conversation_id':self.conversation_id, 'parent_id':self.parent_id}
The get_chat_response
function returns the conversation_id
and parent_id
. Make sure you're taking it from there.
from chatgpt.
I was. I'm trying a different approach now where I just cache off the entire "Chatbot" class instead. So far it seems to work better and I don't get rate limited, I need to test more though. Thanks for all the help so far!
from chatgpt.
I was. I'm trying a different approach now where I just cache off the entire "Chatbot" class instead. So far it seems to work better and I don't get rate limited, I need to test more though. Thanks for all the help so far!
Hey can you show me an example? I get the same problem and I don't quite understand how you managed to solve it?
from chatgpt.
My solution is pretty awful. Im just saing off the entire ChatBot class instance for each “user” in a dict. I then manually refresh tokens and such.
from chatgpt.
I will do some testing with setting the parent_id and conversation_id later today
from chatgpt.
Related Issues (20)
- The Functions HOT 1
- [Feature Request]: Additions to Awesome ChatGPT HOT 1
- [Bug]: ValueError: PUID is required HOT 1
- [Bug]: Error querying GPT 4 HOT 7
- [Bug]: access_denied: Your version of the ChatGPT app is out of date. Please update to the newest build of the app. HOT 12
- [Bug]: Field missing. Details: {'conversation_id': 'abf665f2-3c8f-4725-8263-5893bb5847ff', 'message_id': 'b8fe1067-2610-4bea-b33b-93b099b3803b', 'is_completion': False, 'moderation_response': {'flagged': False, 'blocked': False, 'moderation_id': 'modr-7eEtljxtdnGEn9sCjBEKoPBeuGh7M'}} HOT 13
- ValueError: Field missing. Details: {'conversation_id': '289a9ec4-cf13-45f5-bc3f-f96046e487c7', 'message_id': 'a5be1cb9-610f-4c53-a019-73abfd2b68ab', 'is_completion': False, 'moderation_response': {'flagged': False, 'blocked': False, 'moderation_id': 'modr-7eJ0uKhi6TSRvHoiBzCxVBTu7GA2v'}} HOT 4
- [Bug]: 应该是chat.openai新更新的json返回的格式,导致了现在只有message_id,没message这个字段了 HOT 3
- [Bug]: Support for 32bit and Arm processors
- Email/Password storing the Access token HOT 3
- [Bug]: Exception(resp_json.get("error", "Unknown error")) Exception: unable to log requests HOT 2
- [Bug]: https://bypass.churchless.tech/conversation HOT 1
- I registered on https://nat.dev verified by email however I am not getting verification code on mobile and that bug is not letting me login[Bug]:
- It asks to manually input captcha HOT 8
- [Feature Request]: personal advice HOT 2
- A timeout occurred Error code 524
- [Bug]:
- revChatGPT.typings.Error: OpenAI: {"error":"Post \"https://tcr9i.chat.openai.com/fc/gt2/public_key/35536E1E-65B4-4D96-9D97-6ADB7EFF8147\": http2: server sent GOAWAY and closed the connection; LastStreamID=1, ErrCode=ENHANCE_YOUR_CALM, debug=\"\""} (code: 500) HOT 1
- [Bug]: Please check that the input is correct, or you can resolve this issue by filing an issue HOT 2
- [Bug]: access token is expired in a minute! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatgpt.