|
|
import streamlit as st |
|
|
from pathlib import Path |
|
|
import os |
|
|
from utils.secrets import get_secrets_manager |
|
|
from utils.persistence import get_persistent_store |
|
|
|
|
|
def initialize_storage(): |
|
|
"""Initialize required storage directories""" |
|
|
directories = [ |
|
|
"data", |
|
|
"data/uploads", |
|
|
"data/vector_stores", |
|
|
"data/workflows", |
|
|
"data/prompts", |
|
|
"data/cache" |
|
|
] |
|
|
for dir_path in directories: |
|
|
Path(dir_path).mkdir(parents=True, exist_ok=True) |
|
|
|
|
|
def render_landing_page(): |
|
|
"""Render main landing page""" |
|
|
st.title("Lattice AI Platform") |
|
|
|
|
|
|
|
|
st.markdown(""" |
|
|
Welcome to Lattice, an AI Development Platform that enables quick creation of enterprise-ready AI applications. |
|
|
|
|
|
### Available Components: |
|
|
- π Document Processing |
|
|
- π RAG Engine |
|
|
- π€ Agent System |
|
|
- π Prompt Management |
|
|
- π Domain Layer |
|
|
""") |
|
|
|
|
|
|
|
|
st.header("Solutions") |
|
|
|
|
|
col1, col2, col3 = st.columns(3) |
|
|
|
|
|
with col1: |
|
|
st.info("### Comply.ai") |
|
|
st.write("Compliance analysis and management solution") |
|
|
if st.button("Launch Comply.ai"): |
|
|
st.switch_page("solutions/comply_ai/app.py") |
|
|
|
|
|
with col2: |
|
|
st.info("### Contract.ai") |
|
|
st.write("Contract analysis solution (Coming soon)") |
|
|
st.button("Launch Contract.ai", disabled=True) |
|
|
|
|
|
with col3: |
|
|
st.info("### Policy.ai") |
|
|
st.write("Policy management solution (Coming soon)") |
|
|
st.button("Launch Policy.ai", disabled=True) |
|
|
|
|
|
def render_platform_config(): |
|
|
"""Render platform configuration section""" |
|
|
st.header("Platform Configuration") |
|
|
|
|
|
col1, col2 = st.columns(2) |
|
|
|
|
|
with col1: |
|
|
if st.button("Configure Lattice"): |
|
|
st.switch_page("pages/lattice_config.py") |
|
|
|
|
|
with col2: |
|
|
if st.button("Platform Status"): |
|
|
st.switch_page("pages/platform_status.py") |
|
|
|
|
|
def main(): |
|
|
|
|
|
st.set_page_config( |
|
|
page_title="Lattice AI Platform", |
|
|
page_icon="π²", |
|
|
layout="wide" |
|
|
) |
|
|
|
|
|
|
|
|
initialize_storage() |
|
|
|
|
|
|
|
|
secrets_manager = get_secrets_manager() |
|
|
missing_secrets = secrets_manager.check_required_secrets() |
|
|
|
|
|
if missing_secrets: |
|
|
st.error("β οΈ Missing required API keys!") |
|
|
st.info(""" |
|
|
Please configure the following API keys in your HuggingFace Space settings: |
|
|
""") |
|
|
for key in missing_secrets: |
|
|
st.code(f"{key}=your-api-key-here") |
|
|
|
|
|
|
|
|
if st.button("Configure Platform"): |
|
|
st.switch_page("pages/1_π§_lattice_config.py") |
|
|
return |
|
|
|
|
|
|
|
|
with st.sidebar: |
|
|
secrets_manager.render_secrets_status() |
|
|
|
|
|
st.divider() |
|
|
|
|
|
|
|
|
st.caption("Lattice v0.1.0") |
|
|
|
|
|
|
|
|
st.subheader("Quick Links") |
|
|
if st.button("Documentation"): |
|
|
st.markdown("[View Documentation](https://github.com/yourusername/lattice)") |
|
|
|
|
|
if st.button("Report Issue"): |
|
|
st.markdown("[Report Issue](https://github.com/yourusername/lattice/issues)") |
|
|
|
|
|
|
|
|
render_landing_page() |
|
|
|
|
|
st.divider() |
|
|
|
|
|
render_platform_config() |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |