AlauStone commited on
Commit
e47876e
·
verified ·
1 Parent(s): 715a454

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -46,6 +46,21 @@ def inject_custom_css():
46
  content: "选择文件";
47
  font-size: 14px !important;
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  </style>
50
  """, unsafe_allow_html=True)
51
 
@@ -1166,9 +1181,9 @@ def _chat_fragment():
1166
  q = st.chat_input("输入问题...", key="chat_input_v3")
1167
 
1168
  with chat_box:
1169
- welcome_placeholder = st.empty()
1170
  if not st.session_state.messages:
1171
- welcome_placeholder.markdown(
 
1172
  """
1173
  <div style="display:flex; align-items:center; justify-content:center; height:420px;">
1174
  <div style="text-align:center; color:#888;">
@@ -1183,6 +1198,8 @@ def _chat_fragment():
1183
  """,
1184
  unsafe_allow_html=True,
1185
  )
 
 
1186
 
1187
  for m in st.session_state.messages:
1188
  with st.chat_message(m["role"]):
@@ -1191,7 +1208,8 @@ def _chat_fragment():
1191
  st.caption(m["meta"])
1192
 
1193
  if q:
1194
- welcome_placeholder.empty()
 
1195
  st.session_state.messages.append({"role": "user", "content": q})
1196
  _save_chat_message(CURRENT_USER, "user", q)
1197
  with st.chat_message("user"):
 
46
  content: "选择文件";
47
  font-size: 14px !important;
48
  }
49
+
50
+ /* 右上角三点菜单:隐藏 Deploy 等无用项,保留设置 */
51
+ [data-testid="stMainMenu"] { visibility: visible !important; }
52
+ /* 移动端:侧边栏收起按钮美化 */
53
+ [data-testid="stSidebarCollapsedControl"] {
54
+ top: 0.4rem !important;
55
+ left: 0.3rem !important;
56
+ }
57
+ /* 顶部工具栏减少空白 */
58
+ [data-testid="stHeader"] {
59
+ height: 2.5rem !important;
60
+ background: transparent !important;
61
+ }
62
+ /* 减少标题上方空白 */
63
+ .block-container { padding-top: 1.5rem !important; }
64
  </style>
65
  """, unsafe_allow_html=True)
66
 
 
1181
  q = st.chat_input("输入问题...", key="chat_input_v3")
1182
 
1183
  with chat_box:
 
1184
  if not st.session_state.messages:
1185
+ _welcome = st.empty()
1186
+ _welcome.markdown(
1187
  """
1188
  <div style="display:flex; align-items:center; justify-content:center; height:420px;">
1189
  <div style="text-align:center; color:#888;">
 
1198
  """,
1199
  unsafe_allow_html=True,
1200
  )
1201
+ else:
1202
+ _welcome = None
1203
 
1204
  for m in st.session_state.messages:
1205
  with st.chat_message(m["role"]):
 
1208
  st.caption(m["meta"])
1209
 
1210
  if q:
1211
+ if _welcome is not None:
1212
+ _welcome.empty()
1213
  st.session_state.messages.append({"role": "user", "content": q})
1214
  _save_chat_message(CURRENT_USER, "user", q)
1215
  with st.chat_message("user"):