Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,49 +64,66 @@ st.session_state['reponame'] = st.text_input("reponame")
|
|
64 |
|
65 |
if st.button("sync"):
|
66 |
st.session_state['sync'] = True
|
|
|
67 |
st.session_state['contributors_list'] = get_contributors(st.session_state['reponame'], updated_token=st.session_state['private_token'])
|
68 |
st.session_state['branches_list'] = get_repo_branches(st.session_state['reponame'], updated_token=st.session_state['private_token'])
|
69 |
# Load button to fetch repo data (simulated with mock data)
|
|
|
70 |
if st.session_state['sync']:
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
if branch_option == "specific":
|
78 |
-
st.session_state['selected_branches'] = st.multiselect("Select branches", options=st.session_state['branches_list'], default=st.session_state['branches_list'])
|
79 |
-
|
80 |
-
# Contributor selection
|
81 |
-
st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=st.session_state['contributors_list'])
|
82 |
-
|
83 |
-
# Get recap button
|
84 |
-
if st.button("Get Recap"):
|
85 |
-
st.session_state['Recap'] = True
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
if st.session_state['Recap']:
|
91 |
-
# get_contributor_commits(repo_name, contributor, period, updated_token=None)
|
92 |
-
print(st.session_state['commits'])
|
93 |
-
print(len(st.session_state['commits']))
|
94 |
-
if st.session_state['commits']:
|
95 |
-
st.text(str(len(st.session_state['commits'])), " commits fetched")
|
96 |
-
else:
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
print(len(st.session_state['commits']))
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
|
112 |
|
|
|
64 |
|
65 |
if st.button("sync"):
|
66 |
st.session_state['sync'] = True
|
67 |
+
st.session_state['Recap'] = False
|
68 |
st.session_state['contributors_list'] = get_contributors(st.session_state['reponame'], updated_token=st.session_state['private_token'])
|
69 |
st.session_state['branches_list'] = get_repo_branches(st.session_state['reponame'], updated_token=st.session_state['private_token'])
|
70 |
# Load button to fetch repo data (simulated with mock data)
|
71 |
+
|
72 |
if st.session_state['sync']:
|
73 |
|
74 |
+
if !st.session_state['Recap']:
|
75 |
+
st.session_state['selected_branches'] = st.session_state['branches_list']
|
76 |
+
st.session_state['selected_contributor'] = [] # Reset selected contributor
|
77 |
+
# Branch selection
|
78 |
+
branch_option = st.radio("Select branches:", options=["all", "specific"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
+
if branch_option == "specific":
|
81 |
+
st.session_state['selected_branches'] = st.multiselect("Select branches", options=st.session_state['branches_list'], default=st.session_state['branches_list'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
# Contributor selection
|
84 |
+
st.session_state['selected_contributor'] = st.selectbox("Select contributor name", options=st.session_state['contributors_list'])
|
85 |
+
|
86 |
+
# Get recap button
|
87 |
+
if st.button("Get Recap"):
|
88 |
+
with st.spinner('fetching commits'):
|
89 |
+
st.session_state['commits'] = get_contributor_commits(st.session_state['reponame'], st.session_state['selected_contributor'], st.session_state['recap_period'],st.session_state['selected_branches'], updated_token=st.session_state['private_token'])
|
90 |
+
print(st.session_state['commits'])
|
91 |
+
st.session_state['Recap'] = True
|
92 |
print(len(st.session_state['commits']))
|
93 |
+
# st.session_state['markdown'] = get_markdown(st.session_state['commits'])
|
94 |
+
st.session_state['sync'] = False
|
95 |
+
else:
|
96 |
+
print(st.session_state['commits'])
|
97 |
+
print(len(st.session_state['commits']))
|
98 |
+
rs.slides(markdown, height=500)
|
99 |
+
|
100 |
+
# Chat prompt (future feature)
|
101 |
+
st.text_input("Ask any question about the contributor:", on_change=None, key="chat_prompt")
|
102 |
+
|
103 |
+
if st.button("ask"):
|
104 |
+
st.write("Feature coming soon!")
|
105 |
+
|
106 |
+
|
107 |
+
# if st.session_state['Recap']:
|
108 |
+
# # get_contributor_commits(repo_name, contributor, period, updated_token=None)
|
109 |
+
# print(st.session_state['commits'])
|
110 |
+
# print(len(st.session_state['commits']))
|
111 |
+
# if st.session_state['commits']:
|
112 |
+
# st.text(str(len(st.session_state['commits'])), " commits fetched")
|
113 |
+
# else:
|
114 |
+
|
115 |
+
# with st.spinner('fetching commits'):
|
116 |
+
# st.session_state['commits'] = get_contributor_commits(st.session_state['reponame'], st.session_state['selected_contributor'], st.session_state['recap_period'],st.session_state['selected_branches'], updated_token=st.session_state['private_token'])
|
117 |
+
# print(st.session_state['commits'])
|
118 |
+
# print(len(st.session_state['commits']))
|
119 |
+
# # st.text("fetching commits")
|
120 |
+
# # Placeholder for GitHub markdown content
|
121 |
+
# rs.slides(markdown, height=500)
|
122 |
|
123 |
+
# # Chat prompt (future feature)
|
124 |
+
# st.text_input("Ask any question about the contributor:", on_change=None, key="chat_prompt")
|
125 |
|
126 |
+
# if st.button("ask"):
|
127 |
+
# st.write("Feature coming soon!")
|
128 |
|
129 |
|