nlkitai / nlux

The π—£π—Όπ˜„π—²π—Ώπ—³π˜‚π—Ή Conversational AI JavaScript Library πŸ’¬ β€”Β UI for any LLM, supporting LangChain / HuggingFace / Vercel AI, and more 🧑 React, Next.js, and plain JavaScript ⭐️
https://docs.nlkit.com/nlux
Other
937 stars 48 forks source link

Enable conversation starters #68

Closed salmenus closed 1 week ago

salmenus commented 1 month ago

Add an option to allow developers to add conversation starters.

type ConversationStarter {
    prompt: string;
    label?: string;
    icon?: string | JSX.Element;
}
salmenus commented 3 weeks ago

Feature now available here: https://docs.nlkit.com/nlux/examples/conversation-starters

MichaelHefetz commented 2 weeks ago

Hi, any chance to implement the label and icon as in the proposal? Currently only prompt is used inside the starter card Thank you

salmenus commented 2 weeks ago

Hi @MichaelHefetz β€”Β Sure, we can get that for you. Re-opening. I'll post an update here once it's ready (ETA 48h)

somebodyawesome-dev commented 2 weeks ago

I will work on this ticket. and finish up the missing details

salmenus commented 2 weeks ago

Thanks @somebodyawesome-dev β€”Β Much appreciated πŸ™Œ Ping me on Discord if you need any help

somebodyawesome-dev commented 2 weeks ago

linked to https://github.com/nlkitai/nlux/pull/91

salmenus commented 1 week ago

PR merged and change published. Ready for you @MichaelHefetz

Config example:

conversationOptions={{
    conversationStarters: [
        {
            icon: <span>πŸ“</span>, // When string is provided, it will be considered an image URL
            label: 'Write a poem',
            prompt: 'Write a poem about the stars and magic, using the words "twinkle" and "sparkle".'
       },
       {prompt: 'What is your name?'},
       {prompt: 'What is your favorite color?'}
    ]
}}

Prompt is the only required attribute. Give it a try and let us know how it works for you @MichaelHefetz

Thanks @somebodyawesome-dev for delivering this πŸ™Œ 😎

MichaelHefetz commented 1 week ago

Thank you! It works now :) The only issue is with the long labels/prompts. The ellipsis is gone now and also the bottom padding

image

salmenus commented 1 week ago

@MichaelHefetz feature updated in 2.8.2 β€” Ellipsis should work now. https://docs.nlkit.com/nlux/examples/conversation-starters

Also you can easily configure dimensions of the boxes using CSS: https://github.com/nlkitai/nlux/blob/latest/packages/css/themes/src/dev/layout.css#L22

I hope this solves all your problems. Closing if no further comments.