Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,23 @@ DEFAULT_PIPELINE = os.environ.get("PIPELINE_ID", "")
|
|
| 9 |
st.set_page_config(page_title="LlamaIndex Cloud Chat", page_icon="💬")
|
| 10 |
st.title("💬 Chat with Your LlamaIndex Cloud Dataset")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
with st.sidebar:
|
| 13 |
st.markdown("### Settings")
|
| 14 |
pipeline_id = st.text_input("Pipeline ID", value=DEFAULT_PIPELINE, help="Find this in cloud.llamaindex.ai")
|
|
|
|
| 9 |
st.set_page_config(page_title="LlamaIndex Cloud Chat", page_icon="💬")
|
| 10 |
st.title("💬 Chat with Your LlamaIndex Cloud Dataset")
|
| 11 |
|
| 12 |
+
with st.sidebar:
|
| 13 |
+
ok_key = "✅" if LLAMA_KEY else "❌"
|
| 14 |
+
ok_pipe = "✅" if DEFAULT_PIPELINE else "❌"
|
| 15 |
+
st.markdown(f"**LlamaCloud Key:** {ok_key}")
|
| 16 |
+
st.markdown(f"**Default Pipeline ID:** {ok_pipe}")
|
| 17 |
+
if st.button("Health check"):
|
| 18 |
+
try:
|
| 19 |
+
r = requests.post(
|
| 20 |
+
f"{API_BASE}/{(DEFAULT_PIPELINE or pipeline_id)}/chat",
|
| 21 |
+
headers={"Authorization": f"Bearer {LLAMA_KEY}", "Content-Type": "application/json"},
|
| 22 |
+
json={"messages": [{"role":"user","content":"ping"}]},
|
| 23 |
+
timeout=30,
|
| 24 |
+
)
|
| 25 |
+
st.success(f"OK {r.status_code}")
|
| 26 |
+
except Exception as e:
|
| 27 |
+
st.error(f"Failed: {e}")
|
| 28 |
+
|
| 29 |
with st.sidebar:
|
| 30 |
st.markdown("### Settings")
|
| 31 |
pipeline_id = st.text_input("Pipeline ID", value=DEFAULT_PIPELINE, help="Find this in cloud.llamaindex.ai")
|