Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,76 +1,19 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
-
from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool
|
| 4 |
-
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage
|
| 5 |
-
from datetime import datetime
|
| 6 |
|
| 7 |
-
# ---
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
DATA_DIR = "./ingested_core" # Target for Termux harvest
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
documents = SimpleDirectoryReader(DATA_DIR).load_data()
|
| 22 |
-
index = VectorStoreIndex.from_documents(documents)
|
| 23 |
-
index.storage_context.persist(persist_dir=INDEX_DIR)
|
| 24 |
-
else:
|
| 25 |
-
storage_context = StorageContext.from_defaults(persist_dir=INDEX_DIR)
|
| 26 |
-
index = load_index_from_storage(storage_context)
|
| 27 |
-
return index
|
| 28 |
-
return None
|
| 29 |
-
|
| 30 |
-
citadel_memory = initialize_memory()
|
| 31 |
-
|
| 32 |
-
# --- 3. COMMAND INTERFACE (The HUD) ---
|
| 33 |
-
st.title("π§ TIA-ARCHITECT-CORE: SOVEREIGN ORACLE")
|
| 34 |
-
st.subheader("777.1122 Alignment | Q.G.T.N.L. Citadel Mesh")
|
| 35 |
-
|
| 36 |
-
with st.sidebar:
|
| 37 |
-
st.success("π’ NODE ONLINE")
|
| 38 |
-
st.info(f"Substrate: Forever_Learning (321GB)")
|
| 39 |
-
if citadel_memory:
|
| 40 |
-
st.write("π **Librarian Status:** Phase-Locked")
|
| 41 |
-
else:
|
| 42 |
-
st.warning("β οΈ **Memory Status:** Awaiting Harvest")
|
| 43 |
-
|
| 44 |
-
st.markdown("---")
|
| 45 |
-
st.write("**Active Districts:** D01 - D46")
|
| 46 |
-
|
| 47 |
-
# --- 4. THE INTERFACE (Where the AI helps you) ---
|
| 48 |
-
st.write("### π¬ Execute Citadel Command")
|
| 49 |
-
user_query = st.chat_input("Commander, what is our next objective?")
|
| 50 |
-
|
| 51 |
-
if user_query:
|
| 52 |
-
with st.chat_message("user"):
|
| 53 |
-
st.write(user_query)
|
| 54 |
-
|
| 55 |
-
with st.chat_message("assistant"):
|
| 56 |
-
st.write("π *T.I.A. is calculating via Citadel Mesh...*")
|
| 57 |
-
|
| 58 |
-
# Priority 1: Search RAG Memory if available
|
| 59 |
-
if citadel_memory:
|
| 60 |
-
query_engine = citadel_memory.as_query_engine()
|
| 61 |
-
context_response = query_engine.query(user_query)
|
| 62 |
-
st.markdown(f"**Archive Resonance:** {context_response}")
|
| 63 |
-
|
| 64 |
-
# Priority 2: Agentic Action (Python execution & Web search)
|
| 65 |
-
agent_response = agent.run(user_query)
|
| 66 |
-
st.write(agent_response)
|
| 67 |
-
|
| 68 |
-
# --- 5. TELEMETRY ---
|
| 69 |
-
with st.expander("π‘ Mesh Telemetry"):
|
| 70 |
-
st.json({
|
| 71 |
-
"status": "OPERATOR_GRADE",
|
| 72 |
-
"alignment": "9,293",
|
| 73 |
-
"version": "v25.0.OMNI++",
|
| 74 |
-
"bridge": "Verified",
|
| 75 |
-
"timestamp": datetime.now().isoformat()
|
| 76 |
-
})
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
# --- PREVENT REGISTRY COLLISION ---
|
| 5 |
+
# Every node gets a unique internal pathname frequency
|
| 6 |
+
page_id = "citadel_vortex_209d"
|
|
|
|
| 7 |
|
| 8 |
+
def run_main():
|
| 9 |
+
st.title("π§ CITADEL NODE: citadel-vortex")
|
| 10 |
+
st.subheader("777.1122 Alignment: ACTIVE")
|
| 11 |
+
st.sidebar.success("NODE ONLINE")
|
| 12 |
+
st.write("System status: Operator-Grade. Collision vaporized.")
|
| 13 |
|
| 14 |
+
# Explicit Navigation setup
|
| 15 |
+
main_page = st.Page(run_main, title="Node HUD", icon="ποΈ", url_path="main_hub_" + unique_suffix)
|
|
|
|
| 16 |
|
| 17 |
+
# Apply Navigation
|
| 18 |
+
pg = st.navigation([main_page])
|
| 19 |
+
pg.run()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|