Skip to content

Commit 8433668

Browse files
committed
Added debugging messages as it isn't working
1 parent 956ea4a commit 8433668

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/net/coosanta/llm/utility/ConversationUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ public static Conversation fromJson(String json) {
3030
}
3131

3232
public static void saveToFile(Conversation conversation, Path filePath) throws IOException {
33+
System.out.println("Saving conversation to file...");//debug
3334
Files.createDirectories(filePath.getParent());
3435
String json = toJson(conversation);
3536
Files.writeString(filePath, json);
37+
System.out.println("Saved conversation to file!");//debug
3638
}
3739

3840
public static Conversation loadFromFile(Path filePath) throws IOException {

src/main/java/net/coosanta/llm/utility/WebUtils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@ private static void saveCompletionConversation(Conversation conversation, String
5353
System.err.println("Cannot calculate token length - model is unloaded.");
5454
} else {
5555
int totalTokenLength = llamaApp.calculateTokenLength(generateContext(conversation));
56+
System.out.println("Total toke length: "+totalTokenLength); //debug
57+
5658
conversation.setTotalTokenLength(totalTokenLength);
5759

5860
int contextPerSlot = modelConfig.getContext() / modelConfig.getParallelSequences();
5961
int tokenLengthSinceLastSystemPrompt = totalTokenLength - conversation.getTokenLengthAtLastSystemPrompt();
60-
if (tokenLengthSinceLastSystemPrompt >= contextPerSlot - contextPerSlot * 0.1)
61-
{
62+
63+
if (tokenLengthSinceLastSystemPrompt >= contextPerSlot - contextPerSlot * 0.1) {
6264
conversation.addMessage("System", conversation.getSystemPrompt(), null);
6365
conversation.setTokenLengthAtLastSystemPrompt(totalTokenLength);
66+
System.out.println("Injected System prompt to keep model on track");//debug
6467
}
6568
}
6669
saveToFile(conversation, getConversationSavePathFromUuid(conversation.getUuid()));

0 commit comments

Comments
 (0)