forked from github/plane
chore: remove logger from gpt assistant (#1542)
* chore: add triggered by details for notifications * dev: update issue activity json to include extra fields * chore: remove logger from gpt assistant
This commit is contained in:
parent
68108c9fe9
commit
52ee8c5615
@ -30,31 +30,6 @@ class GPTIntegrationEndpoint(BaseAPIView):
|
|||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
# If logger is enabled check for request limit
|
|
||||||
if settings.LOGGER_BASE_URL:
|
|
||||||
try:
|
|
||||||
headers = {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = requests.post(
|
|
||||||
settings.LOGGER_BASE_URL,
|
|
||||||
json={"user_id": str(request.user.id)},
|
|
||||||
headers=headers,
|
|
||||||
)
|
|
||||||
count = response.json().get("count", 0)
|
|
||||||
if not response.json().get("success", False):
|
|
||||||
return Response(
|
|
||||||
{
|
|
||||||
"error": "You have surpassed the monthly limit for AI assistance"
|
|
||||||
},
|
|
||||||
status=status.HTTP_429_TOO_MANY_REQUESTS,
|
|
||||||
)
|
|
||||||
except Exception as e:
|
|
||||||
capture_exception(e)
|
|
||||||
|
|
||||||
prompt = request.data.get("prompt", False)
|
prompt = request.data.get("prompt", False)
|
||||||
task = request.data.get("task", False)
|
task = request.data.get("task", False)
|
||||||
|
|
||||||
@ -82,7 +57,6 @@ class GPTIntegrationEndpoint(BaseAPIView):
|
|||||||
{
|
{
|
||||||
"response": text,
|
"response": text,
|
||||||
"response_html": text_html,
|
"response_html": text_html,
|
||||||
"count": count,
|
|
||||||
"project_detail": ProjectLiteSerializer(project).data,
|
"project_detail": ProjectLiteSerializer(project).data,
|
||||||
"workspace_detail": WorkspaceLiteSerializer(workspace).data,
|
"workspace_detail": WorkspaceLiteSerializer(workspace).data,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user