From e19cb6bb66aa3e482a6025f4da414aebcdf2a595 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 22 Apr 2025 21:13:54 -0700 Subject: [PATCH 1/3] ref(feedback): display crash report icon for django endpoint feedbacks --- .../devtoolbar/components/feedback/feedbackPanel.tsx | 5 ++--- .../components/feedback/list/feedbackListItem.tsx | 12 ++++++++---- static/app/utils/feedback/types.tsx | 6 ++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx index 6b0deae752b6..a6536f12fbc5 100644 --- a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx +++ b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx @@ -40,6 +40,7 @@ import Placeholder from 'sentry/components/placeholder'; import TextOverflow from 'sentry/components/textOverflow'; import TimeSince from 'sentry/components/timeSince'; import {IconChat, IconFatal, IconImage, IconMegaphone, IconPlay} from 'sentry/icons'; +import {CRASH_REPORT_SOURCES} from 'sentry/utils/feedback/types'; import useReplayCount from 'sentry/utils/replayCount/useReplayCount'; import useInfiniteFeedbackList from './useInfiniteFeedbackList'; @@ -141,9 +142,7 @@ function FeedbackListItem({item}: {item: FeedbackIssueListItem}) { const {feedbackHasReplay} = useReplayCountForFeedbacks(); const hasReplayId = feedbackHasReplay(item.id); - const isFatal = ['crash_report_embed_form', 'user_report_envelope'].includes( - item.metadata.source ?? '' - ); + const isFatal = CRASH_REPORT_SOURCES.includes(item.metadata.source ?? ''); const hasAttachments = item.latestEventHasAttachments; const hasComments = item.numComments > 0; diff --git a/static/app/components/feedback/list/feedbackListItem.tsx b/static/app/components/feedback/list/feedbackListItem.tsx index d475fc26e593..43db81a125e0 100644 --- a/static/app/components/feedback/list/feedbackListItem.tsx +++ b/static/app/components/feedback/list/feedbackListItem.tsx @@ -16,7 +16,10 @@ import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {Group} from 'sentry/types/group'; import {trackAnalytics} from 'sentry/utils/analytics'; -import type {FeedbackIssueListItem} from 'sentry/utils/feedback/types'; +import { + CRASH_REPORT_SOURCES, + type FeedbackIssueListItem, +} from 'sentry/utils/feedback/types'; import {decodeScalar} from 'sentry/utils/queryString'; import useReplayCountForFeedbacks from 'sentry/utils/replayCount/useReplayCountForFeedbacks'; import useLocationQuery from 'sentry/utils/url/useLocationQuery'; @@ -47,8 +50,9 @@ function FeedbackListItem({feedbackItem, isSelected, onSelect, style, ref}: Prop const hasReplayId = feedbackHasReplay(feedbackItem.id); const location = useLocation(); - const isCrashReport = feedbackItem.metadata.source === 'crash_report_embed_form'; - const isUserReportWithError = feedbackItem.metadata.source === 'user_report_envelope'; + const hasLinkedError = CRASH_REPORT_SOURCES.includes( + feedbackItem.metadata.source ?? '' + ); const hasAttachments = feedbackItem.latestEventHasAttachments; const hasComments = feedbackItem.numComments > 0; @@ -135,7 +139,7 @@ function FeedbackListItem({feedbackItem, isSelected, onSelect, style, ref}: Prop )} - {(isCrashReport || isUserReportWithError) && ( + {hasLinkedError && ( diff --git a/static/app/utils/feedback/types.tsx b/static/app/utils/feedback/types.tsx index b77cb3bc086c..27982b7c27b2 100644 --- a/static/app/utils/feedback/types.tsx +++ b/static/app/utils/feedback/types.tsx @@ -50,3 +50,9 @@ export type FeedbackIssueListItem = Overwrite< project?: Project; } >; + +export const CRASH_REPORT_SOURCES: string[] = [ + 'user_report_envelope', + 'user_report_sentry_django_endpoint', + 'crash_report_embed_form', +] as const; From 110f97775948ae063048a3f762d5c1b41b8bf1c2 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 6 May 2025 11:42:17 -0700 Subject: [PATCH 2/3] Make linkedError file --- src/sentry/runner/commands/llm.py | 29 +++++++++++++++++-- .../components/feedback/feedbackPanel.tsx | 4 +-- .../feedback/list/feedbackListItem.tsx | 10 ++----- static/app/utils/feedback/hasLinkedError.tsx | 11 +++++++ static/app/utils/feedback/types.tsx | 6 ---- 5 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 static/app/utils/feedback/hasLinkedError.tsx diff --git a/src/sentry/runner/commands/llm.py b/src/sentry/runner/commands/llm.py index f6221a97b3dd..488e5b1f134a 100644 --- a/src/sentry/runner/commands/llm.py +++ b/src/sentry/runner/commands/llm.py @@ -1,6 +1,30 @@ import click +def make_input_prompt(message: str): + # if you decide not to lower-case the message, remember to add capitals to the examples + return f"""**Classification Task** +**Instructions: Please analyze the following input and output `spam` if the input is not coherent, and `notspam` if it is coherent. If the user is frustrated but describing a problem, that is notspam** +**Label Options:** spam, notspam + +**Few-shot Examples:** +* **Example 1:** "asdasdfasd" -> spam +* **Example 2:** "it doesn't work," -> notspam +* **Example 3:** "es funktioniert nicht" -> notspam +* **Example 4:** "is there another way to do payment?" -> notspam +* **Example 5:** "this thing does not function how it should" -> notspam +* **Example 6:** "i was playing a great game now it crashed" -> notspam +* **Example 7:** "i can't login to my account wtf??!" -> notspam +* **Example 8:** "ฉันไม่สามารถเข้าสู่ระบบและไม่มีอะไรทำงาน " -> notspam +* **Example 9:** "crashed" -> notspam +* **Example 10:** "my game glitched grrrr!!!!" -> notspam +* **Example 11:** "this piece of junk does not work!!!" -> notspam + +**Input Text:** "{message.lower()}" + +**Classify:** """ + + @click.command("llm") @click.option("--usecase", default="example") def llm(usecase: str) -> None: @@ -14,8 +38,9 @@ def llm(usecase: str) -> None: llm_response = complete_prompt( usecase=LLMUseCase(usecase), - prompt="prompt here", - message="message here", + message=make_input_prompt("this thing does not function how it should"), + temperature=0, + max_output_tokens=20, ) click.echo(llm_response) diff --git a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx index a6536f12fbc5..bdb9add17f78 100644 --- a/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx +++ b/static/app/components/devtoolbar/components/feedback/feedbackPanel.tsx @@ -40,7 +40,7 @@ import Placeholder from 'sentry/components/placeholder'; import TextOverflow from 'sentry/components/textOverflow'; import TimeSince from 'sentry/components/timeSince'; import {IconChat, IconFatal, IconImage, IconMegaphone, IconPlay} from 'sentry/icons'; -import {CRASH_REPORT_SOURCES} from 'sentry/utils/feedback/types'; +import hasLinkedError from 'sentry/utils/feedback/hasLinkedError'; import useReplayCount from 'sentry/utils/replayCount/useReplayCount'; import useInfiniteFeedbackList from './useInfiniteFeedbackList'; @@ -142,7 +142,7 @@ function FeedbackListItem({item}: {item: FeedbackIssueListItem}) { const {feedbackHasReplay} = useReplayCountForFeedbacks(); const hasReplayId = feedbackHasReplay(item.id); - const isFatal = CRASH_REPORT_SOURCES.includes(item.metadata.source ?? ''); + const isFatal = hasLinkedError(item); const hasAttachments = item.latestEventHasAttachments; const hasComments = item.numComments > 0; diff --git a/static/app/components/feedback/list/feedbackListItem.tsx b/static/app/components/feedback/list/feedbackListItem.tsx index 43db81a125e0..c7101b6e95ec 100644 --- a/static/app/components/feedback/list/feedbackListItem.tsx +++ b/static/app/components/feedback/list/feedbackListItem.tsx @@ -16,10 +16,8 @@ import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {Group} from 'sentry/types/group'; import {trackAnalytics} from 'sentry/utils/analytics'; -import { - CRASH_REPORT_SOURCES, - type FeedbackIssueListItem, -} from 'sentry/utils/feedback/types'; +import feedbackHasLinkedError from 'sentry/utils/feedback/hasLinkedError'; +import {type FeedbackIssueListItem} from 'sentry/utils/feedback/types'; import {decodeScalar} from 'sentry/utils/queryString'; import useReplayCountForFeedbacks from 'sentry/utils/replayCount/useReplayCountForFeedbacks'; import useLocationQuery from 'sentry/utils/url/useLocationQuery'; @@ -50,9 +48,7 @@ function FeedbackListItem({feedbackItem, isSelected, onSelect, style, ref}: Prop const hasReplayId = feedbackHasReplay(feedbackItem.id); const location = useLocation(); - const hasLinkedError = CRASH_REPORT_SOURCES.includes( - feedbackItem.metadata.source ?? '' - ); + const hasLinkedError = feedbackHasLinkedError(feedbackItem); const hasAttachments = feedbackItem.latestEventHasAttachments; const hasComments = feedbackItem.numComments > 0; diff --git a/static/app/utils/feedback/hasLinkedError.tsx b/static/app/utils/feedback/hasLinkedError.tsx new file mode 100644 index 000000000000..63939a527e85 --- /dev/null +++ b/static/app/utils/feedback/hasLinkedError.tsx @@ -0,0 +1,11 @@ +import type {FeedbackIssueListItem} from 'sentry/utils/feedback/types'; + +const CRASH_REPORT_SOURCES: string[] = [ + 'user_report_envelope', + 'user_report_sentry_django_endpoint', + 'crash_report_embed_form', +] as const; + +export default function hasLinkedError(item: FeedbackIssueListItem): boolean { + return CRASH_REPORT_SOURCES.includes(item.metadata.source ?? ''); +} diff --git a/static/app/utils/feedback/types.tsx b/static/app/utils/feedback/types.tsx index 27982b7c27b2..b77cb3bc086c 100644 --- a/static/app/utils/feedback/types.tsx +++ b/static/app/utils/feedback/types.tsx @@ -50,9 +50,3 @@ export type FeedbackIssueListItem = Overwrite< project?: Project; } >; - -export const CRASH_REPORT_SOURCES: string[] = [ - 'user_report_envelope', - 'user_report_sentry_django_endpoint', - 'crash_report_embed_form', -] as const; From 2692b2c2289b9a6d203188fb5e1d9c4c367608f7 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 6 May 2025 11:43:25 -0700 Subject: [PATCH 3/3] Revert llm --- src/sentry/runner/commands/llm.py | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/sentry/runner/commands/llm.py b/src/sentry/runner/commands/llm.py index 488e5b1f134a..f6221a97b3dd 100644 --- a/src/sentry/runner/commands/llm.py +++ b/src/sentry/runner/commands/llm.py @@ -1,30 +1,6 @@ import click -def make_input_prompt(message: str): - # if you decide not to lower-case the message, remember to add capitals to the examples - return f"""**Classification Task** -**Instructions: Please analyze the following input and output `spam` if the input is not coherent, and `notspam` if it is coherent. If the user is frustrated but describing a problem, that is notspam** -**Label Options:** spam, notspam - -**Few-shot Examples:** -* **Example 1:** "asdasdfasd" -> spam -* **Example 2:** "it doesn't work," -> notspam -* **Example 3:** "es funktioniert nicht" -> notspam -* **Example 4:** "is there another way to do payment?" -> notspam -* **Example 5:** "this thing does not function how it should" -> notspam -* **Example 6:** "i was playing a great game now it crashed" -> notspam -* **Example 7:** "i can't login to my account wtf??!" -> notspam -* **Example 8:** "ฉันไม่สามารถเข้าสู่ระบบและไม่มีอะไรทำงาน " -> notspam -* **Example 9:** "crashed" -> notspam -* **Example 10:** "my game glitched grrrr!!!!" -> notspam -* **Example 11:** "this piece of junk does not work!!!" -> notspam - -**Input Text:** "{message.lower()}" - -**Classify:** """ - - @click.command("llm") @click.option("--usecase", default="example") def llm(usecase: str) -> None: @@ -38,9 +14,8 @@ def llm(usecase: str) -> None: llm_response = complete_prompt( usecase=LLMUseCase(usecase), - message=make_input_prompt("this thing does not function how it should"), - temperature=0, - max_output_tokens=20, + prompt="prompt here", + message="message here", ) click.echo(llm_response)