Skip to content

Commit

Permalink
Add CHATBOT_STREAMING envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
TamiTakamiya committed Feb 18, 2025
1 parent 91c8daa commit e833b89
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions ansible_ai_connect/main/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def is_ssl_enabled(value: str) -> bool:
# ------------------------------------------
CHATBOT_DEFAULT_PROVIDER = os.getenv("CHATBOT_DEFAULT_PROVIDER")
CHATBOT_DEBUG_UI = os.getenv("CHATBOT_DEBUG_UI", "False").lower() == "true"
CHATBOT_STREAMING = os.getenv("CHATBOT_STREAMING", "False").lower() == "true"
# ==========================================

# ==========================================
Expand Down
1 change: 1 addition & 0 deletions ansible_ai_connect/main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def test_chatbot_view_with_debug_ui(self):
self.assertEqual(r.status_code, HTTPStatus.OK)
self.assertContains(r, '<div id="debug" hidden>true</div>')

@override_settings(CHATBOT_STREAMING=True)
def test_chatbot_view_with_streaming_enabled(self):
llm: ModelPipelineChatBot = apps.get_app_config("ai").get_model_pipeline(
ModelPipelineChatBot
Expand Down
2 changes: 1 addition & 1 deletion ansible_ai_connect/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get_context_data(self, **kwargs):
if user and user.is_authenticated:
context["user_name"] = user.username
context["debug"] = "true" if settings.CHATBOT_DEBUG_UI else "false"
context["stream"] = "true" if self.llm.config.stream else "false"
context["stream"] = "true" if settings.CHATBOT_STREAMING else "false"

return context

Expand Down

0 comments on commit e833b89

Please sign in to comment.