Build terminal chat UIs with TUI4J - Elm Architecture chat client for AI agent demos with Spring Boot integration
90
90%
Does it follow best practices?
Impact
94%
1.38xAverage score across 3 eval scenarios
Advisory
Suggest reviewing before use
A data science team has built a Spring Boot backend that exposes a conversational AI research assistant over HTTP. Researchers need a polished terminal client to interact with it without leaving their development environment. The backend accepts POST requests with a plain-text question and returns a plain-text answer.
The terminal interface must not freeze or become unresponsive while waiting for the AI backend to reply (responses can take several seconds). The team also wants the client distributed as part of their existing Spring Boot application JAR rather than as a separate process — the TUI should launch when the application starts, without spinning up a web server on the client side.
A partial Spring Boot project is provided. The agent should implement the full TUI integration layer and document the architecture in a short writeup.
src/main/java/com/example/ResearchChatModel.java — TUI4J Model that makes async HTTP calls to the backendsrc/main/java/com/example/TuiRunner.java — Spring Boot component that launches the TUIsrc/main/resources/application.properties — Spring Boot configuration for TUI-only modearchitecture.md — describes how async calls are handled and why the approach avoids UI blockingThe following files are provided as inputs. Extract them before beginning.
=============== FILE: pom.xml ===============
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>research-assistant-tui</artifactId> <version>1.0.0</version> <properties> <maven.compiler.source>17</maven.compiler.source> <maven.compiler.target>17</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>com.williamcallahan</groupId> <artifactId>tui4j</artifactId> <version>0.3.3</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>3.2.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>3.2.0</version> </plugin> </plugins> </build> </project>
=============== FILE: src/main/java/com/example/ResearchAssistantApp.java =============== package com.example;
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication public class ResearchAssistantApp { public static void main(String[] args) { SpringApplication.run(ResearchAssistantApp.class, args); } }