marcominerva/ChatGptNet

Add method to load a conversation

Closed this issue · 7 comments

It is useful to have a method that allows to load a previous conversation:

Task<Guid> LoadConversationAsync(IEnumerable<ChatGptMessage> messages);

Task<Guid> LoadConversationAsync(Guid conversationId, IEnumerable<ChatGptMessage> messages, bool replaceHistory = true);

Consider the following guidelines:

  • The first method must call the second one with Guid.NewGuid() as conversationId
  • If replaceHistory = false, messages must be added to existing ones in the given conversation
  • The total number of messages must not exceed the message limit defined in ChatGptOptions

I think in the method
Task<Guid> LoadConversationAsync(IEnumerable<ChatGptMessage> messages, bool replaceHistory = true);
the optional parameter **replaceHistory ** will not be necessary, since the messages will be bound to a new conversation with a new conversationId, or possibly I am missing the point.

You're right, it is a typo. I have updated the description.

Can you leave this to me? I have almost finished

Yes, I have assigned the task to you

Thanks a lot

One more thing: should I ensure that messages are not empty in
Task<Guid> LoadConversationAsync(Guid conversationId, IEnumerable<ChatGptMessage> messages, bool replaceHistory = true);
or should there be a feature like clearing the history of the conversation?

My point is messages should not be empty since there already is a method to clear the history.

I think it is not necessary to check if messages are empty, because the user could have created its own conversationId, so it is not already assigned to a real conversation.