package com.iwe3.langchain4j.controller;

import com.iwe3.langchain4j.service.McpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;


/**
 * @Description: 知识出处
 * 第1步，如何进行mcp编码
 * https://docs.langchain4j.dev/tutorials/mcp#creating-an-mcp-tool-provider
 *
 * 第2步，如何使用baidu map mcp，它提供了哪些功能对外服务
 * https://mcp.so/zh/server/baidu-map/baidu-maps?tab=tools
 *
 * http://localhost:9012/lc4j/mcp/chat?question=查询117.173.150.122归属地
 * http://localhost:9012/lc4j/mcp/chat?question=查询都江堰天气
 * http://localhost:9012/lc4j/mcp/chat?question=查询成都成华区到都江堰路线规划
 */
@RestController
public class McpCallServerController {

    @Autowired
    private McpService mcpService;

    @GetMapping("/lc4j/mcp/chat")
    public Flux<String> chat(@RequestParam("question") String question) throws Exception
    {
        // 调用我们定义的HighApi接口,通过大模型对百度mcpserver调用
        return mcpService.chat(question);

    }
}

