Class ChatOrchestrator

java.lang.Object
com.developer.nefarious.zjoule.plugin.chat.ChatOrchestrator
All Implemented Interfaces:
IChatOrchestrator

public class ChatOrchestrator extends Object implements IChatOrchestrator
Orchestrates the chat process by interacting with the AI client to retrieve answers based on user prompts and active editor content. Implements the IChatOrchestrator interface to provide chat functionality.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getAnswer(String userPrompt)
    Generates an AI response for the given user prompt by performing the following steps: Determining which AI client to use. Fetching the chat message history from the client. Retrieving the content of the active editor window as context. Creating system and user messages for the AI. Obtaining the response from the AI client via a chat completion request. Saving the updated chat history back to the AI client. Returning the response message as a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChatOrchestrator

      public ChatOrchestrator()
  • Method Details

    • getAnswer

      public String getAnswer(String userPrompt)
      Generates an AI response for the given user prompt by performing the following steps:
      1. Determining which AI client to use.
      2. Fetching the chat message history from the client.
      3. Retrieving the content of the active editor window as context.
      4. Creating system and user messages for the AI.
      5. Obtaining the response from the AI client via a chat completion request.
      6. Saving the updated chat history back to the AI client.
      7. Returning the response message as a string.
      Specified by:
      getAnswer in interface IChatOrchestrator
      Parameters:
      userPrompt - the prompt or query provided by the user.
      Returns:
      the AI-generated response as a String.