Skip to content

Refactor chatbase to use the new chat completion method in ChatCraftChat class. - #832

Open
aldrin312 wants to merge 10 commits into
mainfrom
refactorChatbase
Open

Refactor chatbase to use the new chat completion method in ChatCraftChat class.#832
aldrin312 wants to merge 10 commits into
mainfrom
refactorChatbase

Conversation

@aldrin312

@aldrin312 aldrin312 commented Feb 18, 2025

Copy link
Copy Markdown
Collaborator

Added a new method for chat completion the ChatCraftChat class and refactored ChatCraftBase to use the new method.
The new method doesn't implement UI elements like forceScrolling. May need to refactor again to include it.

Currently all of the hooks are being passed in from ChatCraftBase. Wasn't sure how to use them directly in ChatCraftChat class or if they are possible to use.

Issues: #819 and #820

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 18, 2025

Copy link
Copy Markdown

Deploying chatcraft-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: f55f156
Status: ✅  Deploy successful!
Preview URL: https://f6e3419b.console-overthinker-dev.pages.dev
Branch Preview URL: https://refactorchatbase.console-overthinker-dev.pages.dev

View logs

@aldrin312
aldrin312 requested review from humphd and mulla028 February 18, 2025 20:35
@aldrin312

Copy link
Copy Markdown
Collaborator Author

Create a new hook for chat completion. I find it doing it like this is much more easier and cleaner.
Using it now would be just await chatCompletion(prompt ?? "", chat); and would be easily accessible anywhere in the code.

I'm not sure if the completion method in the ChatCraftChat class should be removed now.

@humphd

humphd commented Feb 20, 2025

Copy link
Copy Markdown
Collaborator

You don't want to limit the ability to do chat completions to React Components, which a hook-only approach would do. We should have both ways.

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.

2 participants