File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -212,10 +212,15 @@ async def handle_completion(
212
212
)
213
213
214
214
end_time = time .time ()
215
-
216
215
response_obj .usage .response_time = (end_time - start_time ) * 1000
217
216
218
- response_obj .choices [0 ].message .content = redact_words (model_name , response_obj .choices [0 ].message .content )
217
+ # Check if response is empty and replace with default message
218
+ content = response_obj .choices [0 ].message .content
219
+ if not content or content .strip () == "" :
220
+ response_obj .choices [0 ].message .content = "Sorry, I couldn't answer this question :("
221
+ else :
222
+ response_obj .choices [0 ].message .content = redact_words (model_name , content )
223
+
219
224
# Convert the usage object
220
225
response_obj .usage = Usage .from_response (response_obj )
221
226
You can’t perform that action at this time.
0 commit comments