Skip to content

Commit 42ca54f

Browse files
committed
fix restore chat session related issues
1 parent ac5d9cc commit 42ca54f

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageServerConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ public CompletableFuture<ChatCreateResult> createConversation(String workDoneTok
298298
param.setWorkspaceFolder(agentJobWorkspaceFolder);
299299
}
300300

301-
// Set historical turns if provided.
301+
// Set historical turns if provided, inserting them before the current user message.
302302
if (turns != null && turns.size() > 0) {
303-
param.getTurns().addAll(turns);
303+
param.getTurns().addAll(0, turns);
304304
}
305305

306306
// TODO: remove needToolCallConfirmation when CLS fully supports it across all IDEs.

com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/persistence/ConversationDataFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import com.microsoft.copilot.eclipse.core.persistence.CopilotTurnData.ReplyData;
2727
import com.microsoft.copilot.eclipse.core.persistence.CopilotTurnData.ToolCallData;
2828
import com.microsoft.copilot.eclipse.core.persistence.UserTurnData.MessageData;
29-
import com.microsoft.copilot.eclipse.core.utils.ChatMessageUtils;
29+
3030

3131
/**
3232
* Factory for creating and transforming conversation data objects. Responsible only for pure data transformation with
@@ -221,9 +221,8 @@ public List<Turn> convertToTurns(List<AbstractTurnData> turnDataList) {
221221
// TODO: We don't persist images for now, so hard code the modelSupportVersion to false. In the future, handle
222222
// images in responses and pass the model support version here if needed.
223223
String responseText = extractResponseFromCopilotTurnData(copilotTurnData);
224-
Either<String, List<ChatCompletionContentPart>> response = ChatMessageUtils
225-
.createMessageWithImages(responseText, new ArrayList<>(), false);
226-
result.add(new Turn(response, responseText, null));
224+
Either<String, List<ChatCompletionContentPart>> request = Either.forLeft("");
225+
result.add(new Turn(request, responseText, null));
227226
}
228227
}
229228
return result;

0 commit comments

Comments
 (0)