-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[GSOC] Add sse mcp server #3503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Make the mcp a bean and run as the process as original spring boot
Removed previous LLM service implementations and introduced a unified ChatClientProviderService to handle interactions with LLM providers. Implemented ConversationService enhancements with new capabilities like streaming responses, conversation history, and management. Updated configurations and dependencies to support these changes.
Removed unused imports, methods, and annotations to streamline the codebase and improve maintainability. Updated `pom.xml` to add necessary dependencies and repositories for AI functionality. Refactored controllers to include standard REST mappings for improved API structure.
- MCP server - working - Chat Client - working - Client able to access the tools - working - dependencies resolved
Removed `AgentApplication` configuration class, shifting `ToolCallbackProvider` setup to `McpServerServiceImpl`. Refactored `ChatClientProviderService` to unify chat handling logic and added support for streaming chat responses via `ChatController`. These changes improve modularity and simplify chat-related operations.
Removed unused MCP configuration classes and updated method and bean names to replace "monitorTools" with "hertzbeatTools" for better clarity and consistency. This improves code readability and aligns naming with project conventions.
Renamed and updated methods for better clarity and functionality, such as `listMonitors` replacing `getMonitors`. Introduced `PromptProvider` to standardize AI prompts for monitoring operations. Enhanced error handling and logging for the `MonitorServiceAdapterImpl` to improve debugging and reliability.
|
||
@PostConstruct | ||
public void init() { | ||
System.setProperty("jdk.jndi.object.factoriesFilter", "!com.zaxxer.hikari.HikariJNDIFactory"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi please not delete these code, if anyelse reason to delete them?
} | ||
|
||
assert monitorService != null; | ||
System.out.println("MonitorServiceImpl found: " + Arrays.toString(monitorService.getClass().getMethods())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use log to instead of System.out.println
public SseEmitter streamChat(@RequestBody ChatRequestContext context) { | ||
SseEmitter emitter = new SseEmitter(); | ||
new Thread(() -> { | ||
try { | ||
String aiResponse = chatClientProviderService.streamChat(context); | ||
emitter.send(aiResponse); | ||
emitter.complete(); | ||
} catch (Exception e) { | ||
emitter.completeWithError(e); | ||
} | ||
}).start(); | ||
return emitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about use the webflux and reactor likeFlux<ServerSentEvent<XX>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi please add the apache license header and fix backend ci. |
</plugins> | ||
</build> | ||
|
||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All files in the project should end with a blank line.
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
public class LlmConfig { | ||
@Bean | ||
public ChatClient openAiChatClient(OpenAiChatModel chatModel) { | ||
return ChatClient.create(chatModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the create method used directly here to create the ChatClient instance? Do we need some other parameters?
* Static version of the HertzBeat monitoring prompt | ||
*/ | ||
public static final String HERTZBEAT_MONITORING_PROMPT = | ||
"You are an AI assistant specialized in monitoring infrastructure and applications with HertzBeat. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we can use java17 string blocks to write promotion, which is more readable.
such as:
String content = """
prompt content
""";
private final ChatClientProviderService chatClientProviderService; | ||
|
||
@Autowired | ||
public ChatController(@Qualifier("openAiChatClient") ChatClient openAiChatClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that only openai starter was referenced in the project. So I don't think it is necessary to use it here @Qualifier("openAiChatClient"
. Unless we have plans to introduce other models
What's changed?
Checklist
Add or update API