Comments (16)
I think so. However, I think you'd need to somehow use the conversationId
, not the invocationId. invocationId looks like the index of message (in order to track the last message) in a given conversation... I may be wrong.
By the way, if you just want to continue the conversation, do something like acheong on his cli:
async def main():
"""
Main function
"""
print("Initializing...")
bot = Chatbot()
while True:
prompt = get_input("\nYou:\n")
if prompt == "!exit":
break
elif prompt == "!help":
print(
"""
!help - Show this help message
!exit - Exit the program
!reset - Reset the conversation
""",
)
continue
elif prompt == "!reset":
await bot.reset()
continue
print("Bot:")
if args.no_stream:
print(
(await bot.ask(prompt=prompt))["item"]["messages"][1]["adaptiveCards"][
0
]["body"][0]["text"],
)
else:
wrote = 0
async for final, response in bot.ask_stream(prompt=prompt):
if not final:
print(response[wrote:], end="")
wrote = len(response)
sys.stdout.flush()
print()
sys.stdout.flush()
await bot.close()
Call ask
on the same Chatbot
object to continue the conversation.
from edgegpt.
I think so. However, I think you'd need to somehow use the
conversationId
, not the invocationId. invocationId looks like the index of message (in order to track the last message) in a given conversation... I may be wrong. By the way, if you just want to continue the conversation, do something like acheong on his cli:async def main(): """ Main function """ print("Initializing...") bot = Chatbot() while True: prompt = get_input("\nYou:\n") if prompt == "!exit": break elif prompt == "!help": print( """ !help - Show this help message !exit - Exit the program !reset - Reset the conversation """, ) continue elif prompt == "!reset": await bot.reset() continue print("Bot:") if args.no_stream: print( (await bot.ask(prompt=prompt))["item"]["messages"][1]["adaptiveCards"][ 0 ]["body"][0]["text"], ) else: wrote = 0 async for final, response in bot.ask_stream(prompt=prompt): if not final: print(response[wrote:], end="") wrote = len(response) sys.stdout.flush() print() sys.stdout.flush() await bot.close()Call
ask
on the sameChatbot
object to continue the conversation.
Your advice enlightened me, thank you very much!
from edgegpt.
Just continue calling ask
in the same object instead of closing it. If you want to start a new conversation, call reset
or close
and create a new one.
from edgegpt.
Is there a way of being able to have multiple conversations at once like you can with ChatGPT?
from edgegpt.
If we are talking about EdgeGPT used as a module, yes. Keep the objects in memory and used them to keep track of the conversation. Keep in mind that conversations have an expiration date (iirc 40minutes since last interaction)
from edgegpt.
How would I be able to do that? From what I see in the ask
method under ChatBot
I don't see a way to pass a conversation ID or anything like that.
Would this involve manually calling the other classes?
from edgegpt.
Some changes are necessary to make this work
from edgegpt.
Mainly the tracking of invocationID
from edgegpt.
How would I be able to do that? From what I see in the ask method under ChatBot I don't see a way to pass a conversation ID or anything like that.
Would this involve manually calling the other classes?
@Mazawrath what I do in my telegram bot is creating an object and storing it in a dictionary for example, each object (ChatBot) has its own conversation id, calling ask
on said object will continue that conversation, so you can have multiple conversations at the same time (tracked by the ChatBot object)
from edgegpt.
Mainly the tracking of invocationID
I'm not sure what this involves, but if you can do something as simple as returning those values in ask()
similar to RevChatGPT, I can do a lot of the hard work and keep track of all the different values, and pass in the right values to reference the conversation I want.
from edgegpt.
The main thing would be that I can at least pass whatever values are needed to reference a conversation into ask()
and having that method fill in whatever values I give it, then I can store whatever values are needed on my end.
from edgegpt.
Mainly the tracking of invocationID
I wrote code like this
import asyncio
from EdgeGPT import Chatbot
async def main():
bot = Chatbot(cookiePath='./cookie.json')
resp = await bot.ask(prompt="Hello, are you an AI?")
print(resp['item']['messages'])
await bot.close()
if __name__ == "__main__":
asyncio.run(main())
Return me a string of data like this
[{'text': 'Hello, are you an AI?', 'author': 'user', 'from': {'id': '1759218623174937', 'name': None}, 'createdAt': '2023-03-01T20:46:22.194108+00:00', 'timestamp': '2023-03-01T20:46:22.1917024+00:00', 'locale': 'en-us', 'market': 'en-us', 'region': 'us', 'messageId': 'a104ed79-8c29-4547-87c2-3b08d55df875', 'requestId': 'a104ed79-8c29-4547-87c2-3b08d55df875', 'offense': 'None', 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'cib', 'privacy': None, 'inputMethod': 'Keyboard'}, {'text': "I'm sorry but I prefer not to continue this conversation. I'm still learning so I appreciate your understanding and patience.๐", 'author': 'bot', 'createdAt': '2023-03-01T20:46:25.2906937+00:00', 'timestamp': '2023-03-01T20:46:25.2906937+00:00', 'messageId': 'bb40c5e9-4f11-4213-b8b3-73cc00f994c8', 'requestId': 'a104ed79-8c29-4547-87c2-3b08d55df875', 'offense': 'None', 'adaptiveCards': [{'type': 'AdaptiveCard', 'version': '1.0', 'body': [{'type': 'TextBlock', 'text': "I'm sorry but I prefer not to continue this conversation. I'm still learning so I appreciate your understanding and patience.๐\n", 'wrap': True}]}], 'sourceAttributions': [], 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'DeepLeo', 'privacy': None, 'spokenText': "I'm still learning so I appreciate your understanding and patience."}]
I wonder which of these is what you call "invocationID" ?
from edgegpt.
Print the whole object returned from ask, you're returning just the item.message part.
from edgegpt.
Print the whole object returned from ask, you're returning just the item.message part.
Okay, I understand
print(resp)
the data is
{'type': 2, 'invocationId': '0', 'item': {'messages': [{'text': 'Hello, are you an AI?', 'author': 'user', 'from': {'id': '1759218623174937', 'name': None}, 'createdAt': '2023-03-01T20:54:31.3474622+00:00', 'timestamp': '2023-03-01T20:54:31.34498+00:00', 'locale': 'en-us', 'market': 'en-us', 'region': 'us', 'messageId': 'f02441f9-d323-487c-8b78-34ee5fc882c2', 'requestId': 'f02441f9-d323-487c-8b78-34ee5fc882c2', 'offense': 'None', 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'cib', 'privacy': None, 'inputMethod': 'Keyboard'}, {'text': "I'm sorry but I prefer not to continue this conversation. I'm still learning so I appreciate your understanding and patience.๐", 'author': 'bot', 'createdAt': '2023-03-01T20:54:35.3181651+00:00', 'timestamp': '2023-03-01T20:54:35.3181651+00:00', 'messageId': 'e6af2d97-c912-46ad-9f2f-a0823e419665', 'requestId': 'f02441f9-d323-487c-8b78-34ee5fc882c2', 'offense': 'None', 'adaptiveCards': [{'type': 'AdaptiveCard', 'version': '1.0', 'body': [{'type': 'TextBlock', 'text': "I'm sorry but I prefer not to continue this conversation. I'm still learning so I appreciate your understanding and patience.๐\n", 'wrap': True}]}], 'sourceAttributions': [], 'feedback': {'tag': None, 'updatedOn': None, 'type': 'None'}, 'contentOrigin': 'DeepLeo', 'privacy': None, 'spokenText': "I'm still learning so I appreciate your understanding and patience."}], 'firstNewMessageIndex': 1, 'conversationId': '51D|BingProd|30752556F839D8C915F4C03A976B29CBFAD0FC144BDFAAE4431B2DB61BDD0273', 'requestId': 'f02441f9-d323-487c-8b78-34ee5fc882c2', 'conversationExpiryTime': '2023-03-02T02:54:36.4614458Z', 'shouldInitiateConversation': True, 'telemetry': {'metrics': None, 'startTime': '2023-03-01T20:54:31.3450536Z'}, 'throttling': {'maxNumUserMessagesInConversation': 6, 'numUserMessagesInConversation': 1}, 'result': {'value': 'Success', 'serviceVersion': '20230228.87'}}}
Can I think 'invocationId': '0', this zero is the invocationId?
from edgegpt.
This issue is stale because it has been open for 2 days with no activity.
from edgegpt.
This issue was closed because it has been inactive for 3 days since being marked as stale.
from edgegpt.
Related Issues (20)
- websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200 HOT 8
- KeyError: 'suggestedResponses' HOT 1
- asyncio.exceptions.TimeoutError HOT 2
- [Bug]: server rejected WebSocket connection: HTTP 200 HOT 18
- [Bug]: Exception: Authentication failed. You have not been accepted into the beta. HOT 10
- Preserve conversation before it deletes it and says "sorry, i cant give a response to that". HOT 1
- [Bug]: Have a problem from example in README.md HOT 5
- CaptchaChallenge: User needs to solve CAPTCHA to continue HOT 1
- Facing this over server like railway & heroku
- BingImageCreator.py request_id = redirect_url.split("id=")[-1]ไธบ็ฉบ
- [Bug]: Exception: UnauthorizedRequest: Cannot retrieve user status.
- [Bug]: cannot import name 'Chatbot' from 'EdgeGPT' HOT 2
- [Bug]: websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200 when I use the script on a server HOT 7
- [Bug]: run EdgeGPT with flask HOT 3
- [Bug]: AttributeError: โlistโ object has no attribute โstartswithโโ HOT 2
- Exception has occurred: Exception Authentication failed. You have not been accepted into the beta. HOT 6
- EdgeGPTๅฏไปฅไฝฟ็จ็จๆทๅๅฏ็ ็ป้ๅ
- [Bug]: Websocket init, HTTP 101 request, server response HTTP 200 HOT 4
- [Bug]: Invalid Captcha Response HOT 4
- [Bug]: websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200
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 edgegpt.