Skip to content

Commit

Permalink
fix(ai-help): enhance issue reporting (#9262)
Browse files Browse the repository at this point in the history
1. The first question was used as the issue title, not the last.
2. Multiple questions were separated with "---" (no line breaks).
  • Loading branch information
caugner authored Jul 8, 2023
1 parent eb8bde1 commit 2c9e4bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/plus/ai-help/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,18 +559,18 @@ function ReportIssueOnGitHubLink({
children: React.ReactNode;
}) {
const currentMessageIndex = messages.indexOf(currentMessage);
const firstMessage = messages[0];
const questions = messages
.slice(0, currentMessageIndex)
.filter((message) => message.role === MessageRole.User)
.map(({ content }) => content);
const lastQuestion = questions.at(-1);

const url = new URL("https://github.com/");
url.pathname = "/mdn/ai-feedback/issues/new";

const sp = new URLSearchParams();
sp.set("title", `[AI Help] Question: ${firstMessage.content}`);
sp.set("questions", questions.join("---"));
sp.set("title", `[AI Help] Question: ${lastQuestion}`);
sp.set("questions", questions.map((question) => `1. ${question}`).join("\n"));
sp.set("answer", currentMessage.content);
sp.set(
"sources",
Expand Down

0 comments on commit 2c9e4bb

Please sign in to comment.