SamVidur commited on
Commit
2b82e2c
·
verified ·
1 Parent(s): 4461959

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -4
main.py CHANGED
@@ -426,6 +426,7 @@ app = FastAPI(title="Sattva AI API")
426
 
427
  class ChatRequest(BaseModel):
428
  user_id: str
 
429
  message: str
430
  mode: str
431
 
@@ -461,7 +462,8 @@ async def cron_test():
461
  @app.post("/chat", response_model=ChatResponse)
462
  async def chat_endpoint(request: ChatRequest):
463
  try:
464
- username = request.user_id
 
465
  user_input = request.message
466
  mode = request.mode
467
  config = RailsConfig.from_path("./config")
@@ -510,9 +512,9 @@ async def chat_endpoint(request: ChatRequest):
510
  # # pass
511
 
512
  ncon = 3
513
- chat_history_str = extract_chats(collection, username, ncon)
514
 
515
- prev_goalandfocus = extract_goalfocus(collection, username)
516
 
517
  context_goal = f'''
518
  Ohk, so you are an expert in navigating paths through human conversations. So, let's say if someone is telling you about how they are feeling, what they did
@@ -602,7 +604,8 @@ async def chat_endpoint(request: ChatRequest):
602
 
603
  if collection is not None:
604
  chat_document = {
605
- "user_id": username,
 
606
  "timestamp": datetime.now(),
607
  "conversation": {
608
  "human": user_input,
 
426
 
427
  class ChatRequest(BaseModel):
428
  user_id: str
429
+ username: str
430
  message: str
431
  mode: str
432
 
 
462
  @app.post("/chat", response_model=ChatResponse)
463
  async def chat_endpoint(request: ChatRequest):
464
  try:
465
+ username = request.username
466
+ userid = request.user_id
467
  user_input = request.message
468
  mode = request.mode
469
  config = RailsConfig.from_path("./config")
 
512
  # # pass
513
 
514
  ncon = 3
515
+ chat_history_str = extract_chats(collection, userid, ncon)
516
 
517
+ prev_goalandfocus = extract_goalfocus(collection, userid)
518
 
519
  context_goal = f'''
520
  Ohk, so you are an expert in navigating paths through human conversations. So, let's say if someone is telling you about how they are feeling, what they did
 
604
 
605
  if collection is not None:
606
  chat_document = {
607
+ "user_id": userid,
608
+ "username": username,
609
  "timestamp": datetime.now(),
610
  "conversation": {
611
  "human": user_input,