Joshua Sundance Bailey commited on
Commit ·
db5e26f
1
Parent(s): 70f15b7
cleanup
Browse files- README.md +1 -1
- langchain-streamlit-demo/app.py +1 -13
README.md
CHANGED
|
@@ -56,7 +56,7 @@ This `README` was written by [Claude 2](https://www.anthropic.com/index/claude-2
|
|
| 56 |
|
| 57 |
## Docker Compose
|
| 58 |
1. Clone the repo. Navigate to cloned repo directory.
|
| 59 |
-
2. Run in terminal: `docker
|
| 60 |
3. Then open http://localhost:7860 in your browser.
|
| 61 |
|
| 62 |
# Configuration
|
|
|
|
| 56 |
|
| 57 |
## Docker Compose
|
| 58 |
1. Clone the repo. Navigate to cloned repo directory.
|
| 59 |
+
2. Run in terminal: `docker compose up`
|
| 60 |
3. Then open http://localhost:7860 in your browser.
|
| 61 |
|
| 62 |
# Configuration
|
langchain-streamlit-demo/app.py
CHANGED
|
@@ -107,20 +107,8 @@ if provider_api_key := st.sidebar.text_input(f"{provider} API key", type="passwo
|
|
| 107 |
st.session_state.trace_link = None
|
| 108 |
st.session_state.run_id = None
|
| 109 |
|
| 110 |
-
# Display chat messages from history on app rerun
|
| 111 |
-
# NOTE: This won't be necessary for Streamlit 1.26+, you can just pass the type directly
|
| 112 |
-
# https://github.com/streamlit/streamlit/pull/7094
|
| 113 |
-
def _get_openai_type(msg):
|
| 114 |
-
if msg.type == "human":
|
| 115 |
-
return "user"
|
| 116 |
-
if msg.type == "ai":
|
| 117 |
-
return "assistant"
|
| 118 |
-
return msg.role if msg.type == "chat" else msg.type
|
| 119 |
-
|
| 120 |
for msg in st.session_state.langchain_messages:
|
| 121 |
-
|
| 122 |
-
avatar = "🦜" if streamlit_type == "assistant" else None
|
| 123 |
-
with st.chat_message(streamlit_type, avatar=avatar):
|
| 124 |
st.markdown(msg.content)
|
| 125 |
|
| 126 |
if client and st.session_state.trace_link:
|
|
|
|
| 107 |
st.session_state.trace_link = None
|
| 108 |
st.session_state.run_id = None
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
for msg in st.session_state.langchain_messages:
|
| 111 |
+
with st.chat_message(msg.type, avatar="🦜" if msg.type == "assistant" else None):
|
|
|
|
|
|
|
| 112 |
st.markdown(msg.content)
|
| 113 |
|
| 114 |
if client and st.session_state.trace_link:
|