package com.yb.controller;
|
|
|
import jakarta.annotation.Resource;
|
import org.springframework.ai.ollama.OllamaChatModel;
|
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;
|
|
@RestController
|
@RequestMapping("/api/v1")
|
public class AiController {
|
@Resource
|
private OllamaChatModel chatModel;
|
|
|
@GetMapping("/chat")
|
public String chat(@RequestParam(value = "message",defaultValue = "Hi") String message){
|
return chatModel.call("请用中文回答如下问题,如果有地名出现,回到内容包括经纬度并使用json返回,"+message);
|
}
|
|
@GetMapping("/intent")
|
public String intent(@RequestParam(value = "message",defaultValue = "Hi") String message){
|
return chatModel.call("请用中文回答如下问题,如果有地名出现,回到内容包括经纬度并使用json返回,"+message);
|
}
|
}
|