subashpoudel commited on
Commit
92115be
·
1 Parent(s): 2c2c90a

Updated main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -6
main.py CHANGED
@@ -4,7 +4,9 @@ from pydantic import BaseModel
4
  from my_agent.agent import build_graph
5
  import pandas as pd
6
  from typing import Optional , List
7
- from my_agent.utils.initial_interaction import BusinessInteractionChatbot
 
 
8
  from my_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
9
 
10
 
@@ -13,7 +15,8 @@ import json
13
  # Store brainstorming results per thread_id
14
 
15
  app = FastAPI()
16
- interaction_chatbot = BusinessInteractionChatbot()
 
17
  graph = build_graph()
18
 
19
 
@@ -22,14 +25,21 @@ stored_data={}
22
  class UserMessage(BaseModel):
23
  message: str
24
  @app.post("/business-interaction")
25
- def business_chat(msg: UserMessage):
26
- response = interaction_chatbot.chat(msg.message)
27
- if interaction_chatbot.is_complete(response):
28
- details = interaction_chatbot.extract_details()
29
  stored_data['business_details'] = details
30
  return {"response": response, "business_details": details, "complete": True}
31
  return {"response": response, "complete": False}
32
 
 
 
 
 
 
 
 
33
 
34
 
35
  @app.post("/brainstrom")
 
4
  from my_agent.agent import build_graph
5
  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 BusinessInteractionChatbot2
9
+
10
  from my_agent.utils.utils import encode_image_to_base64 , generate_final_story, generate_image
11
 
12
 
 
15
  # Store brainstorming results per thread_id
16
 
17
  app = FastAPI()
18
+ introduction_chatbot = IntroductionChatbot()
19
+ interaction_chatbot = BusinessInteractionChatbot2()
20
  graph = build_graph()
21
 
22
 
 
25
  class UserMessage(BaseModel):
26
  message: str
27
  @app.post("/business-interaction")
28
+ def business_introduction_chat(msg: UserMessage):
29
+ response = introduction_chatbot.chat(msg.message)
30
+ if introduction_chatbot.is_complete(response):
31
+ details = introduction_chatbot.extract_details()
32
  stored_data['business_details'] = details
33
  return {"response": response, "business_details": details, "complete": True}
34
  return {"response": response, "complete": False}
35
 
36
+ @app.post("/business-interaction2")
37
+ def business_interaction_chat(message: str):
38
+ stored_data ={}
39
+ stored_data['business_details']={}
40
+ response = interaction_chatbot.chat(message , stored_data["business_details"])
41
+ return {'response': response}
42
+
43
 
44
 
45
  @app.post("/brainstrom")