File tree Expand file tree Collapse file tree
backend/src/main/java/ch/xxx/aidoclibchat/usecase/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818import org .springframework .ai .chat .client .ChatClient ;
1919import org .springframework .ai .chat .client .ChatClient .Builder ;
20+ import org .springframework .ai .chat .client .advisor .SimpleLoggerAdvisor ;
21+ import org .springframework .ai .chat .model .ChatModel ;
2022import org .springframework .ai .mcp .SyncMcpToolCallbackProvider ;
2123import org .springframework .stereotype .Service ;
2224
@@ -29,10 +31,10 @@ public class LocalMcpClient {
2931 private final List <McpSyncClient > mcpSyncClients ;
3032 private final ChatClient chatClient ;
3133
32- public LocalMcpClient (List <McpSyncClient > mcpSyncClients , Builder builder ) {
33- this .mcpSyncClients = mcpSyncClients ;
34- this .chatClient = builder .build ();
35- }
34+ public LocalMcpClient (List <McpSyncClient > mcpSyncClients , Builder builder , ChatModel chatModel ) {
35+ this .mcpSyncClients = mcpSyncClients ;
36+ this .chatClient = builder .defaultAdvisors ( SimpleLoggerAdvisor . builder (). build ()). build ();
37+ }
3638
3739 public McpResponseDto createResponse (McpRequestDto requestDto ) {
3840 var result = this .chatClient .prompt (requestDto .question ()).toolCallbacks (new SyncMcpToolCallbackProvider (mcpSyncClients )).call ();
You can’t perform that action at this time.
0 commit comments