Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -83,6 +83,19 @@ st.markdown("""
|
|
83 |
align-items: center;
|
84 |
gap: 10px;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
</style>
|
87 |
""", unsafe_allow_html=True)
|
88 |
|
@@ -90,29 +103,33 @@ st.markdown("""
|
|
90 |
if "chat" not in st.session_state:
|
91 |
st.session_state.chat = model.start_chat(history=[])
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# Afficher l'historique des messages
|
94 |
for message in st.session_state.chat.history:
|
95 |
-
with
|
96 |
st.markdown(message.parts[0].text)
|
97 |
if len(message.parts) > 1:
|
98 |
for part in message.parts[1:]:
|
99 |
if hasattr(part, 'image'):
|
100 |
st.image(part.image)
|
101 |
|
102 |
-
#
|
103 |
-
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
prompt = st.chat_input("Que puis-je faire pour vous ?")
|
110 |
-
|
111 |
-
with col2:
|
112 |
-
# Upload unique pour tous les types de fichiers
|
113 |
-
uploaded_files = st.file_uploader("📁",
|
114 |
-
type=["txt","mp4","mp3","pdf", "jpg", "jpeg", "png", "gif"],
|
115 |
-
accept_multiple_files=True)
|
116 |
|
117 |
if prompt:
|
118 |
content = [prompt]
|
|
|
83 |
align-items: center;
|
84 |
gap: 10px;
|
85 |
}
|
86 |
+
.fixed-input {
|
87 |
+
position: fixed;
|
88 |
+
bottom: 0;
|
89 |
+
left: 0;
|
90 |
+
right: 0;
|
91 |
+
z-index: 1000;
|
92 |
+
background-color: white;
|
93 |
+
padding: 10px;
|
94 |
+
box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
|
95 |
+
}
|
96 |
+
.main-content {
|
97 |
+
margin-bottom: 80px; /* Pour laisser de l'espace pour l'input fixe */
|
98 |
+
}
|
99 |
</style>
|
100 |
""", unsafe_allow_html=True)
|
101 |
|
|
|
103 |
if "chat" not in st.session_state:
|
104 |
st.session_state.chat = model.start_chat(history=[])
|
105 |
|
106 |
+
# Conteneur principal avec marge en bas
|
107 |
+
main_container = st.container()
|
108 |
+
main_container.markdown('<div class="main-content">', unsafe_allow_html=True)
|
109 |
+
|
110 |
+
# Zone d'upload en haut
|
111 |
+
upload_container = st.container()
|
112 |
+
with upload_container:
|
113 |
+
uploaded_files = st.file_uploader("📁",
|
114 |
+
type=["txt","mp4","mp3","pdf", "jpg", "jpeg", "png", "gif"],
|
115 |
+
accept_multiple_files=True)
|
116 |
+
|
117 |
# Afficher l'historique des messages
|
118 |
for message in st.session_state.chat.history:
|
119 |
+
with main_container.chat_message(role_to_streamlit(message.role)):
|
120 |
st.markdown(message.parts[0].text)
|
121 |
if len(message.parts) > 1:
|
122 |
for part in message.parts[1:]:
|
123 |
if hasattr(part, 'image'):
|
124 |
st.image(part.image)
|
125 |
|
126 |
+
# Fermer le div de marge
|
127 |
+
main_container.markdown('</div>', unsafe_allow_html=True)
|
128 |
|
129 |
+
# Input fixé en bas
|
130 |
+
st.markdown('<div class="fixed-input">', unsafe_allow_html=True)
|
131 |
+
prompt = st.chat_input("Que puis-je faire pour vous ?")
|
132 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
if prompt:
|
135 |
content = [prompt]
|