AudioNotes icon indicating copy to clipboard operation
AudioNotes copied to clipboard

请问这个前端界面代码可以开源么?

Open Yewx0310 opened this issue 1 year ago • 1 comments

Yewx0310 avatar Aug 27 '24 09:08 Yewx0310

前端代码在这里: https://github.com/Chainlit/chainlit

前端界面基于它制作的,只要使用decorator就能创建一个对话界面:

import chainlit as cl


@cl.step(type="tool")
async def tool():
    # Fake tool
    await cl.sleep(2)
    return "Response from the tool!"


@cl.on_message  # this function will be called every time a user inputs a message in the UI
async def main(message: cl.Message):
    """
    This function is called every time a user inputs a message in the UI.
    It sends back an intermediate response from the tool, followed by the final answer.

    Args:
        message: The user's message.

    Returns:
        None.
    """


    # Call the tool
    tool_res = await tool()

    await cl.Message(content=tool_res).send()

jasonzhouu avatar Feb 05 '25 07:02 jasonzhouu