mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-26 16:05:03 +00:00
Improve response regeneration (#51)
This commit is contained in:
parent
525c316739
commit
a22007439d
4 changed files with 29 additions and 24 deletions
|
|
@ -34,25 +34,16 @@ public class ToolWindowService implements LafManagerListener {
|
|||
}
|
||||
|
||||
public void startRequest(String prompt, SyntaxTextArea textArea, Project project, boolean isRetry) {
|
||||
var conversationsState = ConversationsState.getInstance();
|
||||
var currentConversation = ConversationsState.getCurrentConversation();
|
||||
var conversation = currentConversation == null ? conversationsState.startConversation() : currentConversation;
|
||||
|
||||
Message conversationMessage;
|
||||
if (isRetry) {
|
||||
var messages = conversation.getMessages();
|
||||
conversationMessage = messages.get(messages.size() - 1);
|
||||
conversationMessage.setResponse("");
|
||||
} else {
|
||||
conversationMessage = new Message(prompt);
|
||||
}
|
||||
var conversation = ConversationsState.getInstance().getOrStartNew();
|
||||
var conversationMessage = new Message(prompt);
|
||||
|
||||
new SwingWorker<Void, String>() {
|
||||
protected Void doInBackground() {
|
||||
var eventListener = new EventListener(
|
||||
conversationMessage,
|
||||
textArea::append,
|
||||
() -> chatToolWindow.stopGenerating(prompt, textArea, project)) {
|
||||
() -> chatToolWindow.stopGenerating(prompt, textArea, project),
|
||||
isRetry) {
|
||||
public void onMessage(String message) {
|
||||
publish(message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue