first push
This commit is contained in:
25
backend/chainlit_app.py
Normal file
25
backend/chainlit_app.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user