Vitrous commited on
Commit
87ab216
·
verified ·
1 Parent(s): c6d97b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -109,17 +109,16 @@ async def start_conversation(request: Request):
109
  raise HTTPException(status_code=400, detail="No prompt provided")
110
 
111
  # Check if conversations dictionary is empty
112
- if not conversations:
113
- raise HTTPException(status_code=404, detail="No chat history available")
114
 
115
  # Generate a response for the initial prompt
116
  response = generate_response(prompt)
117
 
118
  # Create a new conversation thread and store the prompt and response
119
- thread_id = len(conversations) + 1
120
- conversations[thread_id] = {'prompt': prompt, 'responses': [response]}
121
-
122
- return {'thread_id': thread_id, 'response': response}
123
  except HTTPException:
124
  raise # Re-raise HTTPException to return it directly
125
  except Exception as e:
 
109
  raise HTTPException(status_code=400, detail="No prompt provided")
110
 
111
  # Check if conversations dictionary is empty
112
+ # if not conversations:
113
+ # raise HTTPException(status_code=404, detail="No chat history available")
114
 
115
  # Generate a response for the initial prompt
116
  response = generate_response(prompt)
117
 
118
  # Create a new conversation thread and store the prompt and response
119
+ ##conversations[thread_id] = {'prompt': prompt, 'responses': [response]}
120
+ #return {'thread_id': thread_id, 'response': response}
121
+ return {'response': response}
 
122
  except HTTPException:
123
  raise # Re-raise HTTPException to return it directly
124
  except Exception as e: