Initial commit with Main.java
Signed-off-by: Zacharias <zacharias@4zellen.se>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package me.zacharias.neurodock;
|
||||
|
||||
import com.formdev.flatlaf.FlatDarkLaf;
|
||||
import me.zacharias.chat.core.Core;
|
||||
import me.zacharias.chat.core.PrintMessageHandler;
|
||||
import me.zacharias.chat.ollama.OllamaObject;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
|
||||
public class Main {
|
||||
static void main() {
|
||||
new Main();
|
||||
}
|
||||
|
||||
Core core;
|
||||
|
||||
public Main() {
|
||||
|
||||
FlatDarkLaf.setup();
|
||||
|
||||
OllamaObject ollamaObject = OllamaObject.builder()
|
||||
.setModel("llama3.2")
|
||||
.keep_alive(10)
|
||||
.build();
|
||||
|
||||
JTextArea textArea = new JTextArea();
|
||||
|
||||
core = new Core(new PrintMessageHandler() {
|
||||
|
||||
@Override
|
||||
public void printMessage(String s) {
|
||||
textArea.append(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean color() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String message) {
|
||||
PrintMessageHandler.super.printError(message);
|
||||
}
|
||||
});
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setSize(800, 600);
|
||||
|
||||
frame.add(textArea);
|
||||
|
||||
JTextField field = new JTextField();
|
||||
|
||||
field.addKeyListener(new KeyListener() {
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if(!e.isShiftDown() && e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
frame.add(field);
|
||||
frame.setVisible(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user