Skip to content
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

Support request-level getMessageById() and upsertMessage() opts #537

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alxmiron
Copy link
Contributor

Now custom getMessageById() and upsertMessage() can be provided only on constructor level, that makes impossible to set request-specific logic.

I propose to support those opts in sendMessage() call as well

@@ -87,7 +89,7 @@ export class ChatGPTError extends Error {
}

/** Returns a chat message from a store by it's ID (or null if not found). */
export type GetMessageByIdFunction = (id: string) => Promise<ChatMessage>
export type GetMessageByIdFunction = (id: string) => Promise<ChatMessage | null>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in type

@transitive-bullshit
Copy link
Owner

I'm not sure I understand the motivation around allowing these to be customized at the sendMessage level? Can you give more details about your use case?

Thanks!

@alxmiron
Copy link
Contributor Author

alxmiron commented Apr 19, 2023

@transitive-bullshit For instance, I store "enable chat history" flag in user preferences, so if it's false my upsertMessage() and getMessageById() should do nothing. But I cannot customize them on constructor level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants