Joshua Sundance Bailey
commited on
Commit
·
3d59c85
1
Parent(s):
fc0e831
anth bugfix & smoother dochat ux
Browse files
langchain-streamlit-demo/app.py
CHANGED
@@ -186,7 +186,7 @@ with sidebar:
|
|
186 |
|
187 |
document_chat = st.checkbox(
|
188 |
"Document Chat",
|
189 |
-
value=False,
|
190 |
help="Uploaded document will provide context for the chat.",
|
191 |
)
|
192 |
|
@@ -240,7 +240,6 @@ with sidebar:
|
|
240 |
],
|
241 |
index=0,
|
242 |
help=chain_type_help,
|
243 |
-
disabled=not document_chat,
|
244 |
)
|
245 |
use_azure = st.toggle(
|
246 |
label="Use Azure OpenAI",
|
@@ -375,9 +374,6 @@ st.session_state.llm = get_llm(
|
|
375 |
)
|
376 |
|
377 |
# --- Chat History ---
|
378 |
-
if len(STMEMORY.messages) == 0:
|
379 |
-
STMEMORY.add_ai_message("Hello! I'm a helpful AI chatbot. Ask me a question!")
|
380 |
-
|
381 |
for msg in STMEMORY.messages:
|
382 |
st.chat_message(
|
383 |
msg.type,
|
|
|
186 |
|
187 |
document_chat = st.checkbox(
|
188 |
"Document Chat",
|
189 |
+
value=True if uploaded_file else False,
|
190 |
help="Uploaded document will provide context for the chat.",
|
191 |
)
|
192 |
|
|
|
240 |
],
|
241 |
index=0,
|
242 |
help=chain_type_help,
|
|
|
243 |
)
|
244 |
use_azure = st.toggle(
|
245 |
label="Use Azure OpenAI",
|
|
|
374 |
)
|
375 |
|
376 |
# --- Chat History ---
|
|
|
|
|
|
|
377 |
for msg in STMEMORY.messages:
|
378 |
st.chat_message(
|
379 |
msg.type,
|