import streamlit as st import sys from pathlib import Path # Add project root to Python path for imports sys.path.insert(0, str(Path(__file__).parent.parent)) from frontend.sidebar import render_sidebar from frontend.editor import render_editor from frontend.chat import render_chat def init_state(): """Initialize session state variables.""" if "selected_file" not in st.session_state: st.session_state.selected_file = None if "file_content" not in st.session_state: st.session_state.file_content = "" if "chat_history" not in st.session_state: st.session_state.chat_history = [] if "code_output" not in st.session_state: st.session_state.code_output = "" def main(): st.set_page_config( page_title="Lightweight code editor", layout="wide") st.title("Lightweight code editor") init_state() left, right = st.columns([1, 3]) with left: choice = render_sidebar() with right: if choice == "Chat with AI Assistant": render_chat() elif choice == "Code Editor": render_editor() elif choice == "File Explorer": st.subheader("File Explorer") st.info("File Explorer functionality is not implemented yet.") if __name__ == "__main__": main()