File size: 3,472 Bytes
c235b20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720aeb4
 
c235b20
 
720aeb4
 
c235b20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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")
    
    # Platform description
    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
    """)
    
    # Solutions section
    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():
    # Page config
    st.set_page_config(
        page_title="Lattice AI Platform",
        page_icon="πŸ”²",
        layout="wide"
    )
    
    # Initialize storage
    initialize_storage()
    
    # Check API keys and secrets
    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")
        
        # Show configuration button
        if st.button("Configure Platform"):
            st.switch_page("pages/1_πŸ”§_lattice_config.py")
        return
    
    # Render sidebar status
    with st.sidebar:
        secrets_manager.render_secrets_status()
        
        st.divider()
        
        # Platform version
        st.caption("Lattice v0.1.0")
        
        # Quick navigation
        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 main content
    render_landing_page()
    
    st.divider()
    
    render_platform_config()

if __name__ == "__main__":
    main()