-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New Component: Chat/Prompt UI #1354
Comments
Just noting that SlickGPT is built in Skeleton. Might be some work there that is useful: |
Thanks @riziles! That's exactly the sort of scenario I'm targeting. I'll definitely reference your prior work and of course welcome feedback on what I produce. Watch for updates here on our |
Oh, it's not my work. I have no involvement. I only know about it because the creator shared it in the Skeleton discord showcase. |
Hi, SlickGPT guy here. @endigo9740 asked me to comment on possible features for this topic. First of all, I think you have it covered pretty much already. As mentioned, I built the entire SlickGPT UI with Skeleton and wasn't missing anything really. There are a couple of "oh yeah, right..." things I can name that were pretty easy to implement with your components but could be part of a preset component composition (that's basically what a "Skeleton Chat UI" would be, right?):
This is nestable, so further messages in a branch can be branched again which makes this super complex in terms of data and UI - hello, recursion and svelte-self! I guess your first idea would be to skip this entirely and just offer "flat messages". This might be fine but could also miss the LLM/ChatGPT community, so keep it in mind. That's all that comes to mind right now, I might edit this post later with additional points. I think to fully implement a chat UI you'd need some stores, a lot of events, properties and slots. Not sure if that would get too opinionated quickly - maybe it's more like a nice OS demo for Skeleton that people can take and use or customize to their needs without forking. |
This is great @Shackless thank you for this! My hope to have some time to work on this sometime next week. I'll follow up then if I need clarification on anything. But thanks for your detailed post! Tons of great info here! |
You‘re very welcome, thanks for building Skeleton! Let me know if I can help any more. |
@riziles @Shackless and anyone else who wishes to test this, the new PR is pending review now: Here's the preview URL, which should cover everything available for this: I know some folks were expecting this to be a fully fledge component. However, I think that would be misguided approach here, given chat implementation can vary WILDLY from app to app. Conversation chat between users and AI prompts can have vastly different requirements. Instead I've provided a simpler, but more flexible approach - I've opted to create a new Tailwind > Blocks > Chat section which covers how to implement a basic chat-like interface using the resources provided by Skeleton and Tailwind, with some simple logic examples to boot. However, I'd welcome feedback on what is provided here. However, just keep in mind the goal is to showcase how to get started, how to utilize Skeleton provided primitives, and less about trying to provide a turnkey solution for every use case - which would be an unrealistic goal. |
Thank you for this. I will migrate my own chat into this but a few things come to mind.
Thanks for the effort again. @endigo9740 When will you release this feature? Ronald |
It's probably going to be released in the next update which would be Tuesday next week. |
@RonB FYI: I had problems with SvelteMarkdown and MDSVEX when I tried to parse an incomplete message (the "live answer" that is streamed from the OpenAI API) because they both don't like incomplete/invalid Markdown as input. The one lib that just doesn't care about this (of course with some caveats) is snarkdown. It seems abandoned but does the job pretty well. Just in case you'll run into that... |
Hey @RonB, what Sarenor said, next release is this upcoming Tuesday. The way I did this there's no new features or dependencies, just showing what's possible with the tools at hand. I suppose the scripts provided are new, but nothing should prevent you from using this right now if you have access to the doc page. We've left it open ended on how users implement this, given this will vary for every use case (markdown for you, json for another person, etc). Likewise I noted the textarea expansion, but I don't have a great solution for that YET. However, I do expect this section to evolve over time. That might be a great candidate for something to add. |
Hi Chris, Thank you. I solved that a bit dubious but it works: // adjust the size of the message box
function keyup(event: KeyboardEvent) {
event.target.style.height = '15px';
event.target.style.height = 25 + event.target.scrollHeight + 'px';
} <textarea
bind:this={text_input}
on:keyup={keyup}
placeholder="How can i help you?"
/> |
That's interesting @RonB, I'll try this out. Thanks for sharing! |
Unfortunately this has some bugginess when a paragraph is dropped in. I do think this is something we should offer a solution for, so I'll aim to circle back to this in the near future. In the meantime, @Shackless offered this solution in his post above. It might serve as a temporary solution if you don't mind an extra dependency in your project:
|
Yes I saw that, i added the on:input event and the paragraph drops works well. I did not want the extra dependency. Renamed the keyup function to "resize" so: function resizeTextarea(event: any) {
event.target.style.height = '15px';
event.target.style.height = 25 + event.target.scrollHeight + 'px';
} and <textarea
bind:this={text_input}
bind:value={text}
on:keydown={keydown}
on:input={resizeTextarea}
on:keyup={resizeTextarea}
placeholder="How can i help you?"
/> Maybe more element events or external events should call the function as well. |
The Legos implementation might be a good start if you want to roll your own. I didn’t try but yours doesn’t reduce the size if you delete text or clear the bound value from outside, does it? |
When clearing the text-area using the keyboard it works fine. The keyup event should handle that. |
I personally used this approach : https://svelte.dev/repl/40f4c7846e6f4052927ff5f9c5271b66?version=3.6.8 This is based on this clever hack where you mirror your textarea content in a |
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
We have need of a conversational chat UI interface, similar to a user-to-user chat or an AI prompt conversation.
What type of pull request would this be?
New Feature
Any links to similar examples or other references we should review?
No response
The text was updated successfully, but these errors were encountered: