This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from lvalics/main
Started to add swagger-ui docs
- Loading branch information
Showing
50 changed files
with
2,883 additions
and
1,176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.http import JsonResponse | ||
from web.models.chatbot import Chatbot | ||
from drf_spectacular.utils import extend_schema, OpenApiParameter | ||
from drf_spectacular.types import OpenApiTypes | ||
from rest_framework.decorators import api_view, parser_classes | ||
from rest_framework.parsers import MultiPartParser, FormParser | ||
|
||
|
||
@extend_schema( | ||
methods=['GET'], | ||
description="Get Chatbot info based on Bot ID", | ||
request=None, | ||
) | ||
@api_view(['GET']) | ||
def get_chatbot_info(request, bot_id): | ||
''' | ||
Easy way to get chatbot info based on Bot ID | ||
''' | ||
try: | ||
bot = Chatbot.objects.get(id=bot_id) | ||
return JsonResponse({'id': bot.id, 'name': bot.name}, status=200) | ||
except Chatbot.DoesNotExist: | ||
return JsonResponse({'error': 'Chatbot not found'}, status=404) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.