Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ public List<Task> getRelatedTasks() {
return params != null ? params.tenant() : null;
}

/**
* Extracts all text content from the message and joins with the newline delimiter.
* <p>
* This is a convenience method for getting text input from messages that may contain
* multiple text parts. Non-text parts (images, etc.) are ignored.
* <p>
* <b>Examples:</b>
* <pre>{@code
* // Join with newlines (common for multi-paragraph input)
* String text = context.getUserInput("\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Javadoc example for the new getUserInput() method is incorrect. It shows a call to getUserInput("\n"), which is the method it's meant to simplify. The example should demonstrate the use of the no-argument overload.

Suggested change
* String text = context.getUserInput("\n");
* String text = context.getUserInput();

* }</pre>
*
* @return all text parts joined with newline, or empty string if no message
*/
public String getUserInput() {
return getUserInput("\n");
}

/**
* Extracts all text content from the message and joins with the specified delimiter.
* <p>
Expand All @@ -245,14 +263,15 @@ public List<Task> getRelatedTasks() {
* @param delimiter the string to insert between text parts (null defaults to "\n")
* @return all text parts joined with delimiter, or empty string if no message
*/
public String getUserInput(String delimiter) {
public String getUserInput(@Nullable String delimiter) {
if (params == null) {
return "";
}
String delim = delimiter;
if (delimiter == null) {
delimiter = "\n";
delim = "\n";
}
return getMessageText(params.message(), delimiter);
return getMessageText(params.message(), delim);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion. How about using a ternary operator here? It might make the code simpler.

return getMessageText(params.message(), (delimiter == null) ? "\n" : delimiter);

}

/**
Expand Down
Loading