koishijs / chatgpt-bot

AI conversation based on ChatGPT | 基于 ChatGPT 的 AI 对话机器人
https://chatgpt.koishi.chat
MIT License
70 stars 13 forks source link

Feat: Support `variant` and `continue` #22

Open Seidko opened 1 year ago

Seidko commented 1 year ago

I found that content_type has three types when I was analyzing the API: next variant and continue. Chatgpt plugin currently implements next type, and the variant type allows the AI to change the way it says, while the continue type completes a truncated sentence. Now I want to implement these two types in chatgpt plugin.

image

MaikoTan commented 1 year ago

Looks like #18 can be solved with continue as well.

Seidko commented 1 year ago

Which means. I can implement continue by merging the parts of the conversation?

MaikoTan commented 1 year ago

No, I mean you could implement continue then the problem in #18 would be solved, so we don't need to do the merge-whatever things.

Seidko commented 1 year ago

Got it. I will start working on it now.

Seidko commented 1 year ago

Because I need to implement continue and variant, I need to save the previous message. Do you have any different ideas?

MaikoTan commented 1 year ago

There was a parent message id that I have processed already. Is there any problem with it?

https://github.com/koishijs/chatgpt-bot/blob/38354f1adfc1d556368b2d05c894683ed4e0b95b/src/api.ts#L15

https://github.com/koishijs/chatgpt-bot/blob/38354f1adfc1d556368b2d05c894683ed4e0b95b/src/api.ts#L68

https://github.com/koishijs/chatgpt-bot/blob/38354f1adfc1d556368b2d05c894683ed4e0b95b/src/api.ts#L119

Seidko commented 1 year ago

No, actually the conversations saved in koishi only has messageId and conversationId, so I came to ask this question.

https://github.com/koishijs/chatgpt-bot/blob/e6adbcf6bbf064e7ec2d38d0656a1d8e9c8539ab/src/index.ts#L40

Seidko commented 1 year ago

I need to save the previous message for chatgpt in order to implement variant and continue.

MaikoTan commented 1 year ago

I don't really know what is variant and continue even though you mentioned them several times. Would you mind explaining what are and how they would behave in the conversation? Merci.

Seidko commented 1 year ago

Sure. The purpose of variant is to let the AI regenerate the previous sentence, which is equivalent to the Try again button in the ChatGPT web page. I haven't tested the function of continue, but according to the name, it should be to continue the truncated part.

Seidko commented 1 year ago

I just successfully tested the function of continue, but I'm not sure if it is really the function of continue.

image