Skip to content

Commit 26c318f

Browse files
committed
resolve comments
1 parent 42ca54f commit 26c318f

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,23 +286,23 @@ public CompletableFuture<ChatCreateResult> createConversation(String workDoneTok
286286
param.setChatMode(chatModeName);
287287
param.setCustomChatModeId(customChatModeId);
288288

289+
// Set historical turns if provided, inserting them before the current user message.
290+
if (turns != null && turns.size() > 0) {
291+
param.getTurns().addAll(0, turns);
292+
}
293+
289294
if (StringUtils.isBlank(agentSlug)) {
290295
param.setWorkspaceFolder(PlatformUtils.getWorkspaceRootUri());
291296
param.setWorkspaceFolders(LSPEclipseUtils.getWorkspaceFolders());
292297
param.setTodoList(todos);
293298
} else {
294-
// Set agentSlug if provided - this will modify the first turn's agentSlug
299+
// Set agentSlug on the last turn (current user message) after history insertion
295300
if (param.getTurns() != null && !param.getTurns().isEmpty()) {
296-
param.getTurns().get(0).setAgentSlug(agentSlug);
301+
param.getTurns().get(param.getTurns().size() - 1).setAgentSlug(agentSlug);
297302
}
298303
param.setWorkspaceFolder(agentJobWorkspaceFolder);
299304
}
300305

301-
// Set historical turns if provided, inserting them before the current user message.
302-
if (turns != null && turns.size() > 0) {
303-
param.getTurns().addAll(0, turns);
304-
}
305-
306306
// TODO: remove needToolCallConfirmation when CLS fully supports it across all IDEs.
307307
param.setNeedToolCallConfirmation(true);
308308
if (currentFile != null) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ public List<Turn> convertToTurns(List<AbstractTurnData> turnDataList) {
218218
.forLeft(requestText == null ? "" : requestText);
219219
result.add(new Turn(request, null, null));
220220
} else if (turnData instanceof CopilotTurnData copilotTurnData) {
221-
// TODO: We don't persist images for now, so hard code the modelSupportVersion to false. In the future, handle
222-
// images in responses and pass the model support version here if needed.
221+
// Assistant turns only contribute the response text; the request field is intentionally empty.
223222
String responseText = extractResponseFromCopilotTurnData(copilotTurnData);
224223
Either<String, List<ChatCompletionContentPart>> request = Either.forLeft("");
225224
result.add(new Turn(request, responseText, null));

0 commit comments

Comments
 (0)