subashpoudel commited on
Commit
db141d0
·
1 Parent(s): c13e66f

updated the endpoints

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -21,6 +21,7 @@ business_interaction_graph = BusinessInteractionChatbot()
21
  brainstrom_graph = brainstroming_graph()
22
 
23
  stored_data={}
 
24
 
25
  class UserMessage(BaseModel):
26
  message: str
@@ -29,7 +30,8 @@ def context_analysis(msg: UserMessage):
29
  response = context_analysis_graph.chat(msg.message)
30
  if context_analysis_graph.is_complete(response):
31
  details = context_analysis_graph.extract_details()
32
- details = details.model_dump()
 
33
  print('Business_details:',details)
34
  if isinstance(details, str):
35
  details= ast.literal_eval(details)
@@ -43,8 +45,10 @@ def context_analysis(msg: UserMessage):
43
 
44
  @app.post("/business-interaction")
45
  def business_interaction(interaction: str):
46
- business_details = {"business_type": "restaurant", "platform": "instagram", "target_audience": "youths", "business_goals": "to go global", "offerings": "nepali foods", "Challenges_faced": "finding new customers, attracting large customers"}
47
- response = business_interaction_graph.chat(interaction , business_details)
 
 
48
  return {'response': response}
49
 
50
 
 
21
  brainstrom_graph = brainstroming_graph()
22
 
23
  stored_data={}
24
+ # stored_data['business_details']={"business_type": "restaurant", "platform": "instagram", "target_audience": "youths", "business_goals": "to go global", "offerings": "nepali foods", "Challenges_faced": "finding new customers, attracting large customers"}
25
 
26
  class UserMessage(BaseModel):
27
  message: str
 
30
  response = context_analysis_graph.chat(msg.message)
31
  if context_analysis_graph.is_complete(response):
32
  details = context_analysis_graph.extract_details()
33
+ if type(details) != dict:
34
+ details = details.model_dump()
35
  print('Business_details:',details)
36
  if isinstance(details, str):
37
  details= ast.literal_eval(details)
 
45
 
46
  @app.post("/business-interaction")
47
  def business_interaction(interaction: str):
48
+ response,business_details = business_interaction_graph.chat(interaction , stored_data['business_details'])
49
+ if stored_data['business_details']!=business_details:
50
+ save_to_db(business_details)
51
+ stored_data['business_details']=business_details
52
  return {'response': response}
53
 
54