chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Feature request: Bind Actions / Ask Users to the TextArea input menu

Open gruckion opened this issue 1 year ago • 1 comments

What: Allow devs to place actions into chat bar like Chat GPT

  1. Action buttons can be display in chat window image

  2. Action buttons can not be pinned image

Solution

One possibility is to pin them to the left of the input box

import chainlit as cl

@cl.action_callback("action_button")
def on_action(action):
    cl.Message(content=f"Executed {action.name}").send()
    # Optionally remove the action button from the chatbot user interface
    action.remove()

@cl.on_chat_start
def start():
    # Sending an action button within a chatbot message
    actions = [
        cl.Action(
          name="action_button",
          value="example_value", 
          description="Click me!",
          icon="icon-name"
        )
    ]

    cl.TextArea(actions=actions).build()

    cl.Message(content="Interact with this action button:", actions=actions).send()

Could set an icon to an action and show the actions name as alt text when hovering.

Requirements

  1. Be able to ask user: upload a file at any point for the LLM from the text area. (like Code Interpreter)
  2. Be able to trigger action at any point from the text area.

gruckion avatar Jun 06 '23 12:06 gruckion

Thank you for the feature request and design proposal! This is very interesting and would probably be part of the broader effort on Elements and Actions :)

willydouhard avatar Jun 06 '23 16:06 willydouhard

+1

ApurvaMisra avatar Jun 28 '23 01:06 ApurvaMisra