Skip to content

Commit bca320c

Browse files
authored
chore(trace ai queries): Remove param (#95451)
- remove `use_flyout` param
1 parent ae0716e commit bca320c

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/sentry/api/endpoints/trace_explorer_ai_query.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import requests
88
from django.conf import settings
99
from rest_framework import status
10+
from rest_framework.request import Request
1011
from rest_framework.response import Response
1112

1213
from sentry import features
@@ -20,8 +21,6 @@
2021

2122
logger = logging.getLogger(__name__)
2223

23-
from rest_framework.request import Request
24-
2524

2625
def send_translate_request(
2726
org_id: int, org_slug: str, project_ids: list[int], natural_language_query: str
@@ -69,12 +68,14 @@ def post(request: Request, organization: Organization) -> Response:
6968
Request to translate a natural language query into a sentry EQS query.
7069
"""
7170
if not request.user.is_authenticated:
72-
return Response(status=status.HTTP_400_BAD_REQUEST)
71+
return Response(
72+
{"detail": "User is not authenticated"},
73+
status=status.HTTP_400_BAD_REQUEST,
74+
)
7375

7476
project_ids = [int(x) for x in request.data.get("project_ids", [])]
7577
natural_language_query = request.data.get("natural_language_query")
7678
limit = request.data.get("limit", 1)
77-
use_flyout = request.data.get("use_flyout", True)
7879

7980
if len(project_ids) == 0 or not natural_language_query:
8081
return Response(
@@ -109,15 +110,6 @@ def post(request: Request, organization: Organization) -> Response:
109110
organization.id, organization.slug, project_ids, natural_language_query
110111
)
111112

112-
# XXX: This is a fallback to support the old response format until we fully support using multiple queries on the frontend
113-
if "responses" in data and use_flyout:
114-
if not data["responses"]:
115-
logger.info("No results found for query")
116-
return Response(
117-
{"detail": "No results found for query"},
118-
status=status.HTTP_404_NOT_FOUND,
119-
)
120-
data = data["responses"][0]
121113
if "responses" not in data:
122114
return Response(
123115
{

0 commit comments

Comments
 (0)