Package com.storedobject.ui.ai
Class ChatView
java.lang.Object
com.storedobject.vaadin.View
com.storedobject.ui.ai.ChatView
- All Implemented Interfaces:
Executable
,Reentrant
,HasLogic
,Transactional
,ClickHandler
,CloseableView
,ExecutableView
,ValueChangeHandler
,com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<? extends com.vaadin.flow.component.Component>>
,com.vaadin.flow.component.HasValue.ValueChangeListener
,Serializable
,Runnable
,EventListener
The view used to display a chat with AI capabilities.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<C extends com.vaadin.flow.component.Component>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clean()
Close resources if any that are left opened.protected void
Override this if you want to do something before the View comes up on the screen.final Knowledge
Retrieves the current knowledge base associated with this ChatView instance.void
setKnowledge
(Knowledge knowledge) Sets the knowledge base to be used within the chat view and updates the related components accordingly.void
Sets the topic for the chat view and updates related UI components.Methods inherited from class com.storedobject.vaadin.View
abort, aborted, addClosedListener, addOpenedListener, close, createCloseableView, createWindow, decorateComponent, execute, execute, executing, focus, focus, focusAny, getApplication, getCaption, getComponent, getContent, getCreatedBy, getEmbeddedView, getMenuItem, getMenuItem, getView, initUI, invoke, isFullScreen, isScrollable, isWindowMode, select, setCaption, setComponent, setCreatedBy, setDefaultPadding, setEmbeddedView, setFirstFocus, setFullScreen, setScrollable, setWindowMode, skipFirstFocus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClicked
Methods inherited from interface com.storedobject.common.Executable
act
Methods inherited from interface com.storedobject.vaadin.ExecutableView
abort, clearAlerts, clicked, close, createMenuItem, error, execute, getApplication, getCaption, getMenuIconName, getMenuItem, getView, getView, invoke, isCloseable, isFullScreen, isHomeView, log, log, message, returnedFrom, run, setCaption, setClickable, speak, trackValueChange, tray, valueChanged, warning
Methods inherited from interface com.storedobject.common.Reentrant
isReentrant
Methods inherited from interface com.storedobject.ui.Transactional
commit, execute, getLogic, getTransactionManager, run, setLogic, transact, transact, transactControl, transactControl, transactControl, transactControl
Methods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Constructor Details
-
ChatView
public ChatView()Default constructor for the ChatView class. Initializes a ChatView instance with no specified knowledge base and an empty topic. This setup provides a basic chat interface without pre-defined context or configuration. -
ChatView
Constructs a ChatView instance with the specified knowledge base and topic. This view provides a user interface for chatting, displaying messages, and interacting with a defined topic.- Parameters:
knowledge
- the knowledge base to be used within the chattopic
- the initial topic of discussion displayed in the view
-
-
Method Details
-
setTopic
Sets the topic for the chat view and updates related UI components.- Parameters:
topic
- the topic to be set, which will be displayed in the topic display area
-
setKnowledge
Sets the knowledge base to be used within the chat view and updates the related components accordingly. If the given knowledge base is the same as the current one, no action is taken. If the knowledge base is null, the chat view is closed.- Parameters:
knowledge
- the new knowledge base to be set; can be null to close the chat view
-
getKnowledge
Retrieves the current knowledge base associated with this ChatView instance.- Returns:
- the knowledge base used in this chat view
-
execute
Description copied from class:View
Override this if you want to do something before the View comes up on the screen. Call super.execute(parent, doNotLock) to make the View appear on the screen. Parent view is automatically selected when this view closes. -
clean
public void clean()Description copied from class:View
Close resources if any that are left opened. This method is invoked when the view is removed from theApplication
. The default implementation does nothing.- Specified by:
clean
in interfaceExecutableView
- Overrides:
clean
in classView
-