Spaces:
Running
Running
File size: 2,986 Bytes
7c10fc9 e48ff6a 7c10fc9 e48ff6a 7c10fc9 e48ff6a 7c10fc9 e48ff6a 7c10fc9 e48ff6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
from dash import html, dcc
import dash_mantine_components as dmc
from dash_iconify import DashIconify
styleUSERIA = {
"textAlign": "right",
"marginBottom" : "5px"
}
def create_chatbot_panel():
return dmc.Drawer(
id="chatbot-drawer",
title="AI Chatbot",
padding="md",
size="40%",
position="right",
zIndex=10000,
opened=False, # Explicitly set to closed for initial load
children=[
html.Div(
[
# Chat history
dmc.Paper(
p="md",
shadow="xs",
style={"height": "calc(100vh - 250px)", "overflowY": "auto"},
children=[
# Chat messages will go here
dcc.Store(id="store-conversation", data=""),
dcc.Loading(html.Div(id="loading-component", style={"margin-top":"10%","z-index":"100"}),type="default"),
html.Div(
html.Div(id="display-conversation"),
style={
"overflow-y": "auto",
"display": "flex",
"flex-direction": "column-reverse",
},
)
],
),
# Chat controls
dmc.Group(
justify="flex-end",
mt="sm",
children=[
dmc.Tooltip(
label="Nouveau Chat",
children=[dmc.ActionIcon(DashIconify(icon="material-symbols:add"), variant="outline")],
),
dmc.Tooltip(
label="Relancer",
children=[dmc.ActionIcon(DashIconify(icon="material-symbols:refresh"), variant="outline")],
),
],
),
# Chat input
dmc.Textarea(
id="user-input",
placeholder="Envoyer un message...",
autosize=True,
minRows=2,
maxRows=5,
rightSection=dmc.ActionIcon(
DashIconify(icon="material-symbols:send-outline"),
variant="filled",
color="blue",
id="submit",
style={"cursor": "pointer"},
),
mt="md",
),
]
)
],
) |