davsclaus commented on code in PR #29703:
URL: https://github.com/apache/camel/pull/29703#discussion_r4550203310
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/WriteNotes.java:
##########
@@ -273,6 +277,167 @@ private static boolean dynamic(String text) {
return text.contains("{{") || text.contains("${");
}
+ /**
+ * A to: or toD: on the file component with fileExist Append that adds
nothing after each message: the messages run
+ * together in the file, so lines written one per message become one line.
r32 of the local-model benchmark,
+ * route-batch-file step 2 ("append each line that cannot be read to
rejects/<file name>, one per line"): in 4 of
+ * the 5 runs that wrote the route, the lines ran together. 3 had no
appendChars, and one had appendChars: "\n". In
+ * YAML that is a line break, and the endpoint uri drops line breaks, so
it adds nothing (the run logged the
+ * endpoint as appendChars=&fileExist=Append). In step 3, 4 of the 7 runs
rewrote the file and turned the
+ * appendChars: "\\n" of the reference into "\n" the same way. A \n in a
toD with ${...} adds nothing too: the toD
+ * turns it into a line break first. A body that already ends with a line
break gets no note. Only the file
+ * component has appendChars (ftp, sftp and the other file components
leave it out). Each note is "Line N: ..." for
+ * the line of the to:.
+ */
+ static List<String> fileAppendNotes(String content) {
+ List<String> notes = new ArrayList<>();
+ if (content == null ||
!content.toLowerCase(Locale.ROOT).contains("append")) {
+ return notes;
+ }
+ Object doc;
+ try {
+ doc = new Yaml(new SafeConstructor(new
LoaderOptions())).load(content);
+ } catch (Exception e) {
Review Comment:
Done in c9e73ae7094c: both catches now use `RuntimeException`.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]