Код: Выделить всё
@RestController
@RequestMapping("/api/deepseek")
public class DeepSeekController {
private final DeepSeekChatModel chatModel;
public DeepSeekController(DeepSeekChatModel chatModel) {
this.chatModel = chatModel;
}
@GetMapping("/ai/generate")
public Map generate(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
return Map.of("generation", chatModel.call(message));
}
}
< /code>
Но мы получаем ошибку компиляции: < /p>
Parameter 0 of constructor in com.example.deepseekapi.DeepSeekController required a bean of type 'org.springframework.ai.deepseek.DeepSeekChatModel' that could not be found.
< /code>
, пока в документе говорится: < /p>
This will create a DeepSeekChatModel implementation that you can inject into your class. Here is an example of a simple @Controller class that uses the chat model for text generation.
What is missing?
We had a look at the DeepSeekChatModel API documentation and can't see how to create its bean in the app.
Подробнее здесь: https://stackoverflow.com/questions/797 ... t-be-found