diff --git a/backend/areas/models.py b/backend/areas/models.py index 12cdd46..e69afc1 100644 --- a/backend/areas/models.py +++ b/backend/areas/models.py @@ -44,6 +44,7 @@ class ModelFeedback(models.Model): comment = models.TextField() sourceLanguage = models.CharField(max_length=100,null=True,blank=True) targetLanguage = models.CharField(max_length=100,null=True,blank=True) + domain = models.CharField(max_length=100,null=True,blank=True) def __str__(self) -> str: return f"{self.id}_{self.serviceId}" diff --git a/backend/areas/serializers.py b/backend/areas/serializers.py index 4161ae2..3bfa89d 100644 --- a/backend/areas/serializers.py +++ b/backend/areas/serializers.py @@ -21,7 +21,7 @@ class Meta: class ModelFeedbackSerializer(ModelSerializer): class Meta: model = ModelFeedback - fields = ['id','serviceId','task','modelInput','modelResponse','comment','liked','postedOn','sourceLanguage','targetLanguage'] + fields = ['id','serviceId','task','modelInput','modelResponse','comment','liked','postedOn','sourceLanguage','targetLanguage','domain'] class ModelSerializer(ModelSerializer): class Meta: diff --git a/backend/areas/views.py b/backend/areas/views.py index 1c75279..b16fe2f 100644 --- a/backend/areas/views.py +++ b/backend/areas/views.py @@ -200,6 +200,9 @@ def create(self, request, *args, **kwargs): task = body["task"] sourceLanguage = body["sourceLanguage"] targetLanguage = body["targetLanguage"] + domain="general" + if "domain" in body: + domain = body["domain"] modelInput = body["modelInput"] modelResponse = body["modelResponse"] @@ -234,7 +237,7 @@ def create(self, request, *args, **kwargs): modelResponse = hashlib.sha256(modelResponse.encode()) modelResponse = modelResponse.hexdigest() - feedback = ModelFeedback(serviceId = body["serviceId"],task=task,modelInput=modelInput,modelResponse=modelResponse,liked=val2Bool(body["liked"]),comment=body["comment"],sourceLanguage=sourceLanguage,targetLanguage=targetLanguage) + feedback = ModelFeedback(serviceId = body["serviceId"],task=task,modelInput=modelInput,modelResponse=modelResponse,liked=val2Bool(body["liked"]),comment=body["comment"],sourceLanguage=sourceLanguage,targetLanguage=targetLanguage,domain=domain) feedback.save() return Response({"message":"Submitted Feedback"},status=status.HTTP_201_CREATED) diff --git a/frontend/components/Feedback.tsx b/frontend/components/Feedback.tsx index a8006af..a60b2a1 100644 --- a/frontend/components/Feedback.tsx +++ b/frontend/components/Feedback.tsx @@ -73,6 +73,7 @@ export default function Feedback({ modelResponse, sourceLanguage, targetLanguage, + domain, }: { serviceId: string; task: string; @@ -80,6 +81,7 @@ export default function Feedback({ modelResponse: string; sourceLanguage: string; targetLanguage: string; + domain: string; }) { const { isOpen, onOpen, onClose } = useDisclosure(); @@ -157,6 +159,7 @@ export default function Feedback({ modelResponse: modelResponse, sourceLanguage: sourceLanguage, targetLanguage: targetLanguage, + domain: domain, }); if (feedbackSubmitted) { toast({ diff --git a/frontend/components/TryOut/ASR.tsx b/frontend/components/TryOut/ASR.tsx index e8643e4..b040600 100644 --- a/frontend/components/TryOut/ASR.tsx +++ b/frontend/components/TryOut/ASR.tsx @@ -376,6 +376,7 @@ export default function ASR({ services }: { services: any }) { modelResponse={outputText} sourceLanguage={sourceLanguage} targetLanguage={""} + domain={domain} /> ) : ( <> diff --git a/frontend/components/TryOut/NMT.tsx b/frontend/components/TryOut/NMT.tsx index 33d8428..3f4bf96 100644 --- a/frontend/components/TryOut/NMT.tsx +++ b/frontend/components/TryOut/NMT.tsx @@ -232,6 +232,7 @@ export default function NMT({ services }: { services: any }) { modelResponse={outputText} sourceLanguage={sourceLanguage} targetLanguage={targetLanguage} + domain="general" /> ) : ( <> diff --git a/frontend/components/TryOut/TTS.tsx b/frontend/components/TryOut/TTS.tsx index ac1fecd..33dcbd5 100644 --- a/frontend/components/TryOut/TTS.tsx +++ b/frontend/components/TryOut/TTS.tsx @@ -242,6 +242,7 @@ export default function TTS({ services }: { services: any }) { modelResponse={output} sourceLanguage={sourceLanguage} targetLanguage="" + domain="general" /> ) : ( <>