From 3d1e7f1df85d0f7fccf02e5179e61d610b3b5884 Mon Sep 17 00:00:00 2001 From: moririn2528 Date: Fri, 15 Sep 2023 18:06:53 +0900 Subject: [PATCH] fix by review --- optuna_dashboard/_app.py | 4 ++-- optuna_dashboard/ts/apiClient.ts | 7 ++----- python_tests/test_api.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index 5b1f7147..d14ada3d 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -316,9 +316,9 @@ def create_app( response.status = 204 return {} - @app.put("/api/studies//preference_feedback_component_type") + @app.put("/api/studies//preference_feedback_component") @json_api_view - def put_preference_feedback_component_type(study_id: int) -> dict[str, Any]: + def put_preference_feedback_component(study_id: int) -> dict[str, Any]: try: component_type = request.json.get("type", "") artifact_key = request.json.get("artifact_key", None) diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index 1a0b0f18..e552f773 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -1,4 +1,3 @@ -import { Feedback } from "@mui/icons-material" import axios from "axios" const axiosInstance = axios.create({ baseURL: API_ENDPOINT }) @@ -388,10 +387,8 @@ export const reportFeedbackComponentAPI = ( ): Promise => { return axiosInstance .put( - `/api/studies/${studyId}/preference_feedback_component_type`, - component_type.output_type === "note" - ? { type: "note" } - : { type: "artifact", artifact_key: component_type.artifact_key } + `/api/studies/${studyId}/preference_feedback_component`, + component_type ) .then(() => { return diff --git a/python_tests/test_api.py b/python_tests/test_api.py index 10687752..86f897c8 100644 --- a/python_tests/test_api.py +++ b/python_tests/test_api.py @@ -195,7 +195,7 @@ class APITestCase(TestCase): study_id = study._study._study_id status, _, _ = send_request( app, - f"/api/studies/{study_id}/preference_feedback_component_type", + f"/api/studies/{study_id}/preference_feedback_component", "PUT", body=json.dumps({"type": "artifact", "artifact_key": "image"}), content_type="application/json",