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
19 lines
529 B
Python
19 lines
529 B
Python
import chainlit as cl
|
|
|
|
|
|
@cl.on_chat_start
|
|
async def on_chat_start():
|
|
await cl.Message(content="Hi from copilot!").send()
|
|
|
|
|
|
@cl.on_message
|
|
async def on_message(msg: cl.Message):
|
|
if cl.context.session.client_type == "copilot":
|
|
if msg.type == "system_message":
|
|
await cl.Message(content=f"System message received: {msg.content}").send()
|
|
return
|
|
|
|
fn = cl.CopilotFunction(name="test", args={"msg": msg.content})
|
|
res = await fn.acall()
|
|
await cl.Message(content=res).send()
|