Class PromptHandler
java.lang.Object
org.eclipse.swt.browser.BrowserFunction
com.developer.nefarious.zjoule.plugin.core.functions.PromptHandler
public class PromptHandler
extends org.eclipse.swt.browser.BrowserFunction
Handles user prompts from the browser and communicates with the chat orchestrator to generate responses.
This class extends BrowserFunction
to enable JavaScript interaction with the
Eclipse SWT Browser
component. It uses the ChatOrchestrator
to process
user input and generate AI-driven responses.
-
Constructor Summary
ConstructorDescriptionPromptHandler
(org.eclipse.swt.browser.Browser browser, String name) Constructs a newPromptHandler
instance. -
Method Summary
Methods inherited from class org.eclipse.swt.browser.BrowserFunction
dispose, getBrowser, getName, isDisposed
-
Constructor Details
-
PromptHandler
Constructs a newPromptHandler
instance.- Parameters:
browser
- theBrowser
instance associated with this function.name
- the name of the JavaScript function exposed to the browser.
-
-
Method Details
-
create
Factory method to create a newPromptHandler
instance.- Parameters:
browser
- theBrowser
instance associated with this function.name
- the name of the JavaScript function exposed to the browser.- Returns:
- a new
PromptHandler
instance.
-
function
Handles the JavaScript function call from the browser.This method takes the first argument as the user prompt, passes it to the
ChatOrchestrator.getAnswer(String)
method, and returns the generated AI response.- Overrides:
function
in classorg.eclipse.swt.browser.BrowserFunction
- Parameters:
arguments
- the arguments passed from the JavaScript function call.- Returns:
- the AI-generated response as an
Object
.
-