taskFeedback protobus migration (#3590)

This commit is contained in:
canvrno authored and GitHub committed 2025-05-17 14:49:55 -07:00
1 parent 0ca16961ee
commit 1470563142
10 files changed
+77 -35

No files matched your search

+2
View File
@@ -12,6 +12,7 @@ import { exportTaskWithId } from "./exportTaskWithId"
import { getTaskHistory } from "./getTaskHistory"
import { newTask } from "./newTask"
import { showTaskWithId } from "./showTaskWithId"
import { taskFeedback } from "./taskFeedback"
import { toggleTaskFavorite } from "./toggleTaskFavorite"
// Register all task service methods
@@ -26,5 +27,6 @@ export function registerAllMethods(): void {
registerMethod("getTaskHistory", getTaskHistory)
registerMethod("newTask", newTask)
registerMethod("showTaskWithId", showTaskWithId)
registerMethod("taskFeedback", taskFeedback)
registerMethod("toggleTaskFavorite", toggleTaskFavorite)
}
+28
View File
@@ -0,0 +1,28 @@
import { Controller } from ".."
import { Empty, StringRequest } from "../../../shared/proto/common"
import { telemetryService } from "@/services/posthog/telemetry/TelemetryService"
/**
* Handles task feedback submission (thumbs up/down)
* @param controller The controller instance
* @param request The StringRequest containing the feedback type ("thumbs_up" or "thumbs_down") in the value field
* @returns Empty response
*/
export async function taskFeedback(controller: Controller, request: StringRequest): Promise<Empty> {
if (!request.value) {
console.warn("taskFeedback: Missing feedback type value")
return Empty.create()
}
try {
if (controller.task?.taskId) {
telemetryService.captureTaskFeedback(controller.task.taskId, request.value as any)
} else {
console.warn("taskFeedback: No active task to receive feedback")
}
} catch (error) {
console.error("Error in taskFeedback handler:", error)
}
return Empty.create()
}