diff --git a/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java b/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java index de11bac8b12..305802f1155 100644 --- a/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java +++ b/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java @@ -139,8 +139,9 @@ public Response getInterpreter( @POST @Path("/interpreters/{ids: [a-zA-Z_0-9,]+}") @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) @Operation(operationId = "interpretText", summary = "Sends a text to a given human language interpreter(s).", responses = { - @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "404", description = "No human language interpreter was found."), @ApiResponse(responseCode = "400", description = "interpretation exception occurs") }) public Response interpret( @@ -175,8 +176,9 @@ public Response interpret( @POST @Path("/interpreters") @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) @Operation(operationId = "interpretTextByDefaultInterpreter", summary = "Sends a text to the default human language interpreter.", responses = { - @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "404", description = "No human language interpreter was found."), @ApiResponse(responseCode = "400", description = "interpretation exception occurs") }) public Response interpret( @@ -189,8 +191,8 @@ public Response interpret( } try { - hli.interpret(locale, text); - return Response.ok(null, MediaType.TEXT_PLAIN).build(); + String answer = hli.interpret(locale, text); + return Response.ok(answer, MediaType.TEXT_PLAIN).build(); } catch (InterpretationException e) { return JSONResponse.createErrorResponse(Status.BAD_REQUEST, e.getMessage()); }