Little fix
Browse files- app.css +144 -12
- app.py +4 -24
- public/main.svg +1 -0
app.css
CHANGED
|
@@ -3,6 +3,10 @@
|
|
| 3 |
--layout-gap: 0 !important;
|
| 4 |
}
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
#main-row {
|
| 7 |
height: 100vh;
|
| 8 |
max-height: 1500px;
|
|
@@ -12,7 +16,7 @@
|
|
| 12 |
height: 100%;
|
| 13 |
display: flex;
|
| 14 |
flex-direction: column;
|
| 15 |
-
padding:
|
| 16 |
overflow: hidden;
|
| 17 |
}
|
| 18 |
|
|
@@ -22,8 +26,57 @@
|
|
| 22 |
border: 0;
|
| 23 |
}
|
| 24 |
|
| 25 |
-
.
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
#conversations-radio input[type="radio"] {
|
|
@@ -33,23 +86,77 @@
|
|
| 33 |
height: 0;
|
| 34 |
}
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
label span {
|
| 41 |
margin: 0;
|
| 42 |
}
|
| 43 |
|
| 44 |
-
|
| 45 |
-
display:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
|
|
|
|
| 48 |
#send-btn, #stop-btn {
|
| 49 |
font-size: 0;
|
| 50 |
height: 100%;
|
| 51 |
min-width: 40px;
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
|
|
|
| 53 |
#send-btn::after {
|
| 54 |
content: "";
|
| 55 |
display: inline-block;
|
|
@@ -58,6 +165,7 @@ label span {
|
|
| 58 |
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='22' y1='2' x2='11' y2='13'/%3E%3Cpolygon points='22 2 15 22 11 13 2 9 22 2'/%3E%3C/svg%3E") no-repeat center;
|
| 59 |
background-size: contain;
|
| 60 |
}
|
|
|
|
| 61 |
#stop-btn::after {
|
| 62 |
content: "";
|
| 63 |
display: inline-block;
|
|
@@ -67,10 +175,34 @@ label span {
|
|
| 67 |
background-size: contain;
|
| 68 |
}
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
--layout-gap: 0 !important;
|
| 4 |
}
|
| 5 |
|
| 6 |
+
html {
|
| 7 |
+
scroll-behavior: smooth;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
#main-row {
|
| 11 |
height: 100vh;
|
| 12 |
max-height: 1500px;
|
|
|
|
| 16 |
height: 100%;
|
| 17 |
display: flex;
|
| 18 |
flex-direction: column;
|
| 19 |
+
padding: 0;
|
| 20 |
overflow: hidden;
|
| 21 |
}
|
| 22 |
|
|
|
|
| 26 |
border: 0;
|
| 27 |
}
|
| 28 |
|
| 29 |
+
.sidebar {
|
| 30 |
+
border-right: 1px solid var(--border-color-primary);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.sidebar-parent:has(.sidebar.open:not(.right)) {
|
| 34 |
+
padding-left: 320px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.sidebar-content {
|
| 38 |
+
padding: 50px 0 0 0 !important;
|
| 39 |
+
background: url("data:image/svg+xml,%3Csvg width='300' height='42' viewBox='0 0 300 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 6H24V12H0V6ZM0 12H6V18H0V12ZM18 12H24V18H18V12ZM30 6H54V12H30V6ZM30 12H36V18H30V12ZM30 36H36V42H30V36ZM48 12H54V18H48V12ZM60 6H84V12H60V6ZM60 12H66V18H60V12ZM78 12H84V18H78V12ZM90 6H114V12H90V6ZM90 12H96V18H90V12ZM108 12H114V18H108V12ZM120 6H150V12H120V6ZM120 12H126V18H120V12ZM132 12H138V18H132V12ZM144 12H150V18H144V12ZM156 6H162V18H156V6ZM174 6H180V18H174V6ZM174 36H180V42H174V36ZM186 6H210V12H186V6ZM192 0H198V6H192V0ZM192 12H198V18H192V12ZM216 0H222V12H216V0ZM216 12H240V18H216V12ZM246 6H270V12H246V6ZM246 12H252V18H246V12ZM264 12H270V18H264V12ZM276 6H300V12H276V6ZM276 12H282V18H276V12Z' fill='%23F1ECEC'/%3E%3Cpath d='M0 18H6V30H0V18ZM0 30H24V36H0V30ZM18 18H24V30H18V18ZM30 18H36V30H30V18ZM30 30H54V36H30V30ZM48 18H54V30H48V18ZM60 18H84V24H60V18ZM60 24H66V30H60V24ZM60 30H84V36H60V30ZM90 18H96V36H90V18ZM108 18H114V36H108V18ZM120 18H126V36H120V18ZM132 18H138V24H132V18ZM144 18H150V36H144V18ZM156 18H162V24H156V18ZM156 24H180V30H156V24ZM174 18H180V24H174V18ZM174 30H180V36H174V30ZM192 18H198V30H192V18ZM192 30H204V36H192V30ZM216 18H222V36H216V18ZM234 18H240V36H234V18ZM246 18H252V30H246V18ZM246 30H270V36H246V30ZM264 18H270V30H264V18ZM276 18H300V24H276V18ZM276 30H300V36H276V30ZM294 24H300V30H294V24Z' fill='%23B7B1B1'/%3E%3C/svg%3E") no-repeat top;
|
| 40 |
+
background-size: 180px 52px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.toggle-button {
|
| 44 |
+
top: 10px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/* New Conversation button - top spacing */
|
| 48 |
+
.sidebar > :first-child {
|
| 49 |
+
margin-bottom: 8px;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Sidebar buttons (New/Del) */
|
| 53 |
+
#main-row .sidebar button {
|
| 54 |
+
transition: all 0.15s ease;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
#main-row .sidebar button:hover {
|
| 58 |
+
transform: translateY(-1px);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.sidebar-content .form {
|
| 62 |
+
border: 0;
|
| 63 |
+
background: transparent;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.wrap {
|
| 67 |
+
gap: 0;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/* Conversation items — card-style list */
|
| 71 |
+
#conversations-radio {
|
| 72 |
+
padding: 0;
|
| 73 |
+
border: 0;
|
| 74 |
+
background: transparent;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
#conversations-radio > div:last-child {
|
| 78 |
+
display: grid;
|
| 79 |
+
gap: 2px;
|
| 80 |
}
|
| 81 |
|
| 82 |
#conversations-radio input[type="radio"] {
|
|
|
|
| 86 |
height: 0;
|
| 87 |
}
|
| 88 |
|
| 89 |
+
#conversations-radio span[data-testid="block-info"] {
|
| 90 |
+
display: none;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
#conversations-radio label {
|
| 94 |
+
padding: 10px 14px;
|
| 95 |
+
margin: 0;
|
| 96 |
+
cursor: pointer;
|
| 97 |
+
display: flex;
|
| 98 |
+
align-items: center;
|
| 99 |
+
transition: all 0.2s ease;
|
| 100 |
+
overflow: hidden;
|
| 101 |
+
text-overflow: ellipsis;
|
| 102 |
+
white-space: nowrap;
|
| 103 |
+
background: transparent;
|
| 104 |
+
color: var(--button-primary-text-color);
|
| 105 |
+
border-bottom: 1px solid var(--border-color-primary);
|
| 106 |
}
|
| 107 |
|
| 108 |
label span {
|
| 109 |
margin: 0;
|
| 110 |
}
|
| 111 |
|
| 112 |
+
.icon-button-wrapper {
|
| 113 |
+
display: hidden;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/* --- Chat Message Animations --- */
|
| 117 |
+
@keyframes messageSlideIn {
|
| 118 |
+
from {
|
| 119 |
+
opacity: 0;
|
| 120 |
+
transform: translateY(16px);
|
| 121 |
+
}
|
| 122 |
+
to {
|
| 123 |
+
opacity: 1;
|
| 124 |
+
transform: translateY(0);
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
/* Animate new messages as they appear */
|
| 129 |
+
#chatbot [data-testid="bot"],
|
| 130 |
+
#chatbot [data-testid="user"],
|
| 131 |
+
#chatbot [class*="message"] {
|
| 132 |
+
animation: messageSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/* --- Input Area — Docked Bottom --- */
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
/* Style the textbox wrapper to look like ChatGPT's input container */
|
| 139 |
+
#input-row .form {
|
| 140 |
+
box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
|
| 141 |
+
transition: box-shadow 0.2s ease, border-color 0.2s ease !important;
|
| 142 |
+
border: 1px solid var(--border-color-primary) !important;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
#input-row .form:focus-within {
|
| 146 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
|
| 147 |
+
border-color: var(--neutral-400) !important;
|
| 148 |
}
|
| 149 |
|
| 150 |
+
/* --- Send / Stop Button Micro-animations --- */
|
| 151 |
#send-btn, #stop-btn {
|
| 152 |
font-size: 0;
|
| 153 |
height: 100%;
|
| 154 |
min-width: 40px;
|
| 155 |
+
transition: transform 0.15s ease, opacity 0.15s ease;
|
| 156 |
+
cursor: pointer;
|
| 157 |
+
padding: 0;
|
| 158 |
}
|
| 159 |
+
|
| 160 |
#send-btn::after {
|
| 161 |
content: "";
|
| 162 |
display: inline-block;
|
|
|
|
| 165 |
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='22' y1='2' x2='11' y2='13'/%3E%3Cpolygon points='22 2 15 22 11 13 2 9 22 2'/%3E%3C/svg%3E") no-repeat center;
|
| 166 |
background-size: contain;
|
| 167 |
}
|
| 168 |
+
|
| 169 |
#stop-btn::after {
|
| 170 |
content: "";
|
| 171 |
display: inline-block;
|
|
|
|
| 175 |
background-size: contain;
|
| 176 |
}
|
| 177 |
|
| 178 |
+
/* --- Custom Scrollbars --- */
|
| 179 |
+
#chatbot::-webkit-scrollbar {
|
| 180 |
+
width: 6px;
|
| 181 |
}
|
| 182 |
|
| 183 |
+
#chatbot::-webkit-scrollbar-track {
|
| 184 |
+
background: transparent;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
#chatbot::-webkit-scrollbar-thumb {
|
| 188 |
+
background: var(--border-color-primary);
|
| 189 |
+
transition: background 0.2s ease;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
#chatbot::-webkit-scrollbar-thumb:hover {
|
| 193 |
+
background: var(--neutral-400);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/* Sidebar scrollbar — thinner, subtle */
|
| 197 |
+
.sidebar::-webkit-scrollbar {
|
| 198 |
+
width: 4px;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.sidebar::-webkit-scrollbar-track {
|
| 202 |
+
background: transparent;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
.sidebar::-webkit-scrollbar-thumb {
|
| 206 |
+
background: var(--border-color-primary);
|
| 207 |
+
border-radius: 2px;
|
| 208 |
+
}
|
app.py
CHANGED
|
@@ -55,7 +55,7 @@ JS_SAVE_STATE = """(stateJson) => {
|
|
| 55 |
}
|
| 56 |
|
| 57 |
localStorage.setItem("titles", JSON.stringify(titles));
|
| 58 |
-
return stateJson;
|
| 59 |
}"""
|
| 60 |
|
| 61 |
|
|
@@ -233,14 +233,6 @@ class GradioEvents:
|
|
| 233 |
gr.update(value=state_value),
|
| 234 |
)
|
| 235 |
|
| 236 |
-
@staticmethod
|
| 237 |
-
def clear_history(state_value):
|
| 238 |
-
if not state_value.get("conversation_id"):
|
| 239 |
-
return gr.skip()
|
| 240 |
-
state_value["conversation_contexts"][
|
| 241 |
-
state_value["conversation_id"]]["history"] = []
|
| 242 |
-
return gr.update(value=[]), gr.update(value=state_value)
|
| 243 |
-
|
| 244 |
@staticmethod
|
| 245 |
def cancel_stream(state_value):
|
| 246 |
"""Mark the current assistant message as cancelled."""
|
|
@@ -298,23 +290,17 @@ with gr.Blocks(fill_width=True, title="Demo Chat") as demo:
|
|
| 298 |
)
|
| 299 |
conv_choice = gr.Radio(
|
| 300 |
choices=[],
|
| 301 |
-
label=
|
| 302 |
interactive=True,
|
| 303 |
elem_id="conversations-radio",
|
| 304 |
)
|
| 305 |
delete_btn = gr.Button(
|
| 306 |
value="Delete Selected",
|
| 307 |
variant="stop",
|
|
|
|
| 308 |
)
|
| 309 |
|
| 310 |
with gr.Column(elem_id="chat-column"):
|
| 311 |
-
with gr.Row():
|
| 312 |
-
clear_btn = gr.Button(
|
| 313 |
-
value="Clear History",
|
| 314 |
-
scale=0,
|
| 315 |
-
min_width=120,
|
| 316 |
-
visible=False,
|
| 317 |
-
)
|
| 318 |
|
| 319 |
chatbot = gr.Chatbot(
|
| 320 |
elem_id="chatbot",
|
|
@@ -322,7 +308,7 @@ with gr.Blocks(fill_width=True, title="Demo Chat") as demo:
|
|
| 322 |
buttons=[],
|
| 323 |
layout="bubble"
|
| 324 |
)
|
| 325 |
-
with gr.Row():
|
| 326 |
msg = gr.Textbox(
|
| 327 |
placeholder="Type a message and press Enter...",
|
| 328 |
show_label=False,
|
|
@@ -363,12 +349,6 @@ with gr.Blocks(fill_width=True, title="Demo Chat") as demo:
|
|
| 363 |
outputs=[conv_choice, chatbot, state],
|
| 364 |
)
|
| 365 |
|
| 366 |
-
clear_btn.click(
|
| 367 |
-
fn=GradioEvents.clear_history,
|
| 368 |
-
inputs=[state],
|
| 369 |
-
outputs=[chatbot, state],
|
| 370 |
-
)
|
| 371 |
-
|
| 372 |
submit_event = send_btn.click(
|
| 373 |
fn=GradioEvents.stream_response,
|
| 374 |
inputs=[msg, state],
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
localStorage.setItem("titles", JSON.stringify(titles));
|
| 58 |
+
return stateJson;
|
| 59 |
}"""
|
| 60 |
|
| 61 |
|
|
|
|
| 233 |
gr.update(value=state_value),
|
| 234 |
)
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
@staticmethod
|
| 237 |
def cancel_stream(state_value):
|
| 238 |
"""Mark the current assistant message as cancelled."""
|
|
|
|
| 290 |
)
|
| 291 |
conv_choice = gr.Radio(
|
| 292 |
choices=[],
|
| 293 |
+
label=None,
|
| 294 |
interactive=True,
|
| 295 |
elem_id="conversations-radio",
|
| 296 |
)
|
| 297 |
delete_btn = gr.Button(
|
| 298 |
value="Delete Selected",
|
| 299 |
variant="stop",
|
| 300 |
+
visible=False
|
| 301 |
)
|
| 302 |
|
| 303 |
with gr.Column(elem_id="chat-column"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
|
| 305 |
chatbot = gr.Chatbot(
|
| 306 |
elem_id="chatbot",
|
|
|
|
| 308 |
buttons=[],
|
| 309 |
layout="bubble"
|
| 310 |
)
|
| 311 |
+
with gr.Row(elem_id="input-row"):
|
| 312 |
msg = gr.Textbox(
|
| 313 |
placeholder="Type a message and press Enter...",
|
| 314 |
show_label=False,
|
|
|
|
| 349 |
outputs=[conv_choice, chatbot, state],
|
| 350 |
)
|
| 351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
submit_event = send_btn.click(
|
| 353 |
fn=GradioEvents.stream_response,
|
| 354 |
inputs=[msg, state],
|
public/main.svg
ADDED
|
|