File tree Expand file tree Collapse file tree 7 files changed +41
-12
lines changed
java/com/devoxx/genie/service/prompt Expand file tree Collapse file tree 7 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ plugins {
77}
88
99group = " com.devoxx.genie"
10- version = " 0.5.2 "
10+ version = " 0.5.3 "
1111
1212repositories {
1313 mavenCentral()
Original file line number Diff line number Diff line change @@ -139,6 +139,29 @@ public void removeLastUserMessage(@NotNull ChatMessageContext context) {
139139 }
140140 }
141141
142+ /**
143+ * Adds user message to memory from the provided context
144+ * @param context The chat message context containing the user message
145+ */
146+ public void addUserMessage (@ NotNull ChatMessageContext context ) {
147+ try {
148+ if (context .getUserMessage () == null && context .getUserPrompt () != null ) {
149+ // Create user message if not already set
150+ context .setUserMessage (UserMessage .from (context .getUserPrompt ()));
151+ }
152+
153+ if (context .getUserMessage () != null ) {
154+ log .debug ("Adding user message to memory for context ID: {}" , context .getId ());
155+ chatMemoryService .addMessage (context .getProject (), context .getUserMessage ());
156+ log .debug ("Successfully added user message to memory" );
157+ } else {
158+ log .warn ("Attempted to add null user message to memory for context ID: {}" , context .getId ());
159+ }
160+ } catch (Exception e ) {
161+ throw new MemoryException ("Failed to add user message to memory" , e );
162+ }
163+ }
164+
142165 /**
143166 * Removes only the last AI message from memory
144167 * @param context The chat message context containing the AI message to remove
Original file line number Diff line number Diff line change @@ -80,15 +80,14 @@ protected abstract void executeStrategySpecific(
8080 */
8181 protected abstract String getStrategyName ();
8282
83- // /**
84- // * Prepares memory with system message if needed and adds the user message.
85- // *
86- // * @param context The chat message context
87- // */
88- // protected void prepareMemory(@NotNull ChatMessageContext context) {
89- // chatMemoryManager.prepareMemory(context);
90- // // chatMemoryManager.addUserMessage(context);
91- // }
83+ /**
84+ * Prepares memory with system message if needed and adds the user message.
85+ *
86+ * @param context The chat message context
87+ */
88+ protected void prepareMemory (@ NotNull ChatMessageContext context ) {
89+ chatMemoryManager .prepareMemory (context );
90+ }
9291
9392 /**
9493 * Standardized error handling for execution exceptions.
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ protected void executeStrategySpecific(
5959 log .debug ("Before memory preparation - context ID: {}" , context .getId ());
6060 chatMemoryManager .logMemoryState (context .getProject ());
6161
62+ // Prepare memory and add user message
63+ prepareMemory (context );
64+ chatMemoryManager .addUserMessage (context );
65+
6266 log .debug ("After memory preparation - context ID: {}" , context .getId ());
6367 chatMemoryManager .logMemoryState (context .getProject ());
6468
Original file line number Diff line number Diff line change @@ -55,7 +55,9 @@ protected void executeStrategySpecific(
5555 log .debug ("Before memory preparation (streaming) - context ID: {}" , context .getId ());
5656 chatMemoryManager .logMemoryState (context .getProject ());
5757
58- // prepareMemory(context);
58+ // Prepare memory and add user message
59+ prepareMemory (context );
60+ chatMemoryManager .addUserMessage (context );
5961
6062 log .debug ("After memory preparation (streaming) - context ID: {}" , context .getId ());
6163 chatMemoryManager .logMemoryState (context .getProject ());
Original file line number Diff line number Diff line change 3838 <h2>v0.5.3</h2>
3939 <UL>
4040 <Li>Feat #586 : Added Gemini 2.5 Pro model by @stephanj</LI>
41+ <LI>Fix #588 : Fix streaming responses regression by @stephanj</LI>
4142 </UL>
4243 <h2>v0.5.2</h2>
4344 <UL>
Original file line number Diff line number Diff line change 1- version =0.5.2
1+ version =0.5.3
You can’t perform that action at this time.
0 commit comments