Interface IChatService


public interface IChatService
Interface for AI chat service implementations. This interface allows the chat functionality to work with different AI providers. The default implementation requires Java 17 and LangChain4j, available in openxava-7.7-chat-jdk17.
Since:
7.7
Author:
Javier Paniza
  • Method Details

    • chat

      String chat(String sessionId, javax.servlet.http.HttpSession httpSession, String message) throws ChatException
      Process a chat message and return the AI response as HTML.
      Parameters:
      sessionId - The HTTP session ID for maintaining conversation context
      httpSession - The HTTP session for accessing application context
      message - The user message to process
      Returns:
      The AI response as HTML, or null if the message was a command
      Throws:
      ChatException - if there's an error processing the message
    • clearMemory

      void clearMemory(String sessionId)
      Clear the conversation memory for a session.
      Parameters:
      sessionId - The HTTP session ID
    • consumePendingFilterValues

      Map<String,String> consumePendingFilterValues(String sessionId)
      Get pending filter values after a chat response (for UI filtering).
      Parameters:
      sessionId - The HTTP session ID
      Returns:
      Map of filter values, or null if none pending
    • consumeRefreshUINeeded

      boolean consumeRefreshUINeeded(String sessionId)
      Check if UI refresh is needed after a chat response.
      Parameters:
      sessionId - The HTTP session ID
      Returns:
      true if refresh is needed