b7f52be4c9
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
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import chainlit as cl
|
|
|
|
|
|
@cl.on_chat_start
|
|
async def on_start():
|
|
element = cl.CustomElement(
|
|
name="JiraTicket",
|
|
props={
|
|
"timeout": 20,
|
|
"fields": [
|
|
{"id": "summary", "label": "Summary", "type": "text", "required": True},
|
|
{"id": "description", "label": "Description", "type": "textarea"},
|
|
{
|
|
"id": "due",
|
|
"label": "Due Date",
|
|
"type": "date",
|
|
},
|
|
{
|
|
"id": "priority",
|
|
"label": "Priority",
|
|
"type": "select",
|
|
"options": ["Low", "Medium", "High"],
|
|
"value": "Medium",
|
|
"required": True,
|
|
},
|
|
],
|
|
},
|
|
)
|
|
res = await cl.AskElementMessage(
|
|
content="Create a new Jira ticket:", element=element, timeout=10
|
|
).send()
|
|
if res and res.get("submitted"):
|
|
await cl.Message(
|
|
content=f"Ticket '{res['summary']}' with priority {res['priority']} submitted"
|
|
).send()
|