Ronio Jerico Roque commited on
Commit
73d10db
·
1 Parent(s): e9cd26b

Refactor client summary processing to initialize session state for client name and website, and update telemetry collection logic

Browse files
Files changed (1) hide show
  1. classes/client_summary.py +24 -4
classes/client_summary.py CHANGED
@@ -22,26 +22,46 @@ class CientSummary:
22
  load_dotenv()
23
  if 'client_summary' not in st.session_state:
24
  st.session_state['client_summary'] = ''
 
 
 
 
25
 
26
  def process (self):
27
  with st.spinner('Seo Analyst...', show_time=True):
28
  st.write('')
29
  client_summary = ""
30
- # INITIALIZING SESSIONS
31
- client_summary += f"Client Summary: {self.client_summary}\n"
 
 
 
 
32
 
33
  debug_client_summary = {'data_field' : 'Client Summary', 'result': client_summary}
34
-
 
 
35
  if self.client_summary:
36
  st.session_state['client_summary'] = 'uploaded'
37
  collect_telemetry(debug_client_summary)
 
 
 
 
 
 
38
 
39
  def row1(self):
40
  self.client_summary = st.text_area("Client Summary:", help="Name of business, nature of business, location, products/services")
41
  session = st.session_state.analyze
42
- if self.client_summary and session == 'clicked':
 
 
 
43
  self.process()
44
 
 
45
  if __name__ == "__main__":
46
  st.set_page_config(layout="wide")
47
 
 
22
  load_dotenv()
23
  if 'client_summary' not in st.session_state:
24
  st.session_state['client_summary'] = ''
25
+ if 'client_name' not in st.session_state:
26
+ st.session_state['client_name'] = ''
27
+ if 'client_webiste' not in st.session_state:
28
+ st.session_state['client_webiste'] = ''
29
 
30
  def process (self):
31
  with st.spinner('Seo Analyst...', show_time=True):
32
  st.write('')
33
  client_summary = ""
34
+ client_name = ""
35
+ client_website = ""
36
+ #
37
+ client_summary = f"Client Summary: {self.client_summary}\n"
38
+ client_name = f"Client Name: {self.name}\n"
39
+ client_website = f"Client Website: {self.website}\n"
40
 
41
  debug_client_summary = {'data_field' : 'Client Summary', 'result': client_summary}
42
+ debug_client_name = {'data_field' : 'Client Name', 'result': client_name}
43
+ debug_client_website = {'data_field' : 'Client Website', 'result': client_website}
44
+
45
  if self.client_summary:
46
  st.session_state['client_summary'] = 'uploaded'
47
  collect_telemetry(debug_client_summary)
48
+ if self.name:
49
+ st.session_state['client_name'] = 'uploaded'
50
+ collect_telemetry(debug_client_website)
51
+ if self.website:
52
+ st.session_state['client_webiste'] = 'uploaded'
53
+ collect_telemetry(debug_client_name)
54
 
55
  def row1(self):
56
  self.client_summary = st.text_area("Client Summary:", help="Name of business, nature of business, location, products/services")
57
  session = st.session_state.analyze
58
+ self.name = st.text_input("Client Name:")
59
+ self.website = st.text_input("Client Website:")
60
+
61
+ if (self.client_summary or self.name or self.website) and session == 'clicked':
62
  self.process()
63
 
64
+
65
  if __name__ == "__main__":
66
  st.set_page_config(layout="wide")
67