Skip to content

Commit

Permalink
Streaming support for AI chat interactions
Browse files Browse the repository at this point in the history
Integrate a streaming feature into the AI assistant, facilitating continuous interaction and dynamic responses. This enhancement allows users to engage with the assistant more fluidly during coding tasks, improving overall efficiency and satisfaction with the tool.
  • Loading branch information
jShiwaniGupta committed Oct 26, 2024
1 parent 0eb54c2 commit ef2ed2c
Show file tree
Hide file tree
Showing 21 changed files with 501 additions and 292 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
</moduleDependencies>
<publicPackages>
<publicPackage>io.github.jeddict.ai</publicPackage>
<publicPackage>io.github.jeddict.ai.lang</publicPackage>
</publicPackages>
<useOSGiDependencies>false</useOSGiDependencies>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.DocTrees;
import io.github.jeddict.ai.Snippet;
import io.github.jeddict.ai.lang.Snippet;
import static io.github.jeddict.ai.scanner.ProjectClassScanner.getFileObjectFromEditor;
import io.github.jeddict.ai.scanner.ClassData;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static io.github.jeddict.ai.util.EditorUtil.isSuitableForWebAppDirectory;
import static io.github.jeddict.ai.util.StringUtil.convertToCapitalized;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
Expand Down Expand Up @@ -114,6 +115,14 @@ public JEditorPane createHtmlPane(String content) {
parentPanel.add(editorPane);
return editorPane;
}

public JEditorPane createPane() {
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
editorPane.setBackground(Color.WHITE);
parentPanel.add(editorPane);
return editorPane;
}

public JEditorPane createCodePane(String content) {
JEditorPane editorPane = new JEditorPane();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/github/jeddict/ai/hints/ExpressionFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreePath;
import io.github.jeddict.ai.JeddictUpdateManager;
import io.github.jeddict.ai.completion.Action;
import io.github.jeddict.ai.JeddictChatModel;
import io.github.jeddict.ai.lang.JeddictChatModel;
import io.github.jeddict.ai.util.StringUtil;
import org.netbeans.api.java.source.JavaSource;
import org.netbeans.api.java.source.TreePathHandle;
Expand All @@ -48,7 +49,7 @@ public ExpressionFix(TreePathHandle tpHandle, Action action, TreePath treePath)

@Override
protected String getText() {
return NbBundle.getMessage(JeddictChatModel.class, "HINT_ENHANCE_EXPRESSION");
return NbBundle.getMessage(JeddictUpdateManager.class, "HINT_ENHANCE_EXPRESSION");
}

@Override
Expand Down
15 changes: 5 additions & 10 deletions src/main/java/io/github/jeddict/ai/hints/JavaDocFixImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
*/
package io.github.jeddict.ai.hints;

import io.github.jeddict.ai.util.StringUtil;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.doctree.DocTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
Expand All @@ -31,21 +29,18 @@
import com.sun.source.tree.VariableTree;
import com.sun.source.util.DocTrees;
import com.sun.source.util.TreePath;
import io.github.jeddict.ai.JeddictUpdateManager;
import io.github.jeddict.ai.completion.Action;
import io.github.jeddict.ai.JeddictChatModel;
import static io.github.jeddict.ai.completion.Action.ENHANCE;
import io.github.jeddict.ai.lang.JeddictChatModel;
import static io.github.jeddict.ai.util.SourceUtil.geIndentaion;
import io.github.jeddict.ai.util.StringUtil;
import static io.github.jeddict.ai.util.StringUtil.removeCodeBlockMarkers;
import static io.github.jeddict.ai.util.StringUtil.trimLeadingSpaces;
import java.util.LinkedList;
import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import org.netbeans.api.java.source.ElementHandle;
import org.netbeans.api.java.source.JavaSource;
import org.netbeans.api.java.source.TreeMaker;
import org.netbeans.api.java.source.TreePathHandle;
import org.netbeans.api.java.source.WorkingCopy;
import org.netbeans.spi.java.hints.JavaFix;
Expand All @@ -71,9 +66,9 @@ public JavaDocFixImpl(TreePathHandle tpHandle, Action type,
protected String getText() {
switch (action) {
case ENHANCE:
return NbBundle.getMessage(JeddictChatModel.class, "HINT_JAVADOC_GENERATED", StringUtil.convertToCapitalized(classType.getKind().toString()));//NOI18N
return NbBundle.getMessage(JeddictUpdateManager.class, "HINT_JAVADOC_GENERATED", StringUtil.convertToCapitalized(classType.getKind().toString()));//NOI18N
default:
return NbBundle.getMessage(JeddictChatModel.class, "HINT_JAVADOC", StringUtil.convertToCapitalized(classType.getKind().toString()));//NOI18N
return NbBundle.getMessage(JeddictUpdateManager.class, "HINT_JAVADOC", StringUtil.convertToCapitalized(classType.getKind().toString()));//NOI18N
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/jeddict/ai/hints/JeddictHint.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.sun.source.util.SourcePositions;
import com.sun.source.util.TreePath;
import com.sun.source.util.Trees;
import io.github.jeddict.ai.JeddictChatModel;
import io.github.jeddict.ai.JeddictUpdateManager;
import io.github.jeddict.ai.completion.Action;
import io.github.jeddict.ai.settings.PreferencesManager;
import java.util.ArrayList;
Expand Down Expand Up @@ -189,7 +189,7 @@ public static ErrorDescription run(HintContext ctx) {
return null;
}
Fix[] fixesArray = fixes.toArray(new Fix[0]); // Convert to array
String desc = NbBundle.getMessage(JeddictChatModel.class, "ERR_HINT"); //NOI18N
String desc = NbBundle.getMessage(JeddictUpdateManager.class, "ERR_HINT"); //NOI18N
return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), desc, fixesArray); //NOI18N
}

Expand Down
Loading

0 comments on commit ef2ed2c

Please sign in to comment.