Package com.github.copilot.sdk.json
Interface UserPromptSubmittedHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler for user-prompt-submitted hooks.
This handler is invoked when the user submits a prompt, allowing you to intercept and modify the prompt before it is processed.
Example Usage
UserPromptSubmittedHandler handler = (input, invocation) -> {
System.out.println("User submitted: " + input.getPrompt());
// Optionally modify the prompt
return CompletableFuture.completedFuture(
new UserPromptSubmittedHookOutput().setModifiedPrompt(input.getPrompt() + " (enhanced)"));
};
- Since:
- 1.0.7
-
Method Summary
Modifier and TypeMethodDescriptionhandle(UserPromptSubmittedHookInput input, HookInvocation invocation) Handles a user prompt submission event.
-
Method Details
-
handle
CompletableFuture<UserPromptSubmittedHookOutput> handle(UserPromptSubmittedHookInput input, HookInvocation invocation) Handles a user prompt submission event.- Parameters:
input- the hook input containing the prompt detailsinvocation- metadata about the hook invocation- Returns:
- a future that resolves with the hook output, or
nullto proceed without modification
-