Update app.py
Browse files
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 |
-
|
113 |
-
|
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 =
|
120 |
-
|
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:
|