Skip to content
FeedunaDeveloper docs

Send feedback on AI answers to Linear.

When a customer flags a wrong answer, give your team the exact version they saw. Link to the saved answer from the Linear issue, even after the answer is regenerated.

14 days free

Try the answer example

Simulated

Can you ship to a PO box?

We ship to street addresses via UPS and FedEx.

Source: Shipping policy, revision 4 · Street addresses

ans_7f3a9c_v2

Linear draft

Report this answer, regenerate it, then open the reported version from the draft.

Add a report button

Install the widget once, then put this button next to an answer. Add the status element and click handler once per page. Replace the sample ID with the version you rendered, including when an answer is regenerated.

Report this answer
<button type="button" data-feeduna-answer-id="ans_7f3a9c_v2">
  Report this answer
</button>
<p id="feeduna-answer-status" role="status"></p>
<script>
  const feedbackStatus = document.getElementById("feeduna-answer-status");

  document.addEventListener("click", (event) => {
    const button = event.target?.closest?.("button[data-feeduna-answer-id]");
    if (!button) return;

    const opened = window.Feeduna?.feedbackFor?.({
      type: "data_result",
      collection: "ai.answers",
      id: button.dataset.feedunaAnswerId,
      label: "AI answer",
      // Use this only if your app has a route to the saved version.
      // path: "/answers/" + button.dataset.feedunaAnswerId,
    });
    feedbackStatus.textContent = opened ? "" : "Couldn’t open feedback. Please try again.";
  });
</script>

Use an opaque ID you can look up in your own system. Keep prompts, answer text and personal data out of the reference fields. If your site blocks inline scripts, move the click handler into your existing JavaScript bundle.

If your app has a route for the saved version, pass its path as target.path, for example /answers/ans_7f3a9c_v2. Protect that route with your app’s existing sign-in and access checks. Use an opaque ID in the path and leave out query strings, fragments, tokens and private content.

Using Vercel AI SDK?

In AI SDK 7, attach a fresh version ID to each generation through message metadata. A continued answer can keep the same chat message ID. Try reporting an answer and regenerating it to see which version opens from Linear. In your existing route, makesaveAnswerVersion insert a version under its ID so your team can still look it up after regeneration. Keep that lookup behind your app’s access controls.

AI SDK 7 · Chat route
import {
  createUIMessageStreamResponse,
  toUIMessageStream,
  type UIMessage,
} from "ai";

type ChatMessage = UIMessage<{ answerVersionId?: string }>;

// In your existing chat route after access checks and streamText().
// messages is the ChatMessage[] used to start this generation.
const answerVersionId = crypto.randomUUID();

return createUIMessageStreamResponse({
  stream: toUIMessageStream({
    stream: result.stream,
    originalMessages: messages,
    messageMetadata: ({ part }) =>
      part.type === "start" ? { answerVersionId } : undefined,
    onEnd: async ({ outcome, responseMessage }) => {
      if (outcome.status !== "completed") return;
      await saveAnswerVersion(answerVersionId, responseMessage);
    },
  }),
});

Use the same message type in useChat. Keep the status element and click handler from the first example. Replace its example button with this JSX inside the loop that renders your messages.

AI SDK 7 · Report button
{status === "ready" &&
  message.role === "assistant" &&
  message.metadata?.answerVersionId && (
    <button type="button" data-feeduna-answer-id={message.metadata.answerVersionId}>
      Report this answer
    </button>
  )}

Check the first report

Click Report this answer on your page. The feedback form shows the attached answer so the reporter can check or remove it. Send a test message and check the answer ID and any saved-answer link in your Feeduna inbox.

Review the issue in Feeduna

Connect Linear and open the report. Use Prepare with AI if you want help turning it into a draft. Check the description and answer reference, then send the issue to Linear. If you supplied a path, ask a teammate to open the saved answer from the issue.