|
|
@@ -4,12 +4,15 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.ai.chat.client.ChatClient;
|
|
|
import org.springframework.ai.chat.model.ChatModel;
|
|
|
+import org.springframework.ai.chat.prompt.PromptTemplate;
|
|
|
import org.springframework.ai.tool.ToolCallbackProvider;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/mcp")
|
|
|
public class MCPController {
|
|
|
@@ -29,4 +32,12 @@ public class MCPController {
|
|
|
.call()
|
|
|
.content();
|
|
|
}
|
|
|
+ @GetMapping("/fetch")
|
|
|
+ public String fetchTest(@RequestParam("url")String url){
|
|
|
+ log.debug("url:{}",url);
|
|
|
+ PromptTemplate promptTemplate = PromptTemplate.builder().template("总结网页的消息:{url}.").variables(Map.of("url", url)).build();
|
|
|
+ return chatClient.prompt(promptTemplate.create())
|
|
|
+ .call()
|
|
|
+ .content();
|
|
|
+ }
|
|
|
}
|