Skip to content

Commit

Permalink
Merge pull request #40 from weni-ai/feature/adding-flows-integrations
Browse files Browse the repository at this point in the history
adidng route to get wenigpt response
  • Loading branch information
barbosajackson authored Jan 4, 2024
2 parents 9d0a356 + e5911cc commit 52ceefa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions nexus/intelligences/api/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ContentBaseViewset,
ContentBaseTextViewset,
ContentBaseFileViewset,
GenerativeIntelligenceQuestionAPIView,
)


Expand Down Expand Up @@ -37,4 +38,5 @@
path('<intelligence_uuid>/', include(intelligence_router.urls)),
path('<content_base_uuid>/', include(content_base_router.urls)),
path('v1/intelligences/content_bases/<project_uuid>/', FlowsIntelligencesApiView.as_view(), name="project-intelligences"),
path('v1/wenigpt_question', GenerativeIntelligenceQuestionAPIView.as_view(), name="wenigpt-question")
]
4 changes: 2 additions & 2 deletions nexus/intelligences/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ def get(self, request, project_uuid):
return Response(data=list_use_case.get_project_intelligences(project_uuid=project_uuid), status=200)


class GenerateIntelligenceQuestion(views.APIView):
class GenerativeIntelligenceQuestionAPIView(views.APIView):

def post(self, request):
authorization_header = request.headers.get("Authorization")
if not permissions.is_super_user(authorization_header):
return PermissionDenied("You has not permission to do that.")
data = request.data
intelligence_usecase = intelligences.IntelligenceGenerateSearchUseCase()
intelligence_usecase = intelligences.IntelligenceGenerativeSearchUseCase()
return Response(
data=intelligence_usecase.search(content_base_uuid=data.get("content_base_uuid"), text=data.get("text")),
status=200
Expand Down
2 changes: 1 addition & 1 deletion nexus/usecases/intelligences/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
)

from .search import (
IntelligenceGenerateSearchUseCase
IntelligenceGenerativeSearchUseCase
)
2 changes: 1 addition & 1 deletion nexus/usecases/intelligences/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from nexus.task_managers.file_database.wenigpt_database import WeniGPTDatabase


class IntelligenceGenerateSearchUseCase():
class IntelligenceGenerativeSearchUseCase():

def search(self, content_base_uuid: str, text: str):
response = SentenXFileDataBase().search_data(content_base_uuid, text)
Expand Down

0 comments on commit 52ceefa

Please sign in to comment.