Update app.py
Browse files
app.py
CHANGED
|
@@ -199,7 +199,6 @@ async def respond(user_input, history, step, language, questions, followup_mode)
|
|
| 199 |
def init():
|
| 200 |
return [{"role": "assistant", "content": WELCOME_MESSAGE_EN}], 0, "", [], False
|
| 201 |
|
| 202 |
-
|
| 203 |
with gr.Blocks(css="""
|
| 204 |
.send-btn {
|
| 205 |
background-color: #25D366 !important;
|
|
@@ -212,44 +211,66 @@ with gr.Blocks(css="""
|
|
| 212 |
width: 60px;
|
| 213 |
margin-left: 8px;
|
| 214 |
cursor: pointer;
|
|
|
|
| 215 |
}
|
|
|
|
| 216 |
#chatbox .avatar-container {
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
}
|
| 230 |
-
|
|
|
|
| 231 |
#chatbox .message {
|
| 232 |
display: inline-block !important;
|
| 233 |
font-size: 16px !important;
|
| 234 |
-
line-height: 1.
|
| 235 |
-
min-width:
|
| 236 |
-
max-width:
|
| 237 |
-
padding:
|
| 238 |
-
border-radius:
|
| 239 |
word-break: break-word !important;
|
| 240 |
-
|
| 241 |
-
white-space: normal !important;
|
| 242 |
}
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
|
|
|
| 249 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
label.svelte-1to105q {
|
| 251 |
display: none !important;
|
| 252 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
""") as demo:
|
| 254 |
gr.HTML("""
|
| 255 |
<script>
|
|
|
|
| 199 |
def init():
|
| 200 |
return [{"role": "assistant", "content": WELCOME_MESSAGE_EN}], 0, "", [], False
|
| 201 |
|
|
|
|
| 202 |
with gr.Blocks(css="""
|
| 203 |
.send-btn {
|
| 204 |
background-color: #25D366 !important;
|
|
|
|
| 211 |
width: 60px;
|
| 212 |
margin-left: 8px;
|
| 213 |
cursor: pointer;
|
| 214 |
+
flex-shrink: 0 !important;
|
| 215 |
}
|
| 216 |
+
|
| 217 |
#chatbox .avatar-container {
|
| 218 |
+
width: 54px !important;
|
| 219 |
+
height: 54px !important;
|
| 220 |
+
min-width: 54px !important;
|
| 221 |
+
min-height: 54px !important;
|
| 222 |
+
background-size: cover !important;
|
| 223 |
+
background-position: center center !important;
|
| 224 |
+
border-radius: 50% !important;
|
| 225 |
+
padding: 0 !important;
|
| 226 |
+
margin: 0 !important;
|
| 227 |
+
border: none !important;
|
| 228 |
+
background-color: transparent !important;
|
| 229 |
+
box-shadow: none !important;
|
| 230 |
}
|
| 231 |
+
|
| 232 |
+
/* ✅ 聊天气泡核心控制样式 */
|
| 233 |
#chatbox .message {
|
| 234 |
display: inline-block !important;
|
| 235 |
font-size: 16px !important;
|
| 236 |
+
line-height: 1.4em !important;
|
| 237 |
+
min-width: 4ch !important;
|
| 238 |
+
max-width: 94% !important;
|
| 239 |
+
padding: 4px 6px !important;
|
| 240 |
+
border-radius: 10px !important;
|
| 241 |
word-break: break-word !important;
|
| 242 |
+
white-space: pre-wrap !important;
|
|
|
|
| 243 |
}
|
| 244 |
|
| 245 |
+
/* ✅ 气泡颜色样式 */
|
| 246 |
+
#chatbox .message.user {
|
| 247 |
+
background-color: #DCF8C6 !important;
|
| 248 |
+
}
|
| 249 |
+
#chatbox .message.assistant {
|
| 250 |
+
background-color: #FFFFFF !important;
|
| 251 |
}
|
| 252 |
+
|
| 253 |
+
/* ✅ 移除 Gradio 默认残留区域 */
|
| 254 |
+
footer,
|
| 255 |
+
.svelte-1ipelgc,
|
| 256 |
+
.icon-button-wrapper,
|
| 257 |
label.svelte-1to105q {
|
| 258 |
display: none !important;
|
| 259 |
}
|
| 260 |
+
|
| 261 |
+
/* ✅ 移动端优化 */
|
| 262 |
+
@media screen and (max-width: 768px) {
|
| 263 |
+
#chatbox .message {
|
| 264 |
+
font-size: 15px !important;
|
| 265 |
+
max-width: 94vw !important;
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
/* ✅ 防止全局横向滚动 */
|
| 270 |
+
html, body {
|
| 271 |
+
overflow-x: hidden !important;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
""") as demo:
|
| 275 |
gr.HTML("""
|
| 276 |
<script>
|