subashpoudel commited on
Commit
24b940c
·
1 Parent(s): 563ce7c

Validated the endpoints

Browse files
Files changed (1) hide show
  1. main.py +10 -4
main.py CHANGED
@@ -6,7 +6,8 @@ import pandas as pd
6
  from typing import Optional , List
7
  from my_agent.utils.initial_interaction import IntroductionChatbot
8
  from my_agent.utils.business_interaction import BusinessInteractionChatbot
9
- # from my_agent.utils.check import BusinessInteractionChatbot
 
10
 
11
 
12
  from my_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
@@ -30,6 +31,12 @@ def business_introduction_chat(msg: UserMessage):
30
  response = introduction_chatbot.chat(msg.message)
31
  if introduction_chatbot.is_complete(response):
32
  details = introduction_chatbot.extract_details()
 
 
 
 
 
 
33
  stored_data['business_details'] = details
34
  return {"response": response, "business_details": details, "complete": True}
35
  return {"response": response, "complete": False}
@@ -38,12 +45,11 @@ def business_introduction_chat(msg: UserMessage):
38
 
39
  @app.post("/business-interaction2")
40
  def business_interaction_chat(interaction: str):
41
- response = interaction_chatbot2.chat(interaction)
 
42
  return {'response': response}
43
 
44
 
45
-
46
-
47
  @app.post("/brainstrom")
48
  def brainstroming_endpoint(
49
  query: List[str], # sent as JSON body
 
6
  from typing import Optional , List
7
  from my_agent.utils.initial_interaction import IntroductionChatbot
8
  from my_agent.utils.business_interaction import BusinessInteractionChatbot
9
+ from my_agent.utils.utils import save_to_db
10
+ import ast
11
 
12
 
13
  from my_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
 
31
  response = introduction_chatbot.chat(msg.message)
32
  if introduction_chatbot.is_complete(response):
33
  details = introduction_chatbot.extract_details()
34
+ details = details.model_dump()
35
+ print('Business_details:',details)
36
+ if isinstance(details, str):
37
+ details= ast.literal_eval(details)
38
+ print('Details Type:',type(details))
39
+ save_to_db(details)
40
  stored_data['business_details'] = details
41
  return {"response": response, "business_details": details, "complete": True}
42
  return {"response": response, "complete": False}
 
45
 
46
  @app.post("/business-interaction2")
47
  def business_interaction_chat(interaction: str):
48
+ 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"}
49
+ response = interaction_chatbot2.chat(interaction , business_details)
50
  return {'response': response}
51
 
52
 
 
 
53
  @app.post("/brainstrom")
54
  def brainstroming_endpoint(
55
  query: List[str], # sent as JSON body