Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,23 @@ public CompletableFuture<ChatCreateResult> createConversation(String workDoneTok
param.setChatMode(chatModeName);
param.setCustomChatModeId(customChatModeId);

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

if (StringUtils.isBlank(agentSlug)) {
param.setWorkspaceFolder(PlatformUtils.getWorkspaceRootUri());
param.setWorkspaceFolders(LSPEclipseUtils.getWorkspaceFolders());
param.setTodoList(todos);
} else {
// Set agentSlug if provided - this will modify the first turn's agentSlug
// Set agentSlug on the last turn (current user message) after history insertion
if (param.getTurns() != null && !param.getTurns().isEmpty()) {
param.getTurns().get(0).setAgentSlug(agentSlug);
param.getTurns().get(param.getTurns().size() - 1).setAgentSlug(agentSlug);
}
param.setWorkspaceFolder(agentJobWorkspaceFolder);
}

// Set historical turns if provided.
if (turns != null && turns.size() > 0) {
param.getTurns().addAll(turns);
}

// TODO: remove needToolCallConfirmation when CLS fully supports it across all IDEs.
param.setNeedToolCallConfirmation(true);
if (currentFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.microsoft.copilot.eclipse.core.persistence.CopilotTurnData.ReplyData;
import com.microsoft.copilot.eclipse.core.persistence.CopilotTurnData.ToolCallData;
import com.microsoft.copilot.eclipse.core.persistence.UserTurnData.MessageData;
import com.microsoft.copilot.eclipse.core.utils.ChatMessageUtils;


/**
* Factory for creating and transforming conversation data objects. Responsible only for pure data transformation with
Expand Down Expand Up @@ -218,12 +218,10 @@ public List<Turn> convertToTurns(List<AbstractTurnData> turnDataList) {
.forLeft(requestText == null ? "" : requestText);
result.add(new Turn(request, null, null));
} else if (turnData instanceof CopilotTurnData copilotTurnData) {
// TODO: We don't persist images for now, so hard code the modelSupportVersion to false. In the future, handle
// images in responses and pass the model support version here if needed.
// Assistant turns only contribute the response text; the request field is intentionally empty.
String responseText = extractResponseFromCopilotTurnData(copilotTurnData);
Either<String, List<ChatCompletionContentPart>> response = ChatMessageUtils
.createMessageWithImages(responseText, new ArrayList<>(), false);
result.add(new Turn(response, responseText, null));
Either<String, List<ChatCompletionContentPart>> request = Either.forLeft("");
result.add(new Turn(request, responseText, null));
}
}
return result;
Expand Down
Loading