Fix gzip breaks streaming and flush stream

This commit is contained in:
shamoon
2025-04-25 22:39:25 -07:00
parent 0690fd36c5
commit 6f0c6f39b1
3 changed files with 20 additions and 2 deletions

View File

@@ -1177,6 +1177,7 @@ class DocumentViewSet(
@method_decorator(login_required, name="dispatch")
class ChatStreamingView(View):
def post(self, request):
request.compress_exempt = True
ai_config = AIConfig()
if not ai_config.ai_enabled:
return HttpResponseBadRequest("AI is required for this feature")
@@ -1207,7 +1208,7 @@ class ChatStreamingView(View):
response = StreamingHttpResponse(
stream_chat_with_documents(query_str=question, documents=documents),
content_type="text/plain",
content_type="text/event-stream",
)
response["Cache-Control"] = "no-cache"
return response