mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-23 04:28:32 +00:00
feat: add conversations tags support
This commit is contained in:
parent
465feafc9f
commit
901ce5a01e
25 changed files with 921 additions and 33 deletions
|
|
@ -16,11 +16,16 @@ public class Message {
|
|||
private String prompt;
|
||||
private String response;
|
||||
private List<String> referencedFilePaths;
|
||||
private List<UUID> conversationsHistoryIds;
|
||||
private String imageFilePath;
|
||||
private boolean webSearchIncluded;
|
||||
private DocumentationDetails documentationDetails;
|
||||
private String personaName;
|
||||
|
||||
public Message() {
|
||||
this.id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Message(String prompt, String response) {
|
||||
this(prompt);
|
||||
this.response = response;
|
||||
|
|
@ -60,6 +65,14 @@ public class Message {
|
|||
this.referencedFilePaths = referencedFilePaths;
|
||||
}
|
||||
|
||||
public List<UUID> getConversationsHistoryIds() {
|
||||
return conversationsHistoryIds;
|
||||
}
|
||||
|
||||
public void setConversationsHistoryIds(List<UUID> conversationsHistoryIds) {
|
||||
this.conversationsHistoryIds = conversationsHistoryIds;
|
||||
}
|
||||
|
||||
public @Nullable String getImageFilePath() {
|
||||
return imageFilePath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,13 @@ import ee.carlrobert.codegpt.toolwindow.ui.ChatToolWindowLandingPanel;
|
|||
import ee.carlrobert.codegpt.toolwindow.ui.ResponseMessagePanel;
|
||||
import ee.carlrobert.codegpt.toolwindow.ui.UserMessagePanel;
|
||||
import ee.carlrobert.codegpt.ui.OverlayUtil;
|
||||
import ee.carlrobert.codegpt.ui.textarea.ConversationTagProcessor;
|
||||
import ee.carlrobert.codegpt.ui.textarea.UserInputPanel;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.EditorTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.FileTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.FolderTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.GitCommitTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.HistoryTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.PersonaTagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.TagDetails;
|
||||
import ee.carlrobert.codegpt.ui.textarea.header.tag.TagManager;
|
||||
|
|
@ -169,6 +171,7 @@ public class ChatToolWindowTabPanel implements Disposable {
|
|||
.conversationType(conversationType)
|
||||
.imageDetailsFromPath(CodeGPTKeys.IMAGE_ATTACHMENT_FILE_PATH.get(project))
|
||||
.referencedFiles(getReferencedFiles(selectedTags))
|
||||
.history(getHistory(getSelectedTags()))
|
||||
.psiStructure(psiStructure);
|
||||
|
||||
findTagOfType(selectedTags, PersonaTagDetails.class)
|
||||
|
|
@ -189,6 +192,32 @@ public class ChatToolWindowTabPanel implements Disposable {
|
|||
.toList();
|
||||
}
|
||||
|
||||
private List<UUID> getConversationHistoryIds(List<? extends TagDetails> tags) {
|
||||
return tags.stream()
|
||||
.map(it -> {
|
||||
if (it instanceof HistoryTagDetails tagDetails) {
|
||||
return tagDetails.getConversationId();
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private List<Conversation> getHistory(List<? extends TagDetails> tags) {
|
||||
return tags.stream()
|
||||
.map(it -> {
|
||||
if (it instanceof HistoryTagDetails tagDetails) {
|
||||
return ConversationTagProcessor.Companion.getConversation(
|
||||
tagDetails.getConversationId());
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
}
|
||||
|
||||
private VirtualFile getVirtualFile(TagDetails tag) {
|
||||
VirtualFile virtualFile = null;
|
||||
if (tag.getSelected()) {
|
||||
|
|
@ -392,6 +421,11 @@ public class ChatToolWindowTabPanel implements Disposable {
|
|||
messageBuilder.withReferencedFiles(referencedFiles);
|
||||
}
|
||||
|
||||
List<UUID> conversationHistoryIds = getConversationHistoryIds(appliedTags);
|
||||
if (!conversationHistoryIds.isEmpty()) {
|
||||
messageBuilder.withConversationHistoryIds(conversationHistoryIds);
|
||||
}
|
||||
|
||||
String attachedImagePath = CodeGPTKeys.IMAGE_ATTACHMENT_FILE_PATH.get(project);
|
||||
if (attachedImagePath != null) {
|
||||
messageBuilder.withImage(attachedImagePath);
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ class PsiStructureRepository(
|
|||
// Maybe need recursive find all files
|
||||
is FolderTagDetails -> null
|
||||
|
||||
is HistoryTagDetails -> null
|
||||
is EditorSelectionTagDetails -> null
|
||||
is DocumentationTagDetails -> null
|
||||
is CurrentGitChangesTagDetails -> null
|
||||
|
|
@ -211,6 +212,7 @@ class PsiStructureRepository(
|
|||
// Maybe need recursive find all files
|
||||
is FolderTagDetails -> false
|
||||
|
||||
is HistoryTagDetails -> false
|
||||
is DocumentationTagDetails -> false
|
||||
is CurrentGitChangesTagDetails -> false
|
||||
is GitCommitTagDetails -> false
|
||||
|
|
@ -235,6 +237,7 @@ class PsiStructureRepository(
|
|||
// Maybe need recursive find all files
|
||||
is FolderTagDetails -> null
|
||||
|
||||
is HistoryTagDetails -> null
|
||||
is DocumentationTagDetails -> null
|
||||
is CurrentGitChangesTagDetails -> null
|
||||
is GitCommitTagDetails -> null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue