Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1385,7 +1385,7 @@ def _chat_fragment():
|
|
| 1385 |
|
| 1386 |
with st.chat_message("assistant"):
|
| 1387 |
container = st.empty()
|
| 1388 |
-
|
| 1389 |
|
| 1390 |
# 联网模式:大模型 + 网络搜索,不查知识库
|
| 1391 |
# 知识库模式:RAG 检索本地知识库
|
|
@@ -1403,8 +1403,8 @@ def _chat_fragment():
|
|
| 1403 |
llm_answer(q, relevant_docs, _model_name, _web_on)
|
| 1404 |
)
|
| 1405 |
meta_info = st.session_state.get("last_meta", "")
|
| 1406 |
-
if meta_info:
|
| 1407 |
-
|
| 1408 |
st.session_state.messages.append(
|
| 1409 |
{"role": "assistant", "content": full_response, "meta": meta_info}
|
| 1410 |
)
|
|
|
|
| 1385 |
|
| 1386 |
with st.chat_message("assistant"):
|
| 1387 |
container = st.empty()
|
| 1388 |
+
meta_placeholder = st.empty() # 用empty占位,避免提前渲染
|
| 1389 |
|
| 1390 |
# 联网模式:大模型 + 网络搜索,不查知识库
|
| 1391 |
# 知识库模式:RAG 检索本地知识库
|
|
|
|
| 1403 |
llm_answer(q, relevant_docs, _model_name, _web_on)
|
| 1404 |
)
|
| 1405 |
meta_info = st.session_state.get("last_meta", "")
|
| 1406 |
+
if meta_info:
|
| 1407 |
+
meta_placeholder.caption(meta_info) # 流式完成后才显示meta
|
| 1408 |
st.session_state.messages.append(
|
| 1409 |
{"role": "assistant", "content": full_response, "meta": meta_info}
|
| 1410 |
)
|