Enter to send·Shift+Enter new line
Manage the thread state externally.
thread: UseStreamThread<StateType>