Repository navigation
fix: fixing get last N message from session - #511
Conversation
efgpinto
left a comment
There was a problem hiding this comment.
LGTM but a bit annoying to have so many formatting changes.. maybe we need to adjust the auto-formatting sbt plugin? Otherwise we will just be overriding each other..
| List<SessionMessage> messages = currentState().messages(); | ||
| if (cmd.lastNMessages != null | ||
| && cmd.lastNMessages.isPresent() | ||
| && messages.size() > cmd.lastNMessages.get()) { |
| .persist( | ||
| new Event.UserMessageAdded(ts, cmd.componentId, cmd.userMessage.text(), cmd.userMessage.tokens(), totalTokensUser), | ||
| new Event.AiMessageAdded(ts, cmd.componentId, cmd.aiMessage.text(),cmd.aiMessage.tokens(), totalTokensAi, toolInteractions)) | ||
| .thenReply(__ -> Done.done()); | ||
| .persist( | ||
| new Event.UserMessageAdded(ts, cmd.componentId, cmd.userMessage.text(), cmd.userMessage.tokens(), totalTokensUser), | ||
| new Event.AiMessageAdded(ts, cmd.componentId, cmd.aiMessage.text(), cmd.aiMessage.tokens(), totalTokensAi, toolInteractions)) | ||
| .thenReply(__ -> Done.done()); |
There was a problem hiding this comment.
I think we might need some formatting tool adjustment.. not sure why javafmtAll is not catching these but we have several places where we actually do double spacing for breaking long lines (see JsonSupport, ModelProvider,etc.).
I prefer as is but I'm fine if we agree on this new rule but probably makes sense to reach a consensus first, otherwise we will just be changing formatting every time one of us touches a file.
| case Event.LimitedWindowSet limitedWindowSet -> currentState().withMaxSize(limitedWindowSet.maxSizeInBytes); | ||
| case Event.UserMessageAdded userMsg -> currentState() | ||
| .addMessage(new UserMessage(userMsg.message(), userMsg.tokens())) | ||
| .withTotalTokenUsage(userMsg.totalTokenUsage()); | ||
| case Event.AiMessageAdded aiMsg -> currentState() | ||
| .addMessage(new AiMessage(aiMsg.message(), aiMsg.tokens(), aiMsg.toolCallInteraction)) | ||
| .withTotalTokenUsage(aiMsg.totalTokenUsage()); | ||
| case Event.Deleted __ -> currentState().clear(); |
There was a problem hiding this comment.
Seems like a matter of taste here? or just IDE auto-formatting?
There was a problem hiding this comment.
autoformatting, I think, it is more aggressive after the recent IntelliJ update
No description provided.