Skip to content

Commit f1fc40d

Browse files
committed
I think I found the error
1 parent 6c2052b commit f1fc40d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ private static void saveCompletionConversation(Conversation conversation, String
5454
} else {
5555
int totalTokenLength = llamaApp.calculateTokenLength(generateContext(conversation));
5656
System.out.println("Total toke length: "+totalTokenLength); //debug
57-
// nothing goes past here?
57+
5858
conversation.setTotalTokenLength(totalTokenLength);
5959
System.out.println("Set totalTokenLength variable in conversation");
6060

6161
int contextPerSlot = modelConfig.getContext() / modelConfig.getParallelSequences();
6262
System.out.println("Calculated context per slot");
63-
int tokenLengthSinceLastSystemPrompt = totalTokenLength - conversation.getTokenLengthAtLastSystemPrompt();
63+
64+
int tokenLengthAtLastSystemPrompt = conversation.getTokenLengthAtLastSystemPrompt() == null ? 0 : conversation.getTokenLengthAtLastSystemPrompt();
65+
66+
int tokenLengthSinceLastSystemPrompt = totalTokenLength - tokenLengthAtLastSystemPrompt;
6467
System.out.println("Calculated the token system prompt thing");
6568

6669
//debug

0 commit comments

Comments
 (0)