chatbot improvements

This commit is contained in:
Bane Stojkovic
2025-04-06 21:51:26 +02:00
parent f03a0b1417
commit 0279a89700
4 changed files with 20 additions and 12 deletions
@@ -75,14 +75,9 @@ public class SpiceSumarizer {
sb.append(" "); sb.append(" ");
} }
String comment = outputComponentValue(c, sb); outputComponentValue(c, sb);
if (c instanceof ISpiceMapper) { outputComment(c, sb);
String spiceComment = ((ISpiceMapper)c).getComment();
if (spiceComment != null)
comment += spiceComment;
}
sb.append(" ; ").append(comment);
if (useHTML) if (useHTML)
sb.append("<br>"); sb.append("<br>");
lines.add(sb.toString()); lines.add(sb.toString());
@@ -94,7 +89,20 @@ public class SpiceSumarizer {
.collect(Collectors.joining("\n")); .collect(Collectors.joining("\n"));
} }
private static String outputComponentValue(IDIYComponent<?> c, StringBuilder sb) { private static void outputComment(IDIYComponent<?> c, StringBuilder sb) {
ComponentType componentType = ComponentProcessor.getInstance()
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
String comment = componentType.getName() + " [" + componentType.getCategory() + "]";
if (c instanceof ISpiceMapper) {
String spiceComment = ((ISpiceMapper) c).getComment();
if (spiceComment != null)
comment = spiceComment + " " + comment;
}
sb.append(" ; ").append(comment);
}
private static void outputComponentValue(IDIYComponent<?> c, StringBuilder sb) {
ComponentType componentType = ComponentProcessor.getInstance() ComponentType componentType = ComponentProcessor.getInstance()
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass()); .extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
@@ -117,7 +125,6 @@ public class SpiceSumarizer {
sb.append(c.getValue()); sb.append(c.getValue());
} }
} }
return componentType.getName() + " [" + componentType.getCategory() + "]";
} }
private static String formatSpiceNode(int i) { private static String formatSpiceNode(int i) {
@@ -161,7 +161,7 @@ public class ChatbotService {
if (!netlist.getSwitchSetup().isEmpty()) { if (!netlist.getSwitchSetup().isEmpty()) {
sb.append("Switch configuration: ").append(netlist.getSwitchSetup()).append(". "); sb.append("Switch configuration: ").append(netlist.getSwitchSetup()).append(". ");
} }
sb.append("Effective circuit netlist") sb.append("Circuit netlist")
.append(netlist.getSwitchSetup().isEmpty() ? "" : " in this switch configuration") .append(netlist.getSwitchSetup().isEmpty() ? "" : " in this switch configuration")
.append(":\n\n"); .append(":\n\n");
try { try {
@@ -293,7 +293,7 @@ public class ChatbotPane extends JPanel {
public JButton getAskButton() { public JButton getAskButton() {
if (askButton == null) { if (askButton == null) {
askButton = new JButton("Ask"); askButton = new JButton("<html>Send &#9166;</html>");
askButton.setBackground(TERMINAL_BG); askButton.setBackground(TERMINAL_BG);
askButton.setForeground(TERMINAL_FG); askButton.setForeground(TERMINAL_FG);
askButton.setFocusPainted(false); askButton.setFocusPainted(false);
+2 -1
View File
@@ -254,4 +254,5 @@ INSERT INTO diylc_knowledge_base(category, section, content) VALUES ('User Manua
- If you are asking about a DIYLC feature, make sure to include the words "DIYLC" or "DIY Layout Creator" and the feature in question to ensure that the AI assistant understands the context of the question. - If you are asking about a DIYLC feature, make sure to include the words "DIYLC" or "DIY Layout Creator" and the feature in question to ensure that the AI assistant understands the context of the question.
- Use simple language and avoid complex technical terms. - Use simple language and avoid complex technical terms.
- Ask follow-up questions if needed. - Ask follow-up questions if needed.
- Use the "Clear" button to reset the conversation.'); - Use the "Clear" button to reset the conversation.
- Each chat conversation is associated with the current project and is saved in the cloud and will be automatically downloaded when that project is opened.');