Skip to content

Commit

Permalink
Inject builder instead of client
Browse files Browse the repository at this point in the history
  • Loading branch information
samie committed Jul 9, 2024
1 parent 117c191 commit 02c0c50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/example/demo/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MainView extends VerticalLayout {
Scroller messageScroller = new Scroller(messageList);
MessageInput messageInput = new MessageInput();

public MainView(ChatClient.Builder chatClient) {
public MainView(ChatClient.Builder chatClientBuilder) {
add(messageScroller, messageInput);
setSizeFull();
setMargin(false);
Expand All @@ -32,6 +32,9 @@ public MainView(ChatClient.Builder chatClient) {
// Add system message to help the AI to behave
chatHistory.add(new SystemMessage("Answer politely to user. When user asks you about Vaadin, reply in bro style. Always show a piece a code."));

// Init the client
ChatClient chatClient = chatClientBuilder.build();

// Pass user input to chatClient
messageInput.addSubmitListener(ev -> {
// Add use input as markdown message
Expand Down

0 comments on commit 02c0c50

Please sign in to comment.