Package io.github.jbastgen.stemma.app.ai
Class AiMerge
java.lang.Object
io.github.jbastgen.stemma.app.ai.AiMerge
Resolving the conflicts of a file with the AI (feature 6): the prompt with the three versions of every open conflict and a few
lines around it, the strict reading of the answer, and the safety checks a proposal must pass.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat could be done with an answer: the proposals that passed, and the conflicts (by number) that stay open with the reason.static final recordA proposal for one conflict. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildPrompt(String template, String path, String ours, String theirs, MergeSession session) Fills the template:{path},{ours},{theirs}and{conflicts}.static AiMerge.OutcomeReads### CONFLICT n (high|medium|low)blocks.static StringWhether a whole file is plausible for its type; only JSON can be checked here, everything else is accepted.
-
Field Details
-
TEMPLATE_NAME
- See Also:
-
-
Method Details
-
buildPrompt
public static String buildPrompt(String template, String path, String ours, String theirs, MergeSession session) Fills the template:{path},{ours},{theirs}and{conflicts}. Each open conflict is a block### CONFLICT nwith the lines before it, and the BASE, OURS and THEIRS lines. -
parse
Reads### CONFLICT n (high|medium|low)blocks. Only conflicts inopencount; a proposal with conflict markers, or one for a JSON file that is not valid JSON once the file is put together, stays out. Everything else is a proposal.- Parameters:
path- the file, for the plausibility checkopen- the numbers (0-based) of the conflicts that were sent
-
plausible
Whether a whole file is plausible for its type; only JSON can be checked here, everything else is accepted.
-