|
| 1 | +/** |
| 2 | + * Copyright 2023 Sven Loesekann |
| 3 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + you may not use this file except in compliance with the License. |
| 5 | + You may obtain a copy of the License at |
| 6 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + Unless required by applicable law or agreed to in writing, software |
| 8 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | + See the License for the specific language governing permissions and |
| 11 | + limitations under the License. |
| 12 | + */ |
| 13 | +package ch.xxx.aidoclibchat.adapter.controller; |
| 14 | + |
| 15 | +import org.springframework.web.bind.annotation.PostMapping; |
| 16 | +import org.springframework.web.bind.annotation.RequestBody; |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 18 | +import org.springframework.web.bind.annotation.RestController; |
| 19 | + |
| 20 | +import ch.xxx.aidoclibchat.domain.model.dto.McpRequestDto; |
| 21 | +import ch.xxx.aidoclibchat.domain.model.dto.McpResponseDto; |
| 22 | +import ch.xxx.aidoclibchat.usecase.service.LocalMcpClient; |
| 23 | + |
| 24 | +@RestController |
| 25 | +@RequestMapping("rest/mcpclient") |
| 26 | +public class McpClientController { |
| 27 | + private final LocalMcpClient localMcpClient; |
| 28 | + |
| 29 | + public McpClientController(LocalMcpClient localMcpClient) { |
| 30 | + this.localMcpClient = localMcpClient; |
| 31 | + } |
| 32 | + |
| 33 | + @PostMapping("/question") |
| 34 | + public McpResponseDto getQuestion(@RequestBody McpRequestDto requestDto) { |
| 35 | + return localMcpClient.createResponse(requestDto); |
| 36 | + } |
| 37 | +} |
0 commit comments