Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,53 +1,85 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
# Mock data
|
7 |
mock_repos = {
|
8 |
"public": ["repo_public_1", "repo_public_2", "repo_public_3"],
|
9 |
"private": ["repo_private_1", "repo_private_2", "repo_private_3"]
|
10 |
}
|
11 |
|
12 |
-
mock_branches = ["main", "dev", "feature-1", "
|
13 |
-
|
14 |
mock_contributors = ["Alice", "Bob", "Charlie", "Diana"]
|
15 |
|
16 |
-
#
|
17 |
st.title("GitHub Contributors Recap")
|
18 |
|
19 |
-
#
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
# For the purpose of this mock, we'll assume the data is loaded and present the next options
|
33 |
-
st.success(f"Data for {chosen_repo} loaded successfully!")
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
if branch_selection == "specific":
|
38 |
-
selected_branches = st.multiselect("Choose branches", options=mock_branches)
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
#
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
# Chat prompt message
|
50 |
-
chat_prompt = st.text_input("Ask any question about the contributor")
|
51 |
-
if chat_prompt:
|
52 |
-
st.write("Feature coming soon!")
|
53 |
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Initialize session state variables if they don't exist
|
4 |
+
if 'recap_period' not in st.session_state:
|
5 |
+
st.session_state['recap_period'] = 'month'
|
6 |
+
if 'repo_type' not in st.session_state:
|
7 |
+
st.session_state['repo_type'] = 'public'
|
8 |
+
if 'private_token' not in st.session_state:
|
9 |
+
st.session_state['private_token'] = ''
|
10 |
+
if 'selected_repo' not in st.session_state:
|
11 |
+
st.session_state['selected_repo'] = ''
|
12 |
+
if 'branch_option' not in st.session_state:
|
13 |
+
st.session_state['branch_option'] = 'all'
|
14 |
+
if 'selected_branches' not in st.session_state:
|
15 |
+
st.session_state['selected_branches'] = []
|
16 |
+
if 'selected_contributor' not in st.session_state:
|
17 |
+
st.session_state['selected_contributor'] = ''
|
18 |
|
19 |
+
markdown = r"""
|
20 |
+
# GitHub Recap: Repository
|
21 |
+
Details about the repository: Lorem ipsum dolor sit amet...
|
22 |
+
---
|
23 |
+
# GitHub Recap: Contributor
|
24 |
+
Contributions and activities: Consectetur adipiscing elit...
|
25 |
+
---
|
26 |
+
# Additional Insights
|
27 |
+
Further analysis and statistics: Sed do eiusmod tempor incididunt...
|
28 |
+
---
|
29 |
+
## Conclusion
|
30 |
+
Summary and final thoughts.
|
31 |
+
"""
|
32 |
|
33 |
+
# Mock data
|
34 |
mock_repos = {
|
35 |
"public": ["repo_public_1", "repo_public_2", "repo_public_3"],
|
36 |
"private": ["repo_private_1", "repo_private_2", "repo_private_3"]
|
37 |
}
|
38 |
|
39 |
+
mock_branches = ["main", "dev", "feature-1", "bugfix-a"]
|
|
|
40 |
mock_contributors = ["Alice", "Bob", "Charlie", "Diana"]
|
41 |
|
42 |
+
# App title
|
43 |
st.title("GitHub Contributors Recap")
|
44 |
|
45 |
+
# Recap period selection
|
46 |
+
st.session_state['recap_period'] = st.selectbox("Choose recap period", options=["month", "3 months", "6 months", "year"], index=0)
|
47 |
+
|
48 |
+
# Repo type selection
|
49 |
+
st.session_state['repo_type'] = st.selectbox("Choose repo type", options=["public", "private"], index=0)
|
50 |
+
|
51 |
+
# If repo type is private, request for private token
|
52 |
+
if st.session_state['repo_type'] == "private":
|
53 |
+
st.session_state['private_token'] = st.text_input("Enter private token")
|
54 |
+
|
55 |
+
# Repository selection
|
56 |
+
st.session_state['reponame'] = st.text_input("hashicorp/terraform")
|
57 |
|
58 |
+
# Load button to fetch repo data (simulated with mock data)
|
59 |
+
if st.button("Load Repository Data"):
|
60 |
+
st.session_state['selected_branches'] = mock_branches # Simulate fetching branches
|
61 |
+
st.session_state['selected_contributor'] = '' # Reset selected contributor
|
62 |
|
63 |
+
# Branch selection
|
64 |
+
branch_option = st.radio("Select branches:", options=["all", "specific"])
|
65 |
|
66 |
+
if branch_option == "specific":
|
67 |
+
st.session_state['selected_branches'] = st.multiselect("Select branches", options=mock_branches, default=mock_branches)
|
|
|
|
|
68 |
|
69 |
+
# Contributor selection
|
70 |
+
st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=mock_contributors)
|
|
|
|
|
71 |
|
72 |
+
# Get recap button
|
73 |
+
if st.button("Get Recap"):
|
74 |
+
|
75 |
+
|
76 |
+
# Placeholder for GitHub markdown content
|
77 |
+
rs.slides(markdown, height=500)
|
78 |
|
79 |
+
# Chat prompt (future feature)
|
80 |
+
st.text_input("Ask any question about the contributor:", on_change=None, key="chat_prompt")
|
81 |
+
|
82 |
+
if st.button("ask"):
|
83 |
+
st.write("Feature coming soon!")
|
84 |
|
|
|
|
|
|
|
|
|
85 |
|