Update app.py
Browse files
app.py
CHANGED
|
@@ -199,6 +199,7 @@ 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 |
with gr.Blocks(css="""
|
| 203 |
.send-btn {
|
| 204 |
background-color: #25D366 !important;
|
|
@@ -211,72 +212,54 @@ with gr.Blocks(css="""
|
|
| 211 |
width: 60px;
|
| 212 |
margin-left: 8px;
|
| 213 |
cursor: pointer;
|
| 214 |
-
flex-shrink: 0 !important;
|
| 215 |
}
|
| 216 |
-
|
| 217 |
#chatbox .avatar-container {
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
}
|
| 231 |
-
|
| 232 |
#chatbox .message {
|
| 233 |
display: inline-block !important;
|
| 234 |
font-size: 16px !important;
|
| 235 |
-
line-height: 1.
|
| 236 |
-
min-width:
|
| 237 |
-
max-width:
|
| 238 |
-
padding:
|
| 239 |
-
border-radius:
|
| 240 |
word-break: break-word !important;
|
| 241 |
-
|
| 242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
}
|
| 244 |
-
|
| 245 |
#chatbox .message.user {
|
| 246 |
background-color: #DCF8C6 !important;
|
| 247 |
min-width: 60px !important; /* ✅ 至少能装下一个短单词 */
|
| 248 |
max-width: fit-content !important; /* ✅ 自动根据内容长度调整宽度 */
|
| 249 |
}
|
| 250 |
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
background-color: #FFFFFF !important;
|
| 257 |
}
|
| 258 |
-
|
| 259 |
-
/* ✅ 移除 Gradio 默认残留区域 */
|
| 260 |
-
footer,
|
| 261 |
-
.svelte-1ipelgc,
|
| 262 |
-
.icon-button-wrapper,
|
| 263 |
label.svelte-1to105q {
|
| 264 |
display: none !important;
|
| 265 |
}
|
| 266 |
-
|
| 267 |
-
/* ✅ 移动端优化 */
|
| 268 |
-
@media screen and (max-width: 768px) {
|
| 269 |
-
#chatbox .message {
|
| 270 |
-
font-size: 15px !important;
|
| 271 |
-
max-width: 94vw !important;
|
| 272 |
-
}
|
| 273 |
-
}
|
| 274 |
-
|
| 275 |
-
/* ✅ 防止全局横向滚动 */
|
| 276 |
-
html, body {
|
| 277 |
-
overflow-x: hidden !important;
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
""") as demo:
|
| 281 |
gr.HTML("""
|
| 282 |
<script>
|
|
|
|
| 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 |
width: 60px;
|
| 213 |
margin-left: 8px;
|
| 214 |
cursor: pointer;
|
|
|
|
| 215 |
}
|
|
|
|
| 216 |
#chatbox .avatar-container {
|
| 217 |
+
width: 54px !important;
|
| 218 |
+
height: 54px !important;
|
| 219 |
+
min-width: 54px !important;
|
| 220 |
+
min-height: 54px !important;
|
| 221 |
+
background-size: 100% 100% !important;
|
| 222 |
+
background-position: center center !important;
|
| 223 |
+
border-radius: 50% !important;
|
| 224 |
+
padding: 0 !important;
|
| 225 |
+
margin: 0 !important;
|
| 226 |
+
border: none !important;
|
| 227 |
+
box-shadow: none !important;
|
| 228 |
+
background-color: transparent !important;
|
| 229 |
}
|
| 230 |
+
#chatbox .message.user { background-color: #DCF8C6 !important; }
|
| 231 |
#chatbox .message {
|
| 232 |
display: inline-block !important;
|
| 233 |
font-size: 16px !important;
|
| 234 |
+
line-height: 1.3em !important;
|
| 235 |
+
min-width: 6ch !important;
|
| 236 |
+
max-width: 96% !important;
|
| 237 |
+
padding: 2px 3px !important;
|
| 238 |
+
border-radius: 8px !important;
|
| 239 |
word-break: break-word !important;
|
| 240 |
+
word-wrap: break-word !important;
|
| 241 |
+
white-space: normal !important;
|
| 242 |
+
}
|
| 243 |
+
@media screen and (max-width: 768px) {
|
| 244 |
+
#chatbox .message.user {
|
| 245 |
+
max-width: 90vw !important;
|
| 246 |
+
}
|
| 247 |
}
|
|
|
|
| 248 |
#chatbox .message.user {
|
| 249 |
background-color: #DCF8C6 !important;
|
| 250 |
min-width: 60px !important; /* ✅ 至少能装下一个短单词 */
|
| 251 |
max-width: fit-content !important; /* ✅ 自动根据内容长度调整宽度 */
|
| 252 |
}
|
| 253 |
|
| 254 |
+
#chatbox .message.assistant { background-color: #ffffff !important; }
|
| 255 |
+
footer { display: none !important; }
|
| 256 |
+
.svelte-1ipelgc { display: none !important; }
|
| 257 |
+
.icon-button-wrapper {
|
| 258 |
+
display: none !important;
|
|
|
|
| 259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
label.svelte-1to105q {
|
| 261 |
display: none !important;
|
| 262 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
""") as demo:
|
| 264 |
gr.HTML("""
|
| 265 |
<script>
|