-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented the mentor's backend. #1492
base: 1604-implement-ai-mentor
Are you sure you want to change the base?
Implemented the mentor's backend. #1492
Conversation
…ion-service-with-chatgpt
Services/Mentor/OJS.Services.Mentor.Business/OJS.Services.Mentor.Business.csproj
Show resolved
Hide resolved
|
||
if (userMentor.RequestsMade > (userMentor.QuotaLimit ?? GetNumericValue(settings, nameof(MentorQuotaLimit)))) | ||
{ | ||
throw new BusinessServiceException($"You have reached your message limit, please try again after {GetTimeUntilNextMessage(userMentor.QuotaResetTime)}."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this displayed? I don't like throwing exception for expected (and frequent) behavior. We should handle this case by returning a message in the response model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to add another property to the response model just for this case? Aren't exceptions (BusinessServiceExceptions
), supposed to handle cases where the user has made a mistake / a user specific error has occurred and it has to be displayed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't consider this a user mistake. The user is not responsible to track the reset time. BusinessServiceException
indicates that some violation of the business logic has happened - and this is not a violation, but normal and totally expected behavior.
Apart from this, I don't like the BusinessServiceException
either. Better alternative would be to return a result with the error in the response, than throwing.. but this is another topic.
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
Services/Mentor/OJS.Services.Mentor.Business/Implementations/MentorBusinessService.cs
Outdated
Show resolved
Hide resolved
if (timeUntilReset.Seconds > 0) | ||
{ | ||
timeComponents.Add($"{timeUntilReset.Seconds} second{(timeUntilReset.Seconds > 1 ? "s" : "")}"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think seconds is not needed. Is this for a live counter?
{ | ||
if (rowData.Length > 0) | ||
{ | ||
rowData.Append(" ⦚ "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this symbol? Do we use it somewhere else? Maybe extract into a constant.
} | ||
} | ||
|
||
return resultContent.ToString().Trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for this to return empty string? We should handle it by adding the problem and contest name and instruct the bot to look for it in it's own data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…ion-service-with-chatgpt
Closes https://github.com/SoftUni-Internal/exam-systems-issues/issues/1609
Closes https://github.com/SoftUni-Internal/exam-systems-issues/issues/1605
Closes https://github.com/SoftUni-Internal/exam-systems-issues/issues/1610
Closes https://github.com/SoftUni-Internal/exam-systems-issues/issues/1608