AlauStone commited on
Commit
e8d7628
·
verified ·
1 Parent(s): 47f951a

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -38
app.py CHANGED
@@ -152,13 +152,11 @@ def inject_custom_css():
152
 
153
  inject_custom_css()
154
 
155
- # 标题(固定在顶部)- 游客提示只在有消息时显示,避免和欢迎页重复
156
  _is_guest_init = not st.session_state.get("current_user")
157
- _has_messages = bool(st.session_state.get("messages"))
158
- # 只有游客且有消息时才显示顶部简略提示
159
  _guest_tip = """<div style="text-align:center; padding:4px 0; color:#666; font-size:13px;">
160
  🙋 当前为<b>游客模式</b>,可直接提问体验 | 登录后解锁全部功能
161
- </div>""" if (_is_guest_init and _has_messages) else ""
162
 
163
  st.markdown(
164
  f"""
@@ -1324,41 +1322,20 @@ elif st.session_state.get("_chat_cleared"):
1324
  # 欢迎页占位(有消息时隐藏)
1325
  _welcome_hero = st.empty()
1326
  if not st.session_state.messages:
1327
- # 无消息时显示欢迎页(此时顶部不显示游客提示,所以padding可以少一些
1328
- if IS_GUEST:
1329
- # 游客:带游客提示的欢迎页
1330
- _welcome_hero.markdown(
1331
- """
1332
- <div style="text-align:center; color:#888; padding-top:50px;">
1333
- <div style="font-size:48px; margin-bottom:12px;">🤖</div>
1334
- <div style="font-size:18px; font-weight:600; margin-bottom:8px;">欢迎使用智答 AI 助手</div>
1335
- <div style="font-size:14px; line-height:1.8;">
1336
- 🌐 <b>联网模式</b> —— 大模型 + 网络搜索,实时回答<br>
1337
- 📚 <b>知识库模式</b> —— 上传文档,基于私有知识回答
1338
- </div>
1339
- <div style="margin-top:14px; font-size:13px; color:#999;">
1340
- 🙋 当前为<b>游客模式</b>,可直接在下方提问体验<br>
1341
- <span style="font-size:12px; color:#aaa;">登录后可解锁全部模型、知识库管理和聊天记录保存</span>
1342
- </div>
1343
- </div>
1344
- """,
1345
- unsafe_allow_html=True,
1346
- )
1347
- else:
1348
- # 登录用户:不带游客提示的欢迎页
1349
- _welcome_hero.markdown(
1350
- """
1351
- <div style="text-align:center; color:#888; padding-top:50px;">
1352
- <div style="font-size:48px; margin-bottom:12px;">🤖</div>
1353
- <div style="font-size:18px; font-weight:600; margin-bottom:8px;">欢迎使用智答 AI 助手</div>
1354
- <div style="font-size:14px; line-height:1.8;">
1355
- 🌐 <b>联网模式</b> —— 大模型 + 网络搜索,实时回答<br>
1356
- 📚 <b>知识库模式</b> —— 上传文档,基于私有知识回答
1357
- </div>
1358
  </div>
1359
- """,
1360
- unsafe_allow_html=True,
1361
- )
 
1362
 
1363
 
1364
  @st.fragment
 
152
 
153
  inject_custom_css()
154
 
155
+ # 标题(固定在顶部)- 游客始终显示提示
156
  _is_guest_init = not st.session_state.get("current_user")
 
 
157
  _guest_tip = """<div style="text-align:center; padding:4px 0; color:#666; font-size:13px;">
158
  🙋 当前为<b>游客模式</b>,可直接提问体验 | 登录后解锁全部功能
159
+ </div>""" if _is_guest_init else ""
160
 
161
  st.markdown(
162
  f"""
 
1322
  # 欢迎页占位(有消息时隐藏)
1323
  _welcome_hero = st.empty()
1324
  if not st.session_state.messages:
1325
+ # 无消息时显示欢迎页(游客提示已在顶部显示这里不重复
1326
+ _welcome_hero.markdown(
1327
+ """
1328
+ <div style="text-align:center; color:#888; padding-top:50px;">
1329
+ <div style="font-size:48px; margin-bottom:12px;">🤖</div>
1330
+ <div style="font-size:18px; font-weight:600; margin-bottom:8px;">欢迎使用智答 AI 助手</div>
1331
+ <div style="font-size:14px; line-height:1.8;">
1332
+ 🌐 <b>联网模式</b> —— 大模型 + 网络搜索,实时回答<br>
1333
+ 📚 <b>知识库模式</b> —— 上传文档,基于私有知识回答
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1334
  </div>
1335
+ </div>
1336
+ """,
1337
+ unsafe_allow_html=True,
1338
+ )
1339
 
1340
 
1341
  @st.fragment