Skip to content

Commit

Permalink
Import AI agent within view post code
Browse files Browse the repository at this point in the history
  • Loading branch information
mbertrand committed Jan 2, 2025
1 parent f832053 commit bd1a518
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ai_chat/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""learning_resources app config"""
"""ai_chat app config"""

from django.apps import AppConfig

Expand Down
3 changes: 2 additions & 1 deletion ai_chat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from rest_framework.request import Request

from ai_chat import serializers
from ai_chat.agents import SearchAgent
from ai_chat.permissions import SearchAgentPermissions

log = logging.getLogger(__name__)
Expand All @@ -34,6 +33,8 @@ class SearchAgentView(views.APIView):
)
def post(self, request: Request) -> StreamingHttpResponse:
"""Handle a POST request to the chatbot agent."""
from ai_chat.agents import SearchAgent

serializer = serializers.ChatRequestSerializer(
data=request.data, context={"request": request}
)
Expand Down
2 changes: 1 addition & 1 deletion main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"drf_spectacular",
# Put our apps after this point
"main",
"ai_chat",
"authentication",
"channels",
"profiles",
Expand All @@ -119,6 +118,7 @@
"testimonials",
"data_fixtures",
"vector_search",
"ai_chat",
)

if not get_bool("RUN_DATA_MIGRATIONS", default=False):
Expand Down
2 changes: 1 addition & 1 deletion main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
re_path(r"^o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
re_path(r"^admin/", admin.site.urls),
re_path(r"", include("authentication.urls")),
re_path(r"", include("ai_chat.urls")),
re_path(r"", include("channels.urls")),
re_path(r"", include("profiles.urls")),
re_path(r"", include("embedly.urls")),
Expand All @@ -58,7 +59,6 @@
re_path(r"", include("testimonials.urls")),
re_path(r"", include("news_events.urls")),
re_path(r"", include(features_router.urls)),
re_path(r"", include("ai_chat.urls")),
re_path(r"^app", RedirectView.as_view(url=settings.APP_BASE_URL)),
# Hijack
re_path(r"^hijack/", include("hijack.urls", namespace="hijack")),
Expand Down

0 comments on commit bd1a518

Please sign in to comment.