Spaces:
Sleeping
Sleeping
2 qestions, fix session init, time error handling
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- __pycache__/classes.cpython-311.pyc +0 -0
- __pycache__/utils_objections.cpython-311.pyc +0 -0
- __pycache__/utils_output.cpython-311.pyc +0 -0
- __pycache__/utils_simulation.cpython-311.pyc +0 -0
- app.py +2 -0
- classes.py +5 -5
- utils_objections.py +2 -2
- utils_output.py +0 -2
- utils_simulation.py +10 -3
__pycache__/app.cpython-311.pyc
CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
__pycache__/classes.cpython-311.pyc
CHANGED
Binary files a/__pycache__/classes.cpython-311.pyc and b/__pycache__/classes.cpython-311.pyc differ
|
|
__pycache__/utils_objections.cpython-311.pyc
CHANGED
Binary files a/__pycache__/utils_objections.cpython-311.pyc and b/__pycache__/utils_objections.cpython-311.pyc differ
|
|
__pycache__/utils_output.cpython-311.pyc
CHANGED
Binary files a/__pycache__/utils_output.cpython-311.pyc and b/__pycache__/utils_output.cpython-311.pyc differ
|
|
__pycache__/utils_simulation.cpython-311.pyc
CHANGED
Binary files a/__pycache__/utils_simulation.cpython-311.pyc and b/__pycache__/utils_simulation.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -95,6 +95,8 @@ async def on_action_display_queries_responses(action):
|
|
95 |
@cl.on_chat_start
|
96 |
async def on_chat_start():
|
97 |
session_state = SessionState()
|
|
|
|
|
98 |
set_session_state_variables(session_state)
|
99 |
cl.user_session.set("session_state", session_state)
|
100 |
session_state.llm_model = llm_model
|
|
|
95 |
@cl.on_chat_start
|
96 |
async def on_chat_start():
|
97 |
session_state = SessionState()
|
98 |
+
print("Creating new session state")
|
99 |
+
print(session_state.responses)
|
100 |
set_session_state_variables(session_state)
|
101 |
cl.user_session.set("session_state", session_state)
|
102 |
session_state.llm_model = llm_model
|
classes.py
CHANGED
@@ -36,6 +36,10 @@ class SessionState:
|
|
36 |
opportunity_review_results = None
|
37 |
opportunity_review_report = None
|
38 |
def __init__(self):
|
|
|
|
|
|
|
|
|
39 |
self.session_stage = "research"
|
40 |
self.do_evaluation = False
|
41 |
self.do_opportunity_analysis = False
|
@@ -103,11 +107,7 @@ class SessionState:
|
|
103 |
self.activity = activity
|
104 |
self.next_steps = next_steps
|
105 |
|
106 |
-
|
107 |
-
self.company = None
|
108 |
-
self.customer = None
|
109 |
-
self.opportunity = None
|
110 |
-
self.scenario = None
|
111 |
|
112 |
def add_company_info(self, name, description, product, product_summary, product_description):
|
113 |
self.company = self.Company(name, description, product, product_summary, product_description)
|
|
|
36 |
opportunity_review_results = None
|
37 |
opportunity_review_report = None
|
38 |
def __init__(self):
|
39 |
+
self.company = None
|
40 |
+
self.customer = None
|
41 |
+
self.opportunity = None
|
42 |
+
self.scenario = None
|
43 |
self.session_stage = "research"
|
44 |
self.do_evaluation = False
|
45 |
self.do_opportunity_analysis = False
|
|
|
107 |
self.activity = activity
|
108 |
self.next_steps = next_steps
|
109 |
|
110 |
+
|
|
|
|
|
|
|
|
|
111 |
|
112 |
def add_company_info(self, name, description, product, product_summary, product_description):
|
113 |
self.company = self.Company(name, description, product, product_summary, product_description)
|
utils_objections.py
CHANGED
@@ -22,9 +22,9 @@ async def create_objections(session_state):
|
|
22 |
|
23 |
objections = [
|
24 |
"1. Can you provide customer references in the banking and financial services industry?",
|
25 |
-
"2.
|
26 |
-
"3. Last but not least, your pricing seems high compared to some other solutions we've seen. Can you provide any flexibility with HSBC's pricing?",
|
27 |
]
|
|
|
28 |
|
29 |
else:
|
30 |
customer_document_file = session_state.customer_research_report_pdf
|
|
|
22 |
|
23 |
objections = [
|
24 |
"1. Can you provide customer references in the banking and financial services industry?",
|
25 |
+
"2. What training options are available for our team, given the number of employees and their global distribution?",
|
|
|
26 |
]
|
27 |
+
# "3. Last but not least, your pricing seems high compared to some other solutions we've seen. Can you provide any flexibility with HSBC's pricing?",
|
28 |
|
29 |
else:
|
30 |
customer_document_file = session_state.customer_research_report_pdf
|
utils_output.py
CHANGED
@@ -107,8 +107,6 @@ async def display_evaluation_results(cl, session_state):
|
|
107 |
|
108 |
for index, resp in enumerate(session_state.responses):
|
109 |
eval_score = resp.get('evaluation_score', 0)
|
110 |
-
print(eval_score)
|
111 |
-
print(type(eval_score))
|
112 |
if eval_score == 1:
|
113 |
eval_output = "Hit"
|
114 |
elif eval_score == 0:
|
|
|
107 |
|
108 |
for index, resp in enumerate(session_state.responses):
|
109 |
eval_score = resp.get('evaluation_score', 0)
|
|
|
|
|
110 |
if eval_score == 1:
|
111 |
eval_output = "Hit"
|
112 |
elif eval_score == 0:
|
utils_simulation.py
CHANGED
@@ -67,10 +67,17 @@ async def do_simulation(client, session_state, message):
|
|
67 |
await cl.Message(message_to_rep).send()
|
68 |
session_state.status = "complete"
|
69 |
end_time = datetime.now()
|
70 |
-
duration = end_time - session_state.start_time
|
71 |
-
duration_minutes = round(duration.total_seconds() / 60)
|
72 |
session_state.end_time = end_time
|
73 |
-
session_state.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
if session_state.do_evaluation:
|
75 |
await display_evaluation_results(cl, session_state)
|
76 |
else:
|
|
|
67 |
await cl.Message(message_to_rep).send()
|
68 |
session_state.status = "complete"
|
69 |
end_time = datetime.now()
|
|
|
|
|
70 |
session_state.end_time = end_time
|
71 |
+
if session_state.start_time:
|
72 |
+
try:
|
73 |
+
duration = end_time - session_state.start_time
|
74 |
+
duration_minutes = round(duration.total_seconds() / 60)
|
75 |
+
except:
|
76 |
+
print("Error calculating duration")
|
77 |
+
duration = 130
|
78 |
+
duration_minutes = 2
|
79 |
+
|
80 |
+
session_state.duration_minutes = duration_minutes
|
81 |
if session_state.do_evaluation:
|
82 |
await display_evaluation_results(cl, session_state)
|
83 |
else:
|