mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 03:07:32 +08:00
refactor: make truncate method accept maxLen parameter
The truncate method now accepts a maxLen parameter instead of using the hardcoded MAX_TEXT_LEN constant. This allows different types of content to use different truncation lengths. Note: calling sites will need to be updated to pass the maxLen parameter. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -101,9 +101,9 @@ public class ReActLoggingHook implements Hook {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String truncate(String s) {
|
||||
private static String truncate(String s, int maxLen) {
|
||||
if (s == null) return "";
|
||||
s = s.replaceAll("\\s+", " ").trim();
|
||||
return s.length() <= MAX_TEXT_LEN ? s : s.substring(0, MAX_TEXT_LEN) + "...(truncated)";
|
||||
return s.length() <= maxLen ? s : s.substring(0, maxLen) + "...(truncated)";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user