chore: import upstream snapshot with attribution
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# This is a simple example of a chainlit app.
|
||||
|
||||
from chainlit import AskUserMessage, Message, on_chat_start
|
||||
|
||||
|
||||
@on_chat_start
|
||||
async def main():
|
||||
res = await AskUserMessage(content="What is your name?", timeout=30).send()
|
||||
if res:
|
||||
await Message(
|
||||
content=f"Your name is: {res['output']}.\nChainlit installation is working!\nYou can now start building your own chainlit apps!",
|
||||
).send()
|
||||
@@ -0,0 +1,59 @@
|
||||
from typing import Optional
|
||||
|
||||
import chainlit as cl
|
||||
|
||||
|
||||
@cl.set_starter_categories
|
||||
async def starter_categories(user: Optional[cl.User] = None):
|
||||
return [
|
||||
cl.StarterCategory(
|
||||
label="Creative",
|
||||
icon="https://cdn-icons-png.flaticon.com/512/3094/3094837.png",
|
||||
starters=[
|
||||
cl.Starter(
|
||||
label="Write a poem about nature",
|
||||
message="Write a poem about nature",
|
||||
),
|
||||
cl.Starter(
|
||||
label="Create a short story",
|
||||
message="Create a short story about adventure",
|
||||
),
|
||||
cl.Starter(
|
||||
label="Generate a creative name",
|
||||
message="Generate creative names for a tech startup",
|
||||
),
|
||||
],
|
||||
),
|
||||
cl.StarterCategory(
|
||||
label="Learning",
|
||||
icon="https://cdn-icons-png.flaticon.com/512/3976/3976625.png",
|
||||
starters=[
|
||||
cl.Starter(
|
||||
label="Explain a complex topic",
|
||||
message="Explain quantum computing in simple terms",
|
||||
),
|
||||
cl.Starter(
|
||||
label="Help me learn a language",
|
||||
message="Teach me basic French phrases",
|
||||
),
|
||||
],
|
||||
),
|
||||
cl.StarterCategory(
|
||||
label="Productivity",
|
||||
icon="https://cdn-icons-png.flaticon.com/512/1055/1055646.png",
|
||||
starters=[
|
||||
cl.Starter(
|
||||
label="Summarize a topic",
|
||||
message="Summarize the key points of machine learning",
|
||||
),
|
||||
cl.Starter(
|
||||
label="Create a plan", message="Help me create a weekly study plan"
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@cl.on_message
|
||||
async def on_message(msg: cl.Message):
|
||||
await cl.Message(f"You said: {msg.content}").send()
|
||||
Reference in New Issue
Block a user