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

Add .completion() method to ChatCraftChat class #819

Open
humphd opened this issue Feb 8, 2025 · 0 comments
Open

Add .completion() method to ChatCraftChat class #819

humphd opened this issue Feb 8, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@humphd
Copy link
Collaborator

humphd commented Feb 8, 2025

We need to start untangling our chat completions logic from the React components. The first step is to extract a new method on the ChatCraftClass called completion() so that you can do this anywhere in our code (React or lib code):

await chat.completion();

To get here, my suggestion is:

  • Look at the code in https://github.com/tarasglek/chatcraft.org/blob/main/src/Chat/ChatBase.tsx#L205, which is the main place where we do a chat completion when the user submits the prompt form
  • Try to separate out the state logic in this code (e.g., for handling scrolling, etc.) from the actual logic for doing the chat completion. The chat.completion() method shouldn't do anything to the UI, only operate on the chat instance.

To begin, I would do this work without altering the current code in https://github.com/tarasglek/chatcraft.org/blob/main/src/Chat/ChatBase.tsx#L205. We'll do that in a follow-up.

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

No branches or pull requests

3 participants