File size: 8,384 Bytes
1980540
faeba56
256d47f
 
 
1980540
 
 
ac9aaee
1980540
256d47f
1980540
256d47f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980540
 
256d47f
1980540
256d47f
 
 
 
1980540
 
b85cff9
 
1980540
 
b85cff9
 
 
 
 
 
64b1440
256d47f
 
1980540
 
256d47f
 
 
 
1980540
 
b85cff9
1980540
 
 
256d47f
1980540
256d47f
1980540
 
 
 
256d47f
1980540
 
 
 
 
 
 
256d47f
 
 
 
 
1980540
256d47f
 
1980540
 
 
256d47f
1980540
256d47f
 
 
1980540
 
 
 
 
 
 
 
256d47f
1980540
256d47f
 
 
1980540
256d47f
1980540
256d47f
 
1980540
 
 
 
 
256d47f
1980540
 
 
 
256d47f
1980540
256d47f
1980540
256d47f
 
 
 
 
1980540
256d47f
1980540
 
6bffd96
 
 
 
 
1980540
6bffd96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980540
6bffd96
 
 
 
 
 
 
1980540
 
12984b5
b85cff9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8f1be1
 
b85cff9
 
 
 
 
 
 
 
 
 
 
 
64b1440
1980540
 
 
 
 
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
from dotenv import load_dotenv
import os
import streamlit as st
from streamlit_option_menu import option_menu
import pandas as pd
import base64
from Functions import RFPProcessor
# from localStoragePy import localStoragePy
from Utils import export,clear_rfp_data, generate_roadmap_image
# from Login_and_email import *

# localStorage = localStoragePy("RFP", "json")

# Initialize session states
if "generated" not in st.session_state:
    st.session_state["generated"] = []
if "past" not in st.session_state:
    st.session_state["past"] = []
if "input" not in st.session_state:
    st.session_state["input"] = ""
if "vectorstore" not in st.session_state:
    st.session_state["vectorstore"] = None
if "rfp_details" not in st.session_state:
    st.session_state["rfp_details"] = ""
if "is_data_processed" not in st.session_state:
    st.session_state["is_data_processed"] = False
if "user_stories" not in st.session_state:
    st.session_state["user_stories"] = ""
if "user_stories_data" not in st.session_state:
    st.session_state["user_stories_data"] = []
if "user_stories_json" not in st.session_state:
    st.session_state["user_stories_json"] = {}
if "is_user_stories_created" not in st.session_state:
    st.session_state["is_user_stories_created"] = False
if "rfp_summary" not in st.session_state:
    st.session_state["rfp_summary"] = ""
if "estimation_data" not in st.session_state:
    st.session_state["estimation_data"] = []
if "estimation_data_json" not in st.session_state:
    st.session_state["estimation_data_json"] = {}
if "is_estimation_data_created" not in st.session_state:
    st.session_state["is_estimation_data_created"] = False
if "roadmap_data" not in st.session_state:
    st.session_state["roadmap_data"] = []
if "roadmap_data_json" not in st.session_state:
    st.session_state["roadmap_data_json"] = []
if "is_roadmap_data_created" not in st.session_state:
    st.session_state["is_roadmap_data_created"] = False
    

def main():
    function = RFPProcessor()

    if "input" not in st.session_state:
        st.session_state["input"] = ""

    with st.sidebar:
        menu_choice = option_menu(
            menu_title="RFPStoryCraft",
            options=["Home", "RFP Bot", "User Stories", "Summary", "Estimations","RoadMap"],
            icons=["house", "list-task", "book", "book", "list-task"],
        )

        if st.session_state["is_data_processed"] == True:
            st.button("Clear RFP Data", on_click=clear_rfp_data)

        # if localStorage.getItem("email"):
        #     st.button("Log out", on_click=lambda: log_out_user(localStorage))

    if menu_choice == "Home":
        with st.form("my_form"):
            project_name = st.text_input(
                "Project Name",
                key="Project Name",
                type="default",
                placeholder="Project Name",
            )
            file = st.file_uploader("Document", type="pdf")

            submitted = st.form_submit_button("Process Data")

            if submitted:
                if project_name and file:
                    function.process_rfp_data(project_name, file)
                else:
                    st.warning(
                        "project_name and file are required to create create stories",
                        icon="⚠️",
                    )

    if menu_choice == "RFP Bot":
        if st.session_state["is_data_processed"] == True:
            st.title(" RFP Chatbot ")
            st.subheader(" Powered by Coffeebeans")
            st.text_input(
                "You: ",
                st.session_state["input"],
                key="input",
                placeholder="Your AI assistant here! Ask me Queries related to RFP",
                on_change=function.genrate_bot_result(),
                label_visibility="hidden",
            )
            with st.container():
                for i in range(len(st.session_state["generated"]) - 1, -1, -1):
                    st.success(st.session_state["generated"][i], icon="🤖")
                    st.info(st.session_state["past"][i], icon="🧐")
        else:
            st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")

    if menu_choice == "User Stories":
        if st.session_state["is_data_processed"] == True:
            st.title("User Stories")
            st.button(
                "Genrate User Stories",
                type="primary",
                on_click=function.genrate_user_stories,
            )
            if st.session_state["is_user_stories_created"] == True:
                st.button("Export Stories", on_click=lambda: export(st.session_state["user_stories_data"]))
                with st.container():
                 df = pd.DataFrame(st.session_state["user_stories_data"])
                 st.table(df)
        else:
            st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")

    if menu_choice == "Summary":
        if st.session_state["is_data_processed"] == True:
            st.title("Summary")
            with st.container():
                st.markdown(st.session_state["rfp_summary"])
        else:
            st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")

    if menu_choice == "Estimations":
        if st.session_state["is_data_processed"] == True:
            if st.session_state["is_user_stories_created"] == True:
                st.title("Estimations")
                senior_developers = st.text_input(
                    label="Number of Senior Developers",
                    placeholder="Enter here....",
                )
                junior_developers = st.text_input(
                    label="Number of Junior Developers",
                    placeholder="Enter here...",
                )
                tech_leads = st.text_input(
                    label="Number of Tech Leads",
                    placeholder="Enter here....",
                )
    
                if senior_developers and junior_developers and tech_leads and st.session_state["is_user_stories_created"] == True:
                    st.button(
                        "Generate Estimations",
                        on_click=lambda: function.generate_estimations(tech_leads, senior_developers, junior_developers),
                    )
    
                if st.session_state["is_estimation_data_created"] == True:
                    if st.session_state["is_estimation_data_created"] == True:
                     st.button("Export Stories", on_click = lambda: export(st.session_state["estimation_data"]))
                    with st.container():
                        df = pd.DataFrame(st.session_state["estimation_data"])
                        st.table(df)
            else:
                st.warning("Plesase Process User Stories to access this feature", icon="⚠️")
        else:
            st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")

    if menu_choice == "RoadMap":
        if st.session_state["is_data_processed"] == True:
            if st.session_state["is_estimation_data_created"] == True:
                st.title("RoadMap")
                st.button(
                    "Generate RoadMap", on_click=lambda: function.generate_roadmap()
                )

                if st.session_state["is_roadmap_data_created"] == True:
                    st.button(
                        "Export RoadMap",
                        on_click=lambda: export(st.session_state["roadmap_data"]),
                    )
                    if st.button("Generate Roadmap and Download"):
                      st.info("Generating roadmap... Please wait.")
                      # Generate the roadmap image
                      generate_roadmap_image()
                        
                    with st.container():
                        df = pd.DataFrame(st.session_state["roadmap_data"])
                        st.table(df)

            else:
                st.warning(
                    "Please Process the Estimations Data to access this feature",
                    icon="⚠️",
                )
        else:
            st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
            

if __name__ == "__main__":
    # if localStorage.getItem("email"):
    main()
    # else:
    #     authenticate(localStorage)