nalgeon / pokitoki

Humble GPT Telegram Bot
MIT License
317 stars 56 forks source link

Add new message to old context #23

Closed HeySlava closed 1 year ago

HeySlava commented 1 year ago

Hello!

I'm not sure if it's a bug, but I believe it's an area for improvement.

What is the issue?

Imagine you asked a question and then followed up with another question. By mistake, you forgot to include a "+" at the beginning of the second message. Later, you noticed the error and edited your last message to include the "+". Unfortunately, the context was lost.

Default:

Слава Слава, [26 Apr 2023 09:30:11]
Remember. I am 80 years old

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:14]
Of course, I will keep that in mind and try my best to explain things clearly and concisely. If you have any trouble understanding my responses, please let me know and I will do my best to clarify.

Слава Слава, [26 Apr 2023 09:30:24]
+ add 10 years

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:27]
To add 10 years to your current age, you would simply add 10 to your current age. For example, if you are currently 80 years old, adding 10 years would make you 90 years old.

Missed +

Слава Слава, [26 Apr 2023 09:30:40]
Remember. I am 80 years old

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:42]
Of course, I will keep that in mind and try to explain things in a clear and concise manner. Please feel free to let me know if you need any further clarification or assistance.

Слава Слава, [26 Apr 2023 09:30:50]
add 10 years

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:57]
Adding 10 years can be done easily using programming. Here are some examples in different programming languages:

Python:

import datetime

current_year = datetime.datetime.now().year
new_year = current_year + 10

print(new_year)

JavaScript:

var currentYear = new Date().getFullYear();
var newYear = currentYear + 10;

console.log(newYear);

Java:

import java.util.Calendar;

Calendar now = Calendar.getInstance();
int currentYear = now.get(Calendar.YEAR);
int newYear = currentYear + 10;

System.out.println(newYear);

Each of these examples will output the current year plus 10.

Edited message and added +

Слава Слава, [26 Apr 2023 09:30:40]
Remember. I am 80 years old

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:42]
Of course, I will keep that in mind and try to explain things in a clear and concise manner. Please feel free to let me know if you need any further clarification or assistance.

Слава Слава, [26 Apr 2023 09:30:50]
+ add 10 years

Капитонов GPT/pokitoki, [26 Apr 2023 09:30:57]
# First answer
...

Капитонов GPT/pokitoki, [26 Apr 2023 09:34:34]
Adding 10 years to what exactly? Could you please provide more context or information so that I can give a more accurate response?
nalgeon commented 1 year ago

Yes, the context is lost in such cases. Otherwise there would be no way to automatically clean the context.

It's part of the design. The other way would be to always remember the context unless the user issues a reset command. I don't like that approach.

And once the context is lost, there is no way to recover it.

nalgeon commented 1 year ago

"Restoring" context would require keeping two contexts (the current one and the previous one). I'd rather not do that.