25 lines
635 B
Python
25 lines
635 B
Python
import chainlit as cl
|
|
import httpx
|
|
import json
|
|
|
|
|
|
@cl.on_chat_start
|
|
async def on_chat_start():
|
|
await cl.Message(
|
|
content="Bonjour 👋 Je suis ARC. Décris-moi ton besoin logiciel."
|
|
).send()
|
|
|
|
|
|
@cl.on_message
|
|
async def on_message(message: cl.Message):
|
|
async with httpx.AsyncClient() as client:
|
|
response = await client.post(
|
|
"http://127.0.0.1:8000/api/workflow/run",
|
|
json={"user_input": message.content},
|
|
)
|
|
|
|
result = response.json()
|
|
|
|
await cl.Message(
|
|
content=f"Résultat workflow :\n```json\n{json.dumps(result, indent=2, ensure_ascii=False)}\n```"
|
|
).send() |