I’ve built a streamlit app to chat with code bases and it all runs locally fine and even locally in docker. When I deploy it to GKE, the if st.button("Process Repo"):
doesn’t seem to do anything. I don’t see with st.spinner("Cloning and processing repo...")
show.
The code is this:
# Streamlit app
st.set_page_config(layout="wide")
st.title("code chat prototype")
# Initialize Gemini client, model, and session state
if "gemini_client" not in st.session_state:
st.session_state["gemini_client"] = initialize_gemini_client()
if "messages" not in st.session_state:
st.session_state.messages = []
if "repo_content" not in st.session_state:
st.session_state.repo_content = None
# Sidebar for model selection
with st.sidebar:
model_options = ["gemini-2.0-flash-exp", "gemini-exp-1206", "gemini-2.0-flash-thinking-exp-1219"]
st.session_state["gemini_model"] = st.selectbox(
"Select Gemini Model",
model_options,
index = model_options.index(st.session_state.get("gemini_model", "gemini-2.0-flash-thinking-exp-1219"))
)
repo_url = st.text_input("Input a Mission Lane GitHub Repository URL and hit Enter:")
if repo_url:
if st.button("Process Repo"):
with st.spinner("Cloning and processing repo..."):
repo_path = clone_repo(repo_url)
if repo_path:
repo_files, token_count = combine_repo_files(repo_path)
st.session_state.repo_content = repo_files
st.write(f"Total tokens extracted from repo files: ", token_count)
else:
st.session_state.repo_content = None
the logs after I click the button are these in debug mode, sorry for the bad log formatting:
2025-01-24 10:16:36.488
2025-01-24 18:16:36.488 Received the following back message:
2025-01-24 10:16:36.488 rerun_script {
2025-01-24 10:16:36.488 widget_states {
2025-01-24 10:16:36.488 widgets {
2025-01-24 10:16:36.488 id: "$$ID-6c44980c586d253cca28a8cfe8da4c07-None"
2025-01-24 10:16:36.488 int_value: 2
2025-01-24 10:16:36.488 }
2025-01-24 10:16:36.488 widgets {
2025-01-24 10:16:36.488 id: "$$ID-92902bde4a8f113ed93276295e58d7f2-None"
2025-01-24 10:16:36.488 string_value: "https://github.com/missionlane/analyze-pd-incidents"
2025-01-24 10:16:36.488 }
2025-01-24 10:16:36.488 widgets {
2025-01-24 10:16:36.488 id: "$$ID-0b92ed79c58e6e669c44b60e58de202a-None"
2025-01-24 10:16:36.488 trigger_value: true
2025-01-24 10:16:36.488 }
2025-01-24 10:16:36.488 }
2025-01-24 10:16:36.488 page_script_hash: "ef38919bf6c85b3eec7e40ffff072403"
2025-01-24 10:16:36.488 }
2025-01-24 10:16:36.488
2025-01-24 10:16:36.489
2025-01-24 18:16:36.488 Beginning script thread
2025-01-24 10:16:36.489
2025-01-24 18:16:36.489 Running script RerunData(widget_states=widgets {
2025-01-24 10:16:36.489 id: "$$ID-6c44980c586d253cca28a8cfe8da4c07-None"
2025-01-24 10:16:36.489 int_value: 2
2025-01-24 10:16:36.489 }
2025-01-24 10:16:36.489 widgets {
2025-01-24 10:16:36.489 id: "$$ID-92902bde4a8f113ed93276295e58d7f2-None"
2025-01-24 10:16:36.489 string_value: "https://github.com/missionlane/analyze-pd-incidents"
2025-01-24 10:16:36.489 }
2025-01-24 10:16:36.489 widgets {
2025-01-24 10:16:36.489 id: "$$ID-0b92ed79c58e6e669c44b60e58de202a-None"
2025-01-24 10:16:36.489 trigger_value: true
2025-01-24 10:16:36.489 }
2025-01-24 10:16:36.489 , page_script_hash='ef38919bf6c85b3eec7e40ffff072403')
2025-01-24 10:16:36.489
2025-01-24 18:16:36.489 Disconnecting files for session with ID ff4bd165-4cb5-4347-850d-19bee8509b7d
2025-01-24 10:16:36.489
2025-01-24 18:16:36.489 Sessions still active: dict_keys([])
2025-01-24 10:16:36.489
2025-01-24 18:16:36.489 Files: 0; Sessions with files: 0
2025-01-24 10:16:36.499
2025-01-24 18:16:36.499 Removing orphaned files...
2025-01-24 10:16:36.656
2025-01-24 18:16:36.656 Script run finished successfully; removing expired entries from MessageCache (max_age=2)