fix : use effect

This commit is contained in:
martin legrand 2025-04-18 18:47:41 +02:00
parent 0f09ef92dd
commit 26e5159c1d
2 changed files with 8 additions and 10 deletions

2
api.py
View File

@ -175,7 +175,7 @@ async def process_query(request: QueryRequest):
agent_name="Unknown",
success="false",
blocks={},
status="Agent working...",
status="Ready",
timestamp=str(time.time())
)
if is_generating:

View File

@ -14,15 +14,13 @@ function App() {
const messagesEndRef = useRef(null);
useEffect(() => {
if (!isLoading) {
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 1500);
return () => clearInterval(intervalId);
}
}, [isLoading, messages]);
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 1500);
return () => clearInterval(intervalId);
}, [messages]);
const checkHealth = async () => {
try {