-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: chat regenerate and proceed #26
Conversation
The commands to trigger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
src/api.ts
Outdated
@@ -46,13 +46,13 @@ class ChatGPT { | |||
* @param message - The plaintext message to send. | |||
* @param opts.conversationId - Optional ID of the previous message in a conversation | |||
*/ | |||
async sendMessage(conversation: Conversation): Promise<Required<Conversation>> { | |||
async sendMessage(conversation: Conversation, action: string): Promise<Required<Conversation>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async sendMessage(conversation: Conversation, action: string): Promise<Required<Conversation>> { | |
async sendMessage(conversation: Conversation, action: 'next' | 'variant' | 'continue'): Promise<Required<Conversation>> { |
Would be better for the typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you can consider to put action into Conversation
type as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary. Because I think conversation
represents the context of the chat, and I don't think action
is part of the chat context, so I put it in the parameters of sendMessage
.
@@ -37,7 +37,7 @@ export const Config: Schema<Config> = Schema.intersect([ | |||
}), | |||
]) | |||
|
|||
const conversations = new Map<string, { messageId: string; conversationId: string }>() | |||
const conversations = new Map<string, Conversation>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really good to use type Conversation
here, as we don't save messages in the map.
If you stick with a type, you can split them into two types, but I argue with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your specific idea? My idea is to use the Conversation
type here and save it in a Map
. I can't think of any other idea at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just to revert this type would be good to me.
Otherwise you should write something like:
export interface Conversation {
messageId: string
conversationId: string
}
export interface ConversationMessage extends Conversation {
message: string
}
That would be much much redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how do I save the chat context, which is necessary in the implementation of variant
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or
const conversations = new Map<string, Conversation>() | |
const conversations = new Map<string, Omit<Conversation, 'message'>>() |
while Omit
is a built-in type of typescript.
Signed-off-by: Seidko <[email protected]>
The backend of OpenAI is really hard to deal with. 🤯 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for hanging a long time before reply.
Is this PR still usable?
@@ -37,7 +37,7 @@ export const Config: Schema<Config> = Schema.intersect([ | |||
}), | |||
]) | |||
|
|||
const conversations = new Map<string, { messageId: string; conversationId: string }>() | |||
const conversations = new Map<string, Conversation>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or
const conversations = new Map<string, Conversation>() | |
const conversations = new Map<string, Omit<Conversation, 'message'>>() |
while Omit
is a built-in type of typescript.
let request: Conversation = conversations.get(key) | ||
let action: ChatGPT.Action = input in actions ? actions[input] : 'next' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also always use const
, unless you really really need to change it in runtime, otherwise keep it immutable.
Sorry 😂 I was concerned that ChatGPT might start charging in the future so I haven't planned to continue this PR. I don't know what Maiko thinks, I'd like to hear your opinion. |
Maiko thinks that we should make it usable at least even with a subscription. So may you continue working on this? |
Okay 🤣 I have to admit I'm a bit lazy to do it because the captcha is really annoying. I will try to continue this PR, but I don't sure whether I can make it well. |
I want to completely refactor this plugin, so there is no need to keep this PR open, so I'm closing it now. |
implements #22