Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove V0-only feedback functionality (#13821)

Tim O'Farrell0804abec803b
diff --git a/frontend/__tests__/components/event-message.test.tsx b/frontend/__tests__/components/event-message.test.tsx
deleted file mode 100644
index fe9a18c1d2..0000000000
--- a/frontend/__tests__/components/event-message.test.tsx
+++ /dev/null
@@ -1,192 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { screen } from "@testing-library/react";
-import { renderWithProviders } from "test-utils";
-import { EventMessage } from "#/components/features/chat/event-message";
-
-vi.mock("#/hooks/query/use-config", () => ({
- useConfig: () => ({
- data: { app_mode: "saas" },
- }),
-}));
-
-vi.mock("#/hooks/query/use-feedback-exists", () => ({
- useFeedbackExists: (eventId: number | undefined) => ({
- data: { exists: false },
- isLoading: false,
- }),
-}));
-
-describe("EventMessage", () => {
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("should render LikertScale for finish action when it's the last message", () => {
- const finishEvent = {
- id: 123,
- source: "agent" as const,
- action: "finish" as const,
- args: {
- final_thought: "Task completed successfully",
- outputs: {},
- thought: "Task completed successfully",
- },
- message: "Task completed successfully",
- timestamp: new Date().toISOString(),
- };
-
- renderWithProviders(
- <EventMessage
- event={finishEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={true}
- isInLast10Actions={true}
- />
- );
-
- expect(screen.getByLabelText("Rate 1 stars")).toBeInTheDocument();
- expect(screen.getByLabelText("Rate 5 stars")).toBeInTheDocument();
- });
-
- it("should render LikertScale for assistant message when it's the last message", () => {
- const assistantMessageEvent = {
- id: 456,
- source: "agent" as const,
- action: "message" as const,
- args: {
- thought: "I need more information to proceed.",
- image_urls: null,
- file_urls: [],
- wait_for_response: true,
- },
- message: "I need more information to proceed.",
- timestamp: new Date().toISOString(),
- };
-
- renderWithProviders(
- <EventMessage
- event={assistantMessageEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={true}
- isInLast10Actions={true}
- />
- );
-
- expect(screen.getByLabelText("Rate 1 stars")).toBeInTheDocument();
- expect(screen.getByLabelText("Rate 5 stars")).toBeInTheDocument();
- });
-
- it("should render LikertScale for error observation when it's the last message", () => {
- const errorEvent = {
- id: 789,
- source: "user" as const,
- observation: "error" as const,
- content: "An error occurred",
- extras: {
- error_id: "test-error-123",
- },
- message: "An error occurred",
- timestamp: new Date().toISOString(),
- cause: 123,
- };
-
- renderWithProviders(
- <EventMessage
- event={errorEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={true}
- isInLast10Actions={true}
- />
- );
-
- expect(screen.getByLabelText("Rate 1 stars")).toBeInTheDocument();
- expect(screen.getByLabelText("Rate 5 stars")).toBeInTheDocument();
- });
-
- it("should NOT render LikertScale when not the last message", () => {
- const finishEvent = {
- id: 101,
- source: "agent" as const,
- action: "finish" as const,
- args: {
- final_thought: "Task completed successfully",
- outputs: {},
- thought: "Task completed successfully",
- },
- message: "Task completed successfully",
- timestamp: new Date().toISOString(),
- };
-
- renderWithProviders(
- <EventMessage
- event={finishEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={false}
- isInLast10Actions={false}
- />
- );
-
- expect(screen.queryByLabelText("Rate 1 stars")).not.toBeInTheDocument();
- expect(screen.queryByLabelText("Rate 5 stars")).not.toBeInTheDocument();
- });
-
- it("should render LikertScale for error observation when in last 10 actions but not last message", () => {
- const errorEvent = {
- id: 999,
- source: "user" as const,
- observation: "error" as const,
- content: "An error occurred",
- extras: {
- error_id: "test-error-456",
- },
- message: "An error occurred",
- timestamp: new Date().toISOString(),
- cause: 123,
- };
-
- renderWithProviders(
- <EventMessage
- event={errorEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={false}
- isInLast10Actions={true}
- />
- );
-
- expect(screen.getByLabelText("Rate 1 stars")).toBeInTheDocument();
- expect(screen.getByLabelText("Rate 5 stars")).toBeInTheDocument();
- });
-
- it("should NOT render LikertScale for error observation when not in last 10 actions", () => {
- const errorEvent = {
- id: 888,
- source: "user" as const,
- observation: "error" as const,
- content: "An error occurred",
- extras: {
- error_id: "test-error-789",
- },
- message: "An error occurred",
- timestamp: new Date().toISOString(),
- cause: 123,
- };
-
- renderWithProviders(
- <EventMessage
- event={errorEvent}
- hasObservationPair={false}
- isAwaitingUserConfirmation={false}
- isLastMessage={false}
- isInLast10Actions={false}
- />
- );
-
- expect(screen.queryByLabelText("Rate 1 stars")).not.toBeInTheDocument();
- expect(screen.queryByLabelText("Rate 5 stars")).not.toBeInTheDocument();
- });
-});
diff --git a/frontend/__tests__/components/feedback-actions.test.tsx b/frontend/__tests__/components/feedback-actions.test.tsx
deleted file mode 100644
index 111adb2fac..0000000000
--- a/frontend/__tests__/components/feedback-actions.test.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { screen, within } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { renderWithProviders } from "test-utils";
-import { TrajectoryActions } from "#/components/features/trajectory/trajectory-actions";
-
-describe("TrajectoryActions", () => {
- const user = userEvent.setup();
- const onPositiveFeedback = vi.fn();
- const onNegativeFeedback = vi.fn();
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("should render correctly", () => {
- renderWithProviders(
- <TrajectoryActions
- onPositiveFeedback={onPositiveFeedback}
- onNegativeFeedback={onNegativeFeedback}
- />,
- );
-
- const actions = screen.getByTestId("feedback-actions");
- within(actions).getByTestId("positive-feedback");
- within(actions).getByTestId("negative-feedback");
- });
-
- it("should call onPositiveFeedback when positive feedback is clicked", async () => {
- renderWithProviders(
- <TrajectoryActions
- onPositiveFeedback={onPositiveFeedback}
- onNegativeFeedback={onNegativeFeedback}
- />,
- );
-
- const positiveFeedback = screen.getByTestId("positive-feedback");
- await user.click(positiveFeedback);
-
- expect(onPositiveFeedback).toHaveBeenCalled();
- });
-
- it("should call onNegativeFeedback when negative feedback is clicked", async () => {
- renderWithProviders(
- <TrajectoryActions
- onPositiveFeedback={onPositiveFeedback}
- onNegativeFeedback={onNegativeFeedback}
- />,
- );
-
- const negativeFeedback = screen.getByTestId("negative-feedback");
- await user.click(negativeFeedback);
-
- expect(onNegativeFeedback).toHaveBeenCalled();
- });
-
- describe("SaaS mode", () => {
- it("should render all buttons when isSaasMode is false", () => {
- renderWithProviders(
- <TrajectoryActions
- onPositiveFeedback={onPositiveFeedback}
- onNegativeFeedback={onNegativeFeedback}
- isSaasMode={false}
- />,
- );
-
- const actions = screen.getByTestId("feedback-actions");
- within(actions).getByTestId("positive-feedback");
- within(actions).getByTestId("negative-feedback");
- });
-
- it("should render all buttons when isSaasMode is undefined (default behavior)", () => {
- renderWithProviders(
- <TrajectoryActions
- onPositiveFeedback={onPositiveFeedback}
- onNegativeFeedback={onNegativeFeedback}
- />,
- );
-
- const actions = screen.getByTestId("feedback-actions");
- within(actions).getByTestId("positive-feedback");
- within(actions).getByTestId("negative-feedback");
- });
- });
-});
diff --git a/frontend/__tests__/components/feedback-form.test.tsx b/frontend/__tests__/components/feedback-form.test.tsx
deleted file mode 100644
index 6c571ee02b..0000000000
--- a/frontend/__tests__/components/feedback-form.test.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-
-// Mock useParams before importing components
-vi.mock("react-router", async () => {
- const actual = await vi.importActual("react-router");
- return {
- ...(actual as object),
- useParams: () => ({ conversationId: "test-conversation-id" }),
- };
-});
-
-import { screen } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "test-utils";
-import { FeedbackForm } from "#/components/features/feedback/feedback-form";
-import { I18nKey } from "#/i18n/declaration";
-
-describe("FeedbackForm", () => {
- const user = userEvent.setup();
- const onCloseMock = vi.fn();
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("should render correctly", () => {
- renderWithProviders(
- <FeedbackForm polarity="positive" onClose={onCloseMock} />,
- );
-
- screen.getByLabelText(I18nKey.FEEDBACK$EMAIL_LABEL);
- screen.getByLabelText(I18nKey.FEEDBACK$PRIVATE_LABEL);
- screen.getByLabelText(I18nKey.FEEDBACK$PUBLIC_LABEL);
-
- screen.getByRole("button", { name: I18nKey.FEEDBACK$SHARE_LABEL });
- screen.getByRole("button", { name: I18nKey.FEEDBACK$CANCEL_LABEL });
- });
-
- it("should switch between private and public permissions", async () => {
- renderWithProviders(
- <FeedbackForm polarity="positive" onClose={onCloseMock} />,
- );
- const privateRadio = screen.getByLabelText(I18nKey.FEEDBACK$PRIVATE_LABEL);
- const publicRadio = screen.getByLabelText(I18nKey.FEEDBACK$PUBLIC_LABEL);
-
- expect(privateRadio).toBeChecked(); // private is the default value
- expect(publicRadio).not.toBeChecked();
-
- await user.click(publicRadio);
- expect(publicRadio).toBeChecked();
- expect(privateRadio).not.toBeChecked();
-
- await user.click(privateRadio);
- expect(privateRadio).toBeChecked();
- expect(publicRadio).not.toBeChecked();
- });
-
- it("should call onClose when the close button is clicked", async () => {
- renderWithProviders(
- <FeedbackForm polarity="positive" onClose={onCloseMock} />,
- );
- await user.click(
- screen.getByRole("button", { name: I18nKey.FEEDBACK$CANCEL_LABEL }),
- );
-
- expect(onCloseMock).toHaveBeenCalled();
- });
-});
diff --git a/frontend/__tests__/components/likert-scale.test.tsx b/frontend/__tests__/components/likert-scale.test.tsx
deleted file mode 100644
index f26f9fe6b9..0000000000
--- a/frontend/__tests__/components/likert-scale.test.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { screen, waitFor } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "test-utils";
-import { LikertScale } from "#/components/features/feedback/likert-scale";
-import { I18nKey } from "#/i18n/declaration";
-
-// Mock the mutation hook
-vi.mock("#/hooks/mutation/use-submit-conversation-feedback", () => ({
- useSubmitConversationFeedback: () => ({
- mutate: vi.fn(),
- }),
-}));
-
-describe("LikertScale", () => {
- const user = userEvent.setup();
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("should render with proper localized text for rating prompt", () => {
- renderWithProviders(<LikertScale eventId={1} />);
-
- // Check that the rating prompt is displayed with proper translation key
- expect(screen.getByText(I18nKey.FEEDBACK$RATE_AGENT_PERFORMANCE)).toBeInTheDocument();
- });
-
- it("should show localized feedback reasons when rating is 3 or below", async () => {
- renderWithProviders(<LikertScale eventId={1} />);
-
- // Click on a rating of 3 (which should show reasons)
- const threeStarButton = screen.getAllByRole("button")[2]; // 3rd button (rating 3)
- await user.click(threeStarButton);
-
- // Wait for reasons to appear
- await waitFor(() => {
- expect(screen.getByText(I18nKey.FEEDBACK$SELECT_REASON)).toBeInTheDocument();
- });
-
- // Check that all feedback reasons are properly localized
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_MISUNDERSTOOD_INSTRUCTION)).toBeInTheDocument();
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_FORGOT_CONTEXT)).toBeInTheDocument();
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_UNNECESSARY_CHANGES)).toBeInTheDocument();
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_SHOULD_ASK_FIRST)).toBeInTheDocument();
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_DIDNT_FINISH_JOB)).toBeInTheDocument();
- expect(screen.getByText(I18nKey.FEEDBACK$REASON_OTHER)).toBeInTheDocument();
- });
-
- it("should show countdown message with proper localization", async () => {
- renderWithProviders(<LikertScale eventId={1} />);
-
- // Click on a rating of 2 (which should show reasons and countdown)
- const twoStarButton = screen.getAllByRole("button")[1]; // 2nd button (rating 2)
- await user.click(twoStarButton);
-
- // Wait for countdown to appear
- await waitFor(() => {
- expect(screen.getByText(I18nKey.FEEDBACK$SELECT_REASON_COUNTDOWN)).toBeInTheDocument();
- });
- });
-
- it("should show thank you message after submission", () => {
- renderWithProviders(
- <LikertScale eventId={1} initiallySubmitted={true} initialRating={4} />
- );
-
- // Check that thank you message is displayed with proper translation key
- expect(screen.getByText(I18nKey.FEEDBACK$THANK_YOU_FOR_FEEDBACK)).toBeInTheDocument();
- });
-
- it("should render all 5 star rating buttons", () => {
- renderWithProviders(<LikertScale eventId={1} />);
-
- // Check that all 5 star buttons are rendered
- const starButtons = screen.getAllByRole("button");
- expect(starButtons).toHaveLength(5);
-
- // Check that each button has proper aria-label
- for (let i = 1; i <= 5; i++) {
- expect(screen.getByLabelText(`Rate ${i} stars`)).toBeInTheDocument();
- }
- });
-
- it("should not show reasons for ratings above 3", async () => {
- renderWithProviders(<LikertScale eventId={1} />);
-
- // Click on a rating of 5 (which should NOT show reasons)
- const fiveStarButton = screen.getAllByRole("button")[4]; // 5th button (rating 5)
- await user.click(fiveStarButton);
-
- // Wait a bit to ensure reasons don't appear
- await waitFor(() => {
- expect(screen.queryByText(I18nKey.FEEDBACK$SELECT_REASON)).not.toBeInTheDocument();
- });
- });
-});
diff --git a/frontend/src/api/conversation-service/conversation-service.api.ts b/frontend/src/api/conversation-service/conversation-service.api.ts
index 18546bcf70..20bd3871cc 100644
--- a/frontend/src/api/conversation-service/conversation-service.api.ts
+++ b/frontend/src/api/conversation-service/conversation-service.api.ts
@@ -1,7 +1,5 @@
import { AxiosHeaders } from "axios";
import {
- Feedback,
- FeedbackResponse,
GetVSCodeUrlResponse,
Conversation,
ResultSet,
@@ -15,7 +13,6 @@ import {
import { openHands } from "../open-hands-axios";
import { Provider } from "#/types/settings";
import { SuggestedTask } from "#/utils/types";
-import { BatchFeedbackData } from "#/hooks/query/use-batch-feedback";
class ConversationService {
private static currentConversation: Conversation | null = null;
@@ -59,105 +56,6 @@ class ConversationService {
return headers;
}
- /**
- * Send feedback to the server
- * @param data Feedback data
- * @returns The stored feedback data
- */
- static async submitFeedback(
- conversationId: string,
- feedback: Feedback,
- ): Promise<FeedbackResponse> {
- const url = `/api/conversations/${conversationId}/submit-feedback`;
- const { data } = await openHands.post<FeedbackResponse>(url, feedback);
- return data;
- }
-
- /**
- * Submit conversation feedback with rating
- * @param conversationId The conversation ID
- * @param rating The rating (1-5)
- * @param eventId Optional event ID this feedback corresponds to
- * @param reason Optional reason for the rating
- * @returns Response from the feedback endpoint
- */
- static async submitConversationFeedback(
- conversationId: string,
- rating: number,
- eventId?: number,
- reason?: string,
- ): Promise<{ status: string; message: string }> {
- const url = `/feedback/conversation`;
- const payload = {
- conversation_id: conversationId,
- event_id: eventId,
- rating,
- reason,
- metadata: { source: "likert-scale" },
- };
- const { data } = await openHands.post<{ status: string; message: string }>(
- url,
- payload,
- );
- return data;
- }
-
- /**
- * Check if feedback exists for a specific conversation and event
- * @param conversationId The conversation ID
- * @param eventId The event ID to check
- * @returns Feedback data including existence, rating, and reason
- */
- static async checkFeedbackExists(
- conversationId: string,
- eventId: number,
- ): Promise<{ exists: boolean; rating?: number; reason?: string }> {
- try {
- const url = `/feedback/conversation/${conversationId}/${eventId}`;
- const { data } = await openHands.get<{
- exists: boolean;
- rating?: number;
- reason?: string;
- }>(url);
- return data;
- } catch {
- // Error checking if feedback exists
- return { exists: false };
- }
- }
-
- /**
- * Get feedback for multiple events in a conversation
- * @param conversationId The conversation ID
- * @returns Map of event IDs to feedback data including existence, rating, reason and metadata
- */
- static async getBatchFeedback(conversationId: string): Promise<
- Record<
- string,
- {
- exists: boolean;
- rating?: number;
- reason?: string;
- metadata?: Record<string, BatchFeedbackData>;
- }
- >
- > {
- const url = `/feedback/conversation/${conversationId}/batch`;
- const { data } = await openHands.get<
- Record<
- string,
- {
- exists: boolean;
- rating?: number;
- reason?: string;
- metadata?: Record<string, BatchFeedbackData>;
- }
- >
- >(url);
-
- return data;
- }
-
/**
* Get the web hosts
* @returns Array of web hosts
diff --git a/frontend/src/components/features/chat/chat-interface.tsx b/frontend/src/components/features/chat/chat-interface.tsx
index 3b11a2fbc4..34f12ae53d 100644
--- a/frontend/src/components/features/chat/chat-interface.tsx
+++ b/frontend/src/components/features/chat/chat-interface.tsx
@@ -3,12 +3,10 @@ import { usePostHog } from "posthog-js/react";
import { useParams } from "react-router";
import { useTranslation } from "react-i18next";
import { convertImageToBase64 } from "#/utils/convert-image-to-base-64";
-import { TrajectoryActions } from "../trajectory/trajectory-actions";
import { createChatMessage } from "#/services/chat-service";
import { InteractiveChatBox } from "./interactive-chat-box";
import { AgentState } from "#/types/agent-state";
import { useFilteredEvents } from "#/hooks/use-filtered-events";
-import { FeedbackModal } from "../feedback/feedback-modal";
import { useScrollToBottom } from "#/hooks/use-scroll-to-bottom";
import { TypingIndicator } from "./typing-indicator";
import { useWsClient } from "#/context/ws-client-provider";
@@ -29,7 +27,6 @@ import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-
import { ErrorMessageBanner } from "./error-message-banner";
import { Messages as V1Messages } from "#/components/v1/chat";
import { useUnifiedUploadFiles } from "#/hooks/mutation/use-unified-upload-files";
-import { useConfig } from "#/hooks/query/use-config";
import { validateFiles } from "#/utils/file-validation";
import { useConversationStore } from "#/stores/conversation-store";
import ConfirmationModeEnabled from "./confirmation-mode-enabled";
@@ -81,7 +78,6 @@ export function ChatInterface() {
setAutoScroll,
setHitBottom,
} = useScrollToBottom(scrollRef);
- const { data: config } = useConfig();
const {
mutate: newConversationCommand,
isPending: isNewConversationPending,
@@ -120,10 +116,6 @@ export function ChatInterface() {
};
}, [isAgentRunning, handleBuildPlanClick, scrollDomToBottom]);
- const [feedbackPolarity, setFeedbackPolarity] = React.useState<
- "positive" | "negative"
- >("positive");
- const [feedbackModalIsOpen, setFeedbackModalIsOpen] = React.useState(false);
const { selectedRepository, replayJson } = useInitialQueryStore();
const params = useParams();
const { mutateAsync: uploadFiles } = useUnifiedUploadFiles();
@@ -228,13 +220,6 @@ export function ChatInterface() {
setMessageToSend("");
};
- const onClickShareFeedbackActionButton = async (
- polarity: "positive" | "negative",
- ) => {
- setFeedbackModalIsOpen(true);
- setFeedbackPolarity(polarity);
- };
-
// Auto-scroll to bottom when new messages arrive
React.useEffect(() => {
if (autoScroll) {
@@ -338,17 +323,6 @@ export function ChatInterface() {
status={serverStatusText}
/>
)}
- {totalEvents > 0 && !isV1Conversation && (
- <TrajectoryActions
- onPositiveFeedback={() =>
- onClickShareFeedbackActionButton("positive")
- }
- onNegativeFeedback={() =>
- onClickShareFeedbackActionButton("negative")
- }
- isSaasMode={config?.app_mode === "saas"}
- />
- )}
</div>
<div className="absolute left-1/2 transform -translate-x-1/2 bottom-0">
@@ -370,14 +344,6 @@ export function ChatInterface() {
disabled={isNewConversationPending}
/>
</div>
-
- {config?.app_mode !== "saas" && !isV1Conversation && (
- <FeedbackModal
- isOpen={feedbackModalIsOpen}
- onClose={() => setFeedbackModalIsOpen(false)}
- polarity={feedbackPolarity}
- />
- )}
</div>
</ScrollProvider>
);
diff --git a/frontend/src/components/features/chat/event-message-components/error-event-message.tsx b/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
index 3cea5f2127..8f2a7b7368 100644
--- a/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
@@ -1,48 +1,20 @@
-import React from "react";
import { OpenHandsObservation } from "#/types/core/observations";
import { isErrorObservation } from "#/types/core/guards";
import { ErrorMessage } from "../error-message";
-import { LikertScaleWrapper } from "./likert-scale-wrapper";
interface ErrorEventMessageProps {
event: OpenHandsObservation;
- isLastMessage: boolean;
- isInLast10Actions: boolean;
- config?: { app_mode?: string } | null;
- isCheckingFeedback: boolean;
- feedbackData: {
- exists: boolean;
- rating?: number;
- reason?: string;
- };
}
-export function ErrorEventMessage({
- event,
- isLastMessage,
- isInLast10Actions,
- config,
- isCheckingFeedback,
- feedbackData,
-}: ErrorEventMessageProps) {
+export function ErrorEventMessage({ event }: ErrorEventMessageProps) {
if (!isErrorObservation(event)) {
return null;
}
return (
- <div>
- <ErrorMessage
- errorId={event.extras.error_id}
- defaultMessage={event.message}
- />
- <LikertScaleWrapper
- event={event}
- isLastMessage={isLastMessage}
- isInLast10Actions={isInLast10Actions}
- config={config}
- isCheckingFeedback={isCheckingFeedback}
- feedbackData={feedbackData}
- />
- </div>
+ <ErrorMessage
+ errorId={event.extras.error_id}
+ defaultMessage={event.message}
+ />
);
}
diff --git a/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx b/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
index b4480e36e0..2d3eb34944 100644
--- a/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
@@ -2,45 +2,16 @@ import React from "react";
import { OpenHandsAction } from "#/types/core/actions";
import { isFinishAction } from "#/types/core/guards";
import { ChatMessage } from "../chat-message";
-import { LikertScaleWrapper } from "./likert-scale-wrapper";
import { getEventContent } from "../event-content-helpers/get-event-content";
interface FinishEventMessageProps {
event: OpenHandsAction;
- isLastMessage: boolean;
- isInLast10Actions: boolean;
- config?: { app_mode?: string } | null;
- isCheckingFeedback: boolean;
- feedbackData: {
- exists: boolean;
- rating?: number;
- reason?: string;
- };
}
-export function FinishEventMessage({
- event,
- isLastMessage,
- isInLast10Actions,
- config,
- isCheckingFeedback,
- feedbackData,
-}: FinishEventMessageProps) {
+export function FinishEventMessage({ event }: FinishEventMessageProps) {
if (!isFinishAction(event)) {
return null;
}
- return (
- <>
- <ChatMessage type="agent" message={getEventContent(event).details} />
- <LikertScaleWrapper
- event={event}
- isLastMessage={isLastMessage}
- isInLast10Actions={isInLast10Actions}
- config={config}
- isCheckingFeedback={isCheckingFeedback}
- feedbackData={feedbackData}
- />
- </>
- );
+ return <ChatMessage type="agent" message={getEventContent(event).details} />;
}
diff --git a/frontend/src/components/features/chat/event-message-components/index.ts b/frontend/src/components/features/chat/event-message-components/index.ts
index 0cfe67f000..1fef6dc50c 100644
--- a/frontend/src/components/features/chat/event-message-components/index.ts
+++ b/frontend/src/components/features/chat/event-message-components/index.ts
@@ -6,5 +6,4 @@ export { McpEventMessage } from "./mcp-event-message";
export { TaskTrackingEventMessage } from "./task-tracking-event-message";
export { ObservationPairEventMessage } from "./observation-pair-event-message";
export { GenericEventMessageWrapper } from "./generic-event-message-wrapper";
-export { LikertScaleWrapper } from "./likert-scale-wrapper";
export { HookExecutionEventMessage } from "./hook-execution-event-message";
diff --git a/frontend/src/components/features/chat/event-message-components/likert-scale-wrapper.tsx b/frontend/src/components/features/chat/event-message-components/likert-scale-wrapper.tsx
deleted file mode 100644
index 3e450cbcee..0000000000
--- a/frontend/src/components/features/chat/event-message-components/likert-scale-wrapper.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React from "react";
-import { OpenHandsAction } from "#/types/core/actions";
-import { OpenHandsObservation } from "#/types/core/observations";
-import { isErrorObservation } from "#/types/core/guards";
-import { LikertScale } from "../../feedback/likert-scale";
-
-interface LikertScaleWrapperProps {
- event: OpenHandsAction | OpenHandsObservation;
- isLastMessage: boolean;
- isInLast10Actions: boolean;
- config?: { app_mode?: string } | null;
- isCheckingFeedback: boolean;
- feedbackData: {
- exists: boolean;
- rating?: number;
- reason?: string;
- };
-}
-
-export function LikertScaleWrapper({
- event,
- isLastMessage,
- isInLast10Actions,
- config,
- isCheckingFeedback,
- feedbackData,
-}: LikertScaleWrapperProps) {
- if (config?.app_mode !== "saas" || isCheckingFeedback) {
- return null;
- }
-
- // For error observations, show if in last 10 actions
- // For other events, show only if it's the last message
- const shouldShow = isErrorObservation(event)
- ? isInLast10Actions
- : isLastMessage;
-
- if (!shouldShow) {
- return null;
- }
-
- return (
- <LikertScale
- eventId={event.id}
- initiallySubmitted={feedbackData.exists}
- initialRating={feedbackData.rating}
- initialReason={feedbackData.reason}
- />
- );
-}
diff --git a/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx b/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
index d8b3ffa400..12f22d6c1c 100644
--- a/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
@@ -1,35 +1,19 @@
-import React from "react";
import { OpenHandsAction } from "#/types/core/actions";
import { isUserMessage, isAssistantMessage } from "#/types/core/guards";
import { ChatMessage } from "../chat-message";
import { ImageCarousel } from "../../images/image-carousel";
import { FileList } from "../../files/file-list";
import { ConfirmationButtons } from "#/components/shared/buttons/confirmation-buttons";
-import { LikertScaleWrapper } from "./likert-scale-wrapper";
import { parseMessageFromEvent } from "../event-content-helpers/parse-message-from-event";
interface UserAssistantEventMessageProps {
event: OpenHandsAction;
shouldShowConfirmationButtons: boolean;
- isLastMessage: boolean;
- isInLast10Actions: boolean;
- config?: { app_mode?: string } | null;
- isCheckingFeedback: boolean;
- feedbackData: {
- exists: boolean;
- rating?: number;
- reason?: string;
- };
}
export function UserAssistantEventMessage({
event,
shouldShowConfirmationButtons,
- isLastMessage,
- isInLast10Actions,
- config,
- isCheckingFeedback,
- feedbackData,
}: UserAssistantEventMessageProps) {
if (!isUserMessage(event) && !isAssistantMessage(event)) {
return null;
@@ -38,26 +22,14 @@ export function UserAssistantEventMessage({
const message = parseMessageFromEvent(event);
return (
- <>
- <ChatMessage type={event.source} message={message}>
- {event.args.image_urls && event.args.image_urls.length > 0 && (
- <ImageCarousel size="small" images={event.args.image_urls} />
- )}
- {event.args.file_urls && event.args.file_urls.length > 0 && (
- <FileList files={event.args.file_urls} />
- )}
- {shouldShowConfirmationButtons && <ConfirmationButtons />}
- </ChatMessage>
- {isAssistantMessage(event) && event.action === "message" && (
- <LikertScaleWrapper
- event={event}
- isLastMessage={isLastMessage}
- isInLast10Actions={isInLast10Actions}
- config={config}
- isCheckingFeedback={isCheckingFeedback}
- feedbackData={feedbackData}
- />
+ <ChatMessage type={event.source} message={message}>
+ {event.args.image_urls && event.args.image_urls.length > 0 && (
+ <ImageCarousel size="small" images={event.args.image_urls} />
)}
- </>
+ {event.args.file_urls && event.args.file_urls.length > 0 && (
+ <FileList files={event.args.file_urls} />
+ )}
+ {shouldShowConfirmationButtons && <ConfirmationButtons />}
+ </ChatMessage>
);
}
diff --git a/frontend/src/components/features/chat/event-message.tsx b/frontend/src/components/features/chat/event-message.tsx
index 36d4cce4f9..03787c0512 100644
--- a/frontend/src/components/features/chat/event-message.tsx
+++ b/frontend/src/components/features/chat/event-message.tsx
@@ -1,4 +1,3 @@
-import React from "react";
import { OpenHandsAction } from "#/types/core/actions";
import {
isUserMessage,
@@ -11,8 +10,6 @@ import {
isTaskTrackingObservation,
} from "#/types/core/guards";
import { OpenHandsObservation } from "#/types/core/observations";
-import { useConfig } from "#/hooks/query/use-config";
-import { useFeedbackExists } from "#/hooks/query/use-feedback-exists";
import {
ErrorEventMessage,
UserAssistantEventMessage,
@@ -29,7 +26,6 @@ interface EventMessageProps {
hasObservationPair: boolean;
isAwaitingUserConfirmation: boolean;
isLastMessage: boolean;
- isInLast10Actions: boolean;
}
/* eslint-disable react/jsx-props-no-spreading */
@@ -38,30 +34,13 @@ export function EventMessage({
hasObservationPair,
isAwaitingUserConfirmation,
isLastMessage,
- isInLast10Actions,
}: EventMessageProps) {
const shouldShowConfirmationButtons =
isLastMessage && event.source === "agent" && isAwaitingUserConfirmation;
- const { data: config } = useConfig();
-
- const {
- data: feedbackData = { exists: false },
- isLoading: isCheckingFeedback,
- } = useFeedbackExists(event.id);
-
- // Common props for components that need them
- const commonProps = {
- isLastMessage,
- isInLast10Actions,
- config,
- isCheckingFeedback,
- feedbackData,
- };
-
// Error observations
if (isErrorObservation(event)) {
- return <ErrorEventMessage event={event} {...commonProps} />;
+ return <ErrorEventMessage event={event} />;
}
// Observation pairs with OpenHands actions
@@ -71,7 +50,7 @@ export function EventMessage({
// Finish actions
if (isFinishAction(event)) {
- return <FinishEventMessage event={event} {...commonProps} />;
+ return <FinishEventMessage event={event} />;
}
// User and assistant messages
@@ -80,7 +59,6 @@ export function EventMessage({
<UserAssistantEventMessage
event={event}
shouldShowConfirmationButtons={shouldShowConfirmationButtons}
- {...commonProps}
/>
);
}
diff --git a/frontend/src/components/features/chat/messages.tsx b/frontend/src/components/features/chat/messages.tsx
index ab45d6ca0d..c64f3d29b2 100644
--- a/frontend/src/components/features/chat/messages.tsx
+++ b/frontend/src/components/features/chat/messages.tsx
@@ -38,7 +38,6 @@ export const Messages: React.FC<MessagesProps> = React.memo(
hasObservationPair={actionHasObservationPair(message)}
isAwaitingUserConfirmation={isAwaitingUserConfirmation}
isLastMessage={messages.length - 1 === index}
- isInLast10Actions={messages.length - 1 - index < 10}
/>
))}
diff --git a/frontend/src/components/features/feedback/feedback-form.tsx b/frontend/src/components/features/feedback/feedback-form.tsx
deleted file mode 100644
index 2390044d05..0000000000
--- a/frontend/src/components/features/feedback/feedback-form.tsx
+++ /dev/null
@@ -1,163 +0,0 @@
-import React from "react";
-import hotToast from "react-hot-toast";
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import { Feedback } from "#/api/open-hands.types";
-import { useSubmitFeedback } from "#/hooks/mutation/use-submit-feedback";
-import { BrandButton } from "../settings/brand-button";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-const FEEDBACK_VERSION = "1.0";
-const VIEWER_PAGE = "https://www.all-hands.dev/share";
-
-interface FeedbackFormProps {
- onClose: () => void;
- polarity: "positive" | "negative";
-}
-
-export function FeedbackForm({ onClose, polarity }: FeedbackFormProps) {
- const { t } = useTranslation();
- const { data: conversation } = useActiveConversation();
-
- const copiedToClipboardToast = () => {
- hotToast(t(I18nKey.FEEDBACK$PASSWORD_COPIED_MESSAGE), {
- icon: "πŸ“‹",
- position: "bottom-right",
- });
- };
-
- const onPressToast = (password: string) => {
- navigator.clipboard.writeText(password);
- copiedToClipboardToast();
- };
-
- const shareFeedbackToast = (
- message: string,
- link: string,
- password: string,
- ) => {
- hotToast(
- <div className="flex flex-col gap-1">
- <span>{message}</span>
- <a
- data-testid="toast-share-url"
- className="text-blue-500 underline"
- onClick={() => onPressToast(password)}
- href={link}
- target="_blank"
- rel="noreferrer"
- >
- {t(I18nKey.FEEDBACK$GO_TO_FEEDBACK)}
- </a>
- <span onClick={() => onPressToast(password)} className="cursor-pointer">
- {t(I18nKey.FEEDBACK$PASSWORD)}: {password}{" "}
- <span className="text-gray-500">
- ({t(I18nKey.FEEDBACK$COPY_LABEL)})
- </span>
- </span>
- </div>,
- { duration: 10000 },
- );
- };
-
- const { mutate: submitFeedback, isPending } = useSubmitFeedback();
-
- // TODO: Hide FeedbackForm for V1 conversations
- // This is a temporary measure and may be re-enabled in the future
- const isV1Conversation = conversation?.conversation_version === "V1";
-
- // Don't render anything for V1 conversations
- if (isV1Conversation) {
- return null;
- }
-
- const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
- event?.preventDefault();
- const formData = new FormData(event.currentTarget);
-
- const email = formData.get("email")?.toString() || "";
- const permissions = (formData.get("permissions")?.toString() ||
- "private") as "private" | "public";
-
- const feedback: Feedback = {
- version: FEEDBACK_VERSION,
- email,
- polarity,
- permissions,
- trajectory: [],
- token: "",
- };
-
- submitFeedback(
- { feedback },
- {
- onSuccess: (data) => {
- const { message, feedback_id, password } = data.body; // eslint-disable-line
- const link = `${VIEWER_PAGE}?share_id=${feedback_id}`;
- shareFeedbackToast(message, link, password);
- onClose();
- },
- },
- );
- };
-
- return (
- <form onSubmit={handleSubmit} className="flex flex-col gap-6 w-full">
- <label className="flex flex-col gap-2">
- <span className="text-xs text-neutral-400">
- {t(I18nKey.FEEDBACK$EMAIL_LABEL)}
- </span>
- <input
- required
- name="email"
- type="email"
- placeholder={t(I18nKey.FEEDBACK$EMAIL_PLACEHOLDER)}
- className="bg-[#27272A] px-3 py-[10px] rounded-sm"
- />
- </label>
-
- <div className="flex gap-4 text-neutral-400">
- <label className="flex gap-2 cursor-pointer">
- <input
- name="permissions"
- value="private"
- type="radio"
- defaultChecked
- />
- {t(I18nKey.FEEDBACK$PRIVATE_LABEL)}
- </label>
- <label className="flex gap-2 cursor-pointer">
- <input name="permissions" value="public" type="radio" />
- {t(I18nKey.FEEDBACK$PUBLIC_LABEL)}
- </label>
- </div>
-
- <div className="flex gap-2">
- <BrandButton
- type="submit"
- variant="primary"
- className="grow"
- isDisabled={isPending}
- >
- {isPending
- ? t(I18nKey.FEEDBACK$SUBMITTING_LABEL)
- : t(I18nKey.FEEDBACK$SHARE_LABEL)}
- </BrandButton>
- <BrandButton
- type="button"
- variant="secondary"
- className="grow"
- onClick={onClose}
- isDisabled={isPending}
- >
- {t(I18nKey.FEEDBACK$CANCEL_LABEL)}
- </BrandButton>
- </div>
- {isPending && (
- <p className="text-sm text-center text-neutral-400">
- {t(I18nKey.FEEDBACK$SUBMITTING_MESSAGE)}
- </p>
- )}
- </form>
- );
-}
diff --git a/frontend/src/components/features/feedback/feedback-modal.tsx b/frontend/src/components/features/feedback/feedback-modal.tsx
deleted file mode 100644
index 6f79a1540a..0000000000
--- a/frontend/src/components/features/feedback/feedback-modal.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import {
- BaseModalTitle,
- BaseModalDescription,
-} from "#/components/shared/modals/confirmation-modals/base-modal";
-import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
-import { ModalBody } from "#/components/shared/modals/modal-body";
-import { FeedbackForm } from "./feedback-form";
-
-interface FeedbackModalProps {
- onClose: () => void;
- isOpen: boolean;
- polarity: "positive" | "negative";
-}
-
-export function FeedbackModal({
- onClose,
- isOpen,
- polarity,
-}: FeedbackModalProps) {
- const { t } = useTranslation();
- if (!isOpen) return null;
-
- return (
- <ModalBackdrop onClose={onClose}>
- <ModalBody className="border border-tertiary">
- <BaseModalTitle title={t(I18nKey.FEEDBACK$TITLE)} />
- <BaseModalDescription description={t(I18nKey.FEEDBACK$DESCRIPTION)} />
- <FeedbackForm onClose={onClose} polarity={polarity} />
- </ModalBody>
- </ModalBackdrop>
- );
-}
diff --git a/frontend/src/components/features/feedback/likert-scale.tsx b/frontend/src/components/features/feedback/likert-scale.tsx
deleted file mode 100644
index 367406d25a..0000000000
--- a/frontend/src/components/features/feedback/likert-scale.tsx
+++ /dev/null
@@ -1,271 +0,0 @@
-import React, { useState, useEffect, useContext } from "react";
-import { useTranslation } from "react-i18next";
-import { FaStar } from "react-icons/fa";
-import { cn } from "#/utils/utils";
-import { I18nKey } from "#/i18n/declaration";
-import { useSubmitConversationFeedback } from "#/hooks/mutation/use-submit-conversation-feedback";
-import { ScrollContext } from "#/context/scroll-context";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-// Global timeout duration in milliseconds
-const AUTO_SUBMIT_TIMEOUT = 10000;
-
-interface LikertScaleProps {
- eventId?: number;
- initiallySubmitted?: boolean;
- initialRating?: number;
- initialReason?: string;
-}
-
-export function LikertScale({
- eventId,
- initiallySubmitted = false,
- initialRating,
- initialReason,
-}: LikertScaleProps) {
- const { t } = useTranslation();
- const { data: conversation } = useActiveConversation();
-
- const [selectedRating, setSelectedRating] = useState<number | null>(
- initialRating || null,
- );
- const [selectedReason, setSelectedReason] = useState<string | null>(
- initialReason || null,
- );
- const [showReasons, setShowReasons] = useState(false);
- const [reasonTimeout, setReasonTimeout] = useState<NodeJS.Timeout | null>(
- null,
- );
- const [isSubmitted, setIsSubmitted] = useState(initiallySubmitted);
- const [countdown, setCountdown] = useState<number>(0);
-
- // Get scroll context
- const scrollContext = useContext(ScrollContext);
-
- // Define feedback reasons using the translation hook
- const FEEDBACK_REASONS = [
- t(I18nKey.FEEDBACK$REASON_MISUNDERSTOOD_INSTRUCTION),
- t(I18nKey.FEEDBACK$REASON_FORGOT_CONTEXT),
- t(I18nKey.FEEDBACK$REASON_UNNECESSARY_CHANGES),
- t(I18nKey.FEEDBACK$REASON_SHOULD_ASK_FIRST),
- t(I18nKey.FEEDBACK$REASON_DIDNT_FINISH_JOB),
- t(I18nKey.FEEDBACK$REASON_OTHER),
- ];
-
- // If scrollContext is undefined, we're not inside a ScrollProvider
- const scrollToBottom = scrollContext?.scrollDomToBottom;
- const autoScroll = scrollContext?.autoScroll;
-
- // Use our mutation hook
- const { mutate: submitConversationFeedback } =
- useSubmitConversationFeedback();
-
- // Update isSubmitted if initiallySubmitted changes
- useEffect(() => {
- setIsSubmitted(initiallySubmitted);
- }, [initiallySubmitted]);
-
- // Update selectedRating if initialRating changes
- useEffect(() => {
- if (initialRating) {
- setSelectedRating(initialRating);
- }
- }, [initialRating]);
-
- // Update selectedReason if initialReason changes
- useEffect(() => {
- if (initialReason) {
- setSelectedReason(initialReason);
- }
- }, [initialReason]);
-
- // Countdown effect
- useEffect(() => {
- if (countdown > 0 && showReasons && !isSubmitted) {
- const timer = setTimeout(() => {
- setCountdown(countdown - 1);
- }, 1000);
- return () => clearTimeout(timer);
- }
- return () => {};
- }, [countdown, showReasons, isSubmitted]);
-
- // Clean up timeout on unmount
- useEffect(
- () => () => {
- if (reasonTimeout) {
- clearTimeout(reasonTimeout);
- }
- },
- [reasonTimeout],
- );
-
- // Scroll to bottom when component mounts, but only if user is already at the bottom
- useEffect(() => {
- if (scrollToBottom && autoScroll && !isSubmitted) {
- // Small delay to ensure the component is fully rendered
- setTimeout(() => {
- scrollToBottom();
- }, 100);
- }
- }, [scrollToBottom, autoScroll, isSubmitted]);
-
- // Scroll to bottom when reasons are shown, but only if user is already at the bottom
- useEffect(() => {
- if (scrollToBottom && autoScroll && showReasons) {
- // Small delay to ensure the reasons are fully rendered
- setTimeout(() => {
- scrollToBottom();
- }, 100);
- }
- }, [scrollToBottom, autoScroll, showReasons]);
-
- // TODO: Hide LikertScale for V1 conversations
- // This is a temporary measure and may be re-enabled in the future
- const isV1Conversation = conversation?.conversation_version === "V1";
-
- // Don't render anything for V1 conversations
- if (isV1Conversation) {
- return null;
- }
-
- // Submit feedback and disable the component
- const submitFeedback = (rating: number, reason?: string) => {
- submitConversationFeedback(
- {
- rating,
- eventId,
- reason,
- },
- {
- onSuccess: () => {
- setSelectedReason(reason || null);
- setShowReasons(false);
- setIsSubmitted(true);
- },
- },
- );
- };
-
- // Handle star rating selection
- const handleRatingClick = (rating: number) => {
- if (isSubmitted) return; // Prevent changes after submission
-
- setSelectedRating(rating);
-
- // Only show reasons if rating is 3 or less (1, 2, or 3 stars)
- // For ratings > 3 (4 or 5 stars), submit immediately without showing reasons
- if (rating <= 3) {
- setShowReasons(true);
- setCountdown(Math.ceil(AUTO_SUBMIT_TIMEOUT / 1000));
-
- // Set a timeout to auto-submit if no reason is selected
- const timeout = setTimeout(() => {
- submitFeedback(rating);
- }, AUTO_SUBMIT_TIMEOUT);
-
- setReasonTimeout(timeout);
-
- // Only scroll to bottom if the user is already at the bottom (autoScroll is true)
- if (scrollToBottom && autoScroll) {
- // Small delay to ensure the reasons are fully rendered
- setTimeout(() => {
- scrollToBottom();
- }, 100);
- }
- } else {
- // For ratings > 3 (4 or 5 stars), submit immediately without showing reasons
- setShowReasons(false);
- submitFeedback(rating);
- }
- };
-
- // Handle reason selection
- const handleReasonClick = (reason: string) => {
- if (selectedRating && reasonTimeout && !isSubmitted) {
- clearTimeout(reasonTimeout);
- setCountdown(0);
- submitFeedback(selectedRating, reason);
- }
- };
-
- // Helper function to get button class based on state
- const getButtonClass = (rating: number) => {
- if (isSubmitted) {
- return selectedRating && selectedRating >= rating
- ? "text-yellow-400 cursor-not-allowed"
- : "text-gray-300 opacity-50 cursor-not-allowed";
- }
-
- return selectedRating && selectedRating >= rating
- ? "text-yellow-400"
- : "text-gray-300";
- };
-
- return (
- <div className="mt-3 flex flex-col gap-1">
- <div className="text-sm text-gray-500 mb-1">
- {isSubmitted
- ? t(I18nKey.FEEDBACK$THANK_YOU_FOR_FEEDBACK)
- : t(I18nKey.FEEDBACK$RATE_AGENT_PERFORMANCE)}
- </div>
- <div className="flex flex-col gap-1">
- <span className="flex gap-2 items-center flex-wrap">
- {[1, 2, 3, 4, 5].map((rating) => (
- <button
- type="button"
- key={rating}
- onClick={() => handleRatingClick(rating)}
- disabled={isSubmitted}
- className={cn(
- "oh-star text-xl transition-all",
- getButtonClass(rating),
- !isSubmitted &&
- "hover:text-yellow-400 [&:has(~.oh-star:hover)]:text-yellow-400",
- )}
- aria-label={`Rate ${rating} stars`}
- >
- <FaStar />
- </button>
- ))}
- {/* Show selected reason inline with stars when submitted (only for ratings <= 3) */}
- {isSubmitted &&
- selectedReason &&
- selectedRating &&
- selectedRating <= 3 && (
- <span className="text-sm text-gray-500 italic">
- {selectedReason}
- </span>
- )}
- </span>
- </div>
-
- {showReasons && !isSubmitted && (
- <div className="mt-1 flex flex-col gap-1">
- <div className="text-xs text-gray-500 mb-1">
- {t(I18nKey.FEEDBACK$SELECT_REASON)}
- </div>
- {countdown > 0 && (
- <div className="text-xs text-gray-400 mb-1 italic">
- {t(I18nKey.FEEDBACK$SELECT_REASON_COUNTDOWN, {
- countdown,
- })}
- </div>
- )}
- <div className="flex flex-col gap-0.5">
- {FEEDBACK_REASONS.map((reason) => (
- <button
- type="button"
- key={reason}
- onClick={() => handleReasonClick(reason)}
- className="text-sm text-left py-1 px-2 rounded hover:bg-gray-700 transition-colors"
- >
- {reason}
- </button>
- ))}
- </div>
- </div>
- )}
- </div>
- );
-}
diff --git a/frontend/src/components/features/trajectory/trajectory-actions.tsx b/frontend/src/components/features/trajectory/trajectory-actions.tsx
deleted file mode 100644
index 8fe8184191..0000000000
--- a/frontend/src/components/features/trajectory/trajectory-actions.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import ThumbsUpIcon from "#/icons/thumbs-up.svg?react";
-import ThumbDownIcon from "#/icons/thumbs-down.svg?react";
-import { TrajectoryActionButton } from "#/components/shared/buttons/trajectory-action-button";
-
-interface TrajectoryActionsProps {
- onPositiveFeedback: () => void;
- onNegativeFeedback: () => void;
- isSaasMode?: boolean;
-}
-
-export function TrajectoryActions({
- onPositiveFeedback,
- onNegativeFeedback,
- isSaasMode = false,
-}: TrajectoryActionsProps) {
- const { t } = useTranslation();
-
- return (
- <div data-testid="feedback-actions" className="flex gap-1">
- {!isSaasMode && (
- <>
- <TrajectoryActionButton
- testId="positive-feedback"
- onClick={onPositiveFeedback}
- icon={<ThumbsUpIcon width={15} height={15} />}
- tooltip={t(I18nKey.BUTTON$MARK_HELPFUL)}
- />
- <TrajectoryActionButton
- testId="negative-feedback"
- onClick={onNegativeFeedback}
- icon={<ThumbDownIcon width={15} height={15} />}
- tooltip={t(I18nKey.BUTTON$MARK_NOT_HELPFUL)}
- />
- </>
- )}
- </div>
- );
-}
diff --git a/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
index 541f86d07d..c400b43f61 100644
--- a/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
@@ -12,14 +12,5 @@ export function ErrorEventMessage({ event }: ErrorEventMessageProps) {
return null;
}
- return (
- <div>
- <ErrorMessage
- // V1 doesn't have error_id, use event.id instead
- errorId={event.id}
- defaultMessage={event.error}
- />
- {/* LikertScaleWrapper expects V0 event types, skip for now */}
- </div>
- );
+ return <ErrorMessage errorId={event.id} defaultMessage={event.error} />;
}
diff --git a/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
index 59a122fc32..8950876054 100644
--- a/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
@@ -1,9 +1,6 @@
-import React from "react";
import { ActionEvent } from "#/types/v1/core";
import { FinishAction } from "#/types/v1/core/base/action";
import { ChatMessage } from "../../../features/chat/chat-message";
-// TODO: Implement V1 LikertScaleWrapper when API supports V1 event IDs
-// import { LikertScaleWrapper } from "../../../features/chat/event-message-components/likert-scale-wrapper";
import { getEventContent } from "../event-content-helpers/get-event-content";
interface FinishEventMessageProps {
@@ -16,20 +13,16 @@ export function FinishEventMessage({
isFromPlanningAgent = false,
}: FinishEventMessageProps) {
const eventContent = getEventContent(event);
- // For FinishAction, details is always a string (getActionContent returns string)
const message =
typeof eventContent.details === "string"
? eventContent.details
: String(eventContent.details);
return (
- <>
- <ChatMessage
- type="agent"
- message={message}
- isFromPlanningAgent={isFromPlanningAgent}
- />
- {/* LikertScaleWrapper expects V0 event types, skip for now */}
- </>
+ <ChatMessage
+ type="agent"
+ message={message}
+ isFromPlanningAgent={isFromPlanningAgent}
+ />
);
}
diff --git a/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
index 70e48cc1c2..cf60af0143 100644
--- a/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
@@ -2,11 +2,7 @@ import React from "react";
import { MessageEvent } from "#/types/v1/core";
import { ChatMessage } from "../../../features/chat/chat-message";
import { ImageCarousel } from "../../../features/images/image-carousel";
-// TODO: Implement file_urls support for V1 messages
-// import { FileList } from "../../../features/files/file-list";
import { V1ConfirmationButtons } from "#/components/shared/buttons/v1-confirmation-buttons";
-// TODO: Implement V1 LikertScaleWrapper when API supports V1 event IDs
-// import { LikertScaleWrapper } from "../../../features/chat/event-message-components/likert-scale-wrapper";
import { parseMessageFromEvent } from "../event-content-helpers/parse-message-from-event";
interface UserAssistantEventMessageProps {
@@ -22,7 +18,6 @@ export function UserAssistantEventMessage({
}: UserAssistantEventMessageProps) {
const message = parseMessageFromEvent(event);
- // Extract image URLs from the message content
const imageUrls: string[] = [];
if (Array.isArray(event.llm_message.content)) {
event.llm_message.content.forEach((content) => {
@@ -33,19 +28,15 @@ export function UserAssistantEventMessage({
}
return (
- <>
- <ChatMessage
- type={event.source}
- message={message}
- isFromPlanningAgent={isFromPlanningAgent}
- >
- {imageUrls.length > 0 && (
- <ImageCarousel size="small" images={imageUrls} />
- )}
- {/* TODO: Handle file_urls if V1 messages support them */}
- {isLastMessage && <V1ConfirmationButtons />}
- </ChatMessage>
- {/* LikertScaleWrapper expects V0 event types, skip for now */}
- </>
+ <ChatMessage
+ type={event.source}
+ message={message}
+ isFromPlanningAgent={isFromPlanningAgent}
+ >
+ {imageUrls.length > 0 && (
+ <ImageCarousel size="small" images={imageUrls} />
+ )}
+ {isLastMessage && <V1ConfirmationButtons />}
+ </ChatMessage>
);
}
diff --git a/frontend/src/components/v1/chat/event-message.tsx b/frontend/src/components/v1/chat/event-message.tsx
index 5d4e5910c6..c6e1415122 100644
--- a/frontend/src/components/v1/chat/event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message.tsx
@@ -13,8 +13,6 @@ import { useConfig } from "#/hooks/query/use-config";
import { useConversationStore } from "#/stores/conversation-store";
import { useAgentState } from "#/hooks/use-agent-state";
import { AgentState } from "#/types/agent-state";
-// TODO: Implement V1 feedback functionality when API supports V1 event IDs
-// import { useFeedbackExists } from "#/hooks/query/use-feedback-exists";
import {
ErrorEventMessage,
UserAssistantEventMessage,
@@ -77,8 +75,6 @@ interface CommonProps {
isLastMessage: boolean;
isInLast10Actions: boolean;
config: unknown;
- isCheckingFeedback: boolean;
- feedbackData: { exists: boolean };
isFromPlanningAgent: boolean;
}
@@ -134,11 +130,6 @@ export function EventMessage({
curAgentState === AgentState.RUNNING ||
curAgentState === AgentState.LOADING;
- // V1 events use string IDs, but useFeedbackExists expects number
- // For now, we'll skip feedback functionality for V1 events
- const feedbackData = { exists: false };
- const isCheckingFeedback = false;
-
// Read isFromPlanningAgent directly from the event object
const isFromPlanningAgent = event.isFromPlanningAgent || false;
@@ -147,8 +138,6 @@ export function EventMessage({
isLastMessage,
isInLast10Actions,
config,
- isCheckingFeedback,
- feedbackData,
isFromPlanningAgent,
};
diff --git a/frontend/src/hooks/mutation/use-submit-conversation-feedback.ts b/frontend/src/hooks/mutation/use-submit-conversation-feedback.ts
deleted file mode 100644
index 24753bb2e5..0000000000
--- a/frontend/src/hooks/mutation/use-submit-conversation-feedback.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { useConversationId } from "#/hooks/use-conversation-id";
-import {
- BatchFeedbackData,
- getFeedbackQueryKey,
-} from "../query/use-batch-feedback";
-
-type SubmitConversationFeedbackArgs = {
- rating: number;
- eventId?: number;
- reason?: string;
-};
-
-export const useSubmitConversationFeedback = () => {
- const { conversationId } = useConversationId();
- const queryClient = useQueryClient();
-
- return useMutation({
- mutationFn: ({ rating, eventId, reason }: SubmitConversationFeedbackArgs) =>
- ConversationService.submitConversationFeedback(
- conversationId,
- rating,
- eventId,
- reason,
- ),
- onMutate: async ({ rating, eventId, reason }) => {
- if (!eventId) return { previousFeedback: null };
-
- // Get the query key for the feedback data
- const queryKey = getFeedbackQueryKey(conversationId);
-
- // Cancel any outgoing refetches
- await queryClient.cancelQueries({ queryKey });
-
- // Snapshot the previous value
- const previousFeedback =
- queryClient.getQueryData<Record<string, BatchFeedbackData>>(queryKey);
-
- // Optimistically update the cache
- queryClient.setQueryData<Record<string, BatchFeedbackData>>(
- queryKey,
- (old = {}) => {
- const newData = { ...old };
- newData[eventId.toString()] = {
- exists: true,
- rating,
- reason,
- metadata: { source: "likert-scale" },
- };
- return newData;
- },
- );
-
- // Return a context object with the snapshotted value
- return { previousFeedback };
- },
- onError: (error, { eventId }, context) => {
- // Roll back to the previous value on error
- if (context?.previousFeedback && eventId) {
- queryClient.setQueryData(
- getFeedbackQueryKey(conversationId),
- context.previousFeedback,
- );
- }
- // Log error but don't show toast - user will just see the UI stay in unsubmitted state
- // eslint-disable-next-line no-console
- console.error(error);
- },
- onSettled: (_, __, { eventId }) => {
- if (eventId) {
- // Invalidate both the old and new query keys to ensure consistency
- queryClient.invalidateQueries({
- queryKey: getFeedbackQueryKey(conversationId),
- });
- }
- },
- });
-};
diff --git a/frontend/src/hooks/mutation/use-submit-feedback.ts b/frontend/src/hooks/mutation/use-submit-feedback.ts
deleted file mode 100644
index 142d1c2b9a..0000000000
--- a/frontend/src/hooks/mutation/use-submit-feedback.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { useMutation } from "@tanstack/react-query";
-import { Feedback } from "#/api/open-hands.types";
-import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { useConversationId } from "#/hooks/use-conversation-id";
-import { displayErrorToast } from "#/utils/custom-toast-handlers";
-
-type SubmitFeedbackArgs = {
- feedback: Feedback;
-};
-
-export const useSubmitFeedback = () => {
- const { conversationId } = useConversationId();
-
- return useMutation({
- mutationFn: ({ feedback }: SubmitFeedbackArgs) =>
- ConversationService.submitFeedback(conversationId, feedback),
- onError: (error) => {
- displayErrorToast(error.message);
- },
- retry: 2,
- retryDelay: 500,
- });
-};
diff --git a/frontend/src/hooks/query/use-batch-feedback.ts b/frontend/src/hooks/query/use-batch-feedback.ts
deleted file mode 100644
index c6914b0d9e..0000000000
--- a/frontend/src/hooks/query/use-batch-feedback.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import React from "react";
-import { useQuery, useQueryClient } from "@tanstack/react-query";
-import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { useConversationId } from "#/hooks/use-conversation-id";
-import { useConfig } from "#/hooks/query/use-config";
-import { useRuntimeIsReady } from "#/hooks/use-runtime-is-ready";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-export interface BatchFeedbackData {
- exists: boolean;
- rating?: number;
- reason?: string;
- metadata?: Record<string, unknown>;
-}
-
-// Query key factory to ensure consistency across hooks
-export const getFeedbackQueryKey = (conversationId?: string) =>
- ["feedback", "data", conversationId] as const;
-
-// Query key factory for individual feedback existence
-export const getFeedbackExistsQueryKey = (
- conversationId: string,
- eventId: number,
-) => ["feedback", "exists", conversationId, eventId] as const;
-
-export const useBatchFeedback = () => {
- const { conversationId } = useConversationId();
- const { data: config } = useConfig();
- const { data: conversation } = useActiveConversation();
- const queryClient = useQueryClient();
- const runtimeIsReady = useRuntimeIsReady();
-
- const isV1Conversation = conversation?.conversation_version === "V1";
-
- const query = useQuery({
- queryKey: getFeedbackQueryKey(conversationId),
- queryFn: () => ConversationService.getBatchFeedback(conversationId!),
- enabled:
- runtimeIsReady &&
- !!conversationId &&
- config?.app_mode === "saas" &&
- !isV1Conversation,
- staleTime: 1000 * 60 * 5, // 5 minutes
- gcTime: 1000 * 60 * 15, // 15 minutes
- });
-
- // Update individual feedback cache entries when batch data changes
- React.useEffect(() => {
- if (query.data && conversationId) {
- Object.entries(query.data).forEach(([eventId, feedback]) => {
- queryClient.setQueryData(
- getFeedbackExistsQueryKey(conversationId, parseInt(eventId, 10)),
- feedback,
- );
- });
- }
- }, [query.data, conversationId, queryClient]);
-
- return query;
-};
diff --git a/frontend/src/hooks/query/use-feedback-exists.ts b/frontend/src/hooks/query/use-feedback-exists.ts
deleted file mode 100644
index 83be3b39ce..0000000000
--- a/frontend/src/hooks/query/use-feedback-exists.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { useConversationId } from "#/hooks/use-conversation-id";
-import { useConfig } from "#/hooks/query/use-config";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { BatchFeedbackData, getFeedbackQueryKey } from "./use-batch-feedback";
-
-export type FeedbackData = BatchFeedbackData;
-
-export const useFeedbackExists = (eventId?: number) => {
- const queryClient = useQueryClient();
- const { conversationId } = useConversationId();
- const { data: config } = useConfig();
- const { data: conversation } = useActiveConversation();
-
- const isV1Conversation = conversation?.conversation_version === "V1";
-
- return useQuery<FeedbackData>({
- queryKey: [...getFeedbackQueryKey(conversationId), eventId],
- queryFn: () => {
- if (!eventId) return { exists: false };
-
- // Try to get the data from the batch cache
- const batchData = queryClient.getQueryData<
- Record<string, BatchFeedbackData>
- >(getFeedbackQueryKey(conversationId));
-
- return batchData?.[eventId.toString()] ?? { exists: false };
- },
- enabled:
- !!eventId &&
- !!conversationId &&
- config?.app_mode === "saas" &&
- !isV1Conversation,
- staleTime: 1000 * 60 * 5, // 5 minutes
- gcTime: 1000 * 60 * 15, // 15 minutes
- });
-};
diff --git a/frontend/src/hooks/use-scroll-to-bottom.ts b/frontend/src/hooks/use-scroll-to-bottom.ts
index 342b0c9bed..13c5cf149b 100644
--- a/frontend/src/hooks/use-scroll-to-bottom.ts
+++ b/frontend/src/hooks/use-scroll-to-bottom.ts
@@ -2,8 +2,8 @@ import { RefObject, useState, useCallback, useRef } from "react";
export function useScrollToBottom(scrollRef: RefObject<HTMLDivElement | null>) {
// Track whether the user is currently near the bottom of the scroll area.
- // Used by consumers (e.g., likert-scale) to decide whether to scroll when
- // new UI elements appear. NOT used for automatic content-following.
+ // Used by consumers to decide whether to scroll when new UI elements appear.
+ // NOT used for automatic content-following.
const [autoscroll, setAutoscroll] = useState(true);
// Track whether the user is currently at the bottom of the scroll area
diff --git a/frontend/src/routes/conversation.tsx b/frontend/src/routes/conversation.tsx
index c12ce948c7..554bb6b687 100644
--- a/frontend/src/routes/conversation.tsx
+++ b/frontend/src/routes/conversation.tsx
@@ -8,7 +8,6 @@ import { useConversationStore } from "#/stores/conversation-store";
import { useAgentStore } from "#/stores/agent-store";
import { AgentState } from "#/types/agent-state";
-import { useBatchFeedback } from "#/hooks/query/use-batch-feedback";
import { EventHandler } from "../wrapper/event-handler";
import { useConversationConfig } from "#/hooks/query/use-conversation-config";
@@ -49,9 +48,6 @@ function AppContent() {
(state) => state.removeErrorMessage,
);
- // Fetch batch feedback data when conversation is loaded
- useBatchFeedback();
-
// 1. Cleanup Effect - runs when navigating to a different conversation
React.useEffect(() => {
clearTerminal();