Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(post): route LLM drills correctly during loading and support text answers in element flash

Adam Eivyf1449c9bb137
diff --git a/client/src/components/meatspace/post/PostDrillRunner.jsx b/client/src/components/meatspace/post/PostDrillRunner.jsx
index 9117614472..16d0640d59 100644
--- a/client/src/components/meatspace/post/PostDrillRunner.jsx
+++ b/client/src/components/meatspace/post/PostDrillRunner.jsx
@@ -1,12 +1,17 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import { CheckCircle, XCircle } from 'lucide-react';
+import { MEMORY_DRILL_TYPES } from './constants';
+
const DRILL_LABELS = {
'doubling-chain': 'Doubling Chain',
'serial-subtraction': 'Serial Subtraction',
'multiplication': 'Multiplication',
'powers': 'Powers',
- 'estimation': 'Estimation'
+ 'estimation': 'Estimation',
+ 'memory-fill-blank': 'Memory Fill Blank',
+ 'memory-sequence': 'Memory Sequence',
+ 'memory-element-flash': 'Element Flash',
};
export default function PostDrillRunner({ session }) {
@@ -87,6 +92,7 @@ export default function PostDrillRunner({ session }) {
if (state !== 'drilling' || !currentDrill) return null;
const question = currentDrill.questions[currentQuestionIndex];
+ const isTextDrill = MEMORY_DRILL_TYPES.includes(currentDrill.type);
const timePct = timeLimitMs > 0 ? (timeLeft / timeLimitMs) * 100 : 0;
const progressPct = totalQuestions > 0 ? ((currentQuestionIndex + 1) / totalQuestions) * 100 : 0;
@@ -181,6 +187,9 @@ export default function PostDrillRunner({ session }) {
{/* Question */}
<div className="text-center py-8">
+ {question?.promptLabel && (
+ <div className="text-sm text-gray-500 mb-2">{question.promptLabel}</div>
+ )}
<div className="text-4xl font-mono font-bold text-white">
{question?.prompt}
</div>
@@ -190,8 +199,8 @@ export default function PostDrillRunner({ session }) {
<form onSubmit={handleSubmit} className="flex gap-3">
<input
ref={inputRef}
- type="number"
- inputMode="numeric"
+ type={isTextDrill ? 'text' : 'number'}
+ inputMode={isTextDrill ? 'text' : 'numeric'}
value={inputValue}
onChange={e => setInputValue(e.target.value)}
placeholder="Answer"
diff --git a/client/src/components/meatspace/tabs/PostTab.jsx b/client/src/components/meatspace/tabs/PostTab.jsx
index 0eadb29624..0eb9faf3f2 100644
--- a/client/src/components/meatspace/tabs/PostTab.jsx
+++ b/client/src/components/meatspace/tabs/PostTab.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react';
+import { Loader } from 'lucide-react';
import { getPostConfig, getPostSessions } from '../../../services/api';
import { usePostSession } from '../../../hooks/usePostSession';
import PostSessionLauncher from '../post/PostSessionLauncher';
@@ -79,7 +80,11 @@ export default function PostTab() {
// When between drills, show transition (handled in switch/case below)
- const isLlmDrill = session.currentDrill && LLM_DRILL_TYPES.includes(session.currentDrill.type);
+ // Use queued drill config type (always current) rather than currentDrill (stale during loading transitions)
+ const currentDrillConfig = session.drills[session.currentDrillIndex];
+ const isLlmDrill = currentDrillConfig
+ ? LLM_DRILL_TYPES.includes(currentDrillConfig.type)
+ : session.currentDrill && LLM_DRILL_TYPES.includes(session.currentDrill.type);
// Show transition between drills
if (session.state === 'between-drills' && view === 'running') {
@@ -100,8 +105,15 @@ export default function PostTab() {
switch (view) {
case 'running':
+ if (session.state === 'loading' && isLlmDrill) {
+ return (
+ <div className="flex flex-col items-center justify-center h-64 gap-3">
+ <Loader size={32} className="text-purple-400 animate-spin" />
+ <div className="text-gray-400">Generating {currentDrillConfig?.type ? currentDrillConfig.type.replace(/-/g, ' ') : 'drill'}...</div>
+ </div>
+ );
+ }
if (isLlmDrill) {
- const drillConfig = session.drills[session.currentDrillIndex];
return (
<PostLlmDrillRunner
drill={session.currentDrill}
@@ -110,8 +122,8 @@ export default function PostTab() {
drillCount={session.drillCount}
onComplete={session.completeLlmDrill}
isTraining={session.isTraining}
- providerId={drillConfig?.providerId}
- model={drillConfig?.model}
+ providerId={currentDrillConfig?.providerId}
+ model={currentDrillConfig?.model}
/>
);
}
diff --git a/client/src/hooks/usePostSession.js b/client/src/hooks/usePostSession.js
index 90d69f4508..d04c3f52f6 100644
--- a/client/src/hooks/usePostSession.js
+++ b/client/src/hooks/usePostSession.js
@@ -128,21 +128,27 @@ export function usePostSession() {
const q = currentDrill.questions?.[currentQuestionIndex];
if (!q) return;
const responseMs = Date.now() - questionStartRef.current;
- const numValue = value === null ? null : Number(value);
+ const isTextAnswer = typeof q.expected === 'string' && isNaN(Number(q.expected));
// For estimation drills, check within tolerance
let correct;
- if (currentDrill.type === 'estimation') {
+ let answered;
+ if (isTextAnswer) {
+ answered = value;
+ correct = value !== null && value.toLowerCase().trim() === q.expected.toLowerCase().trim();
+ } else if (currentDrill.type === 'estimation') {
+ answered = value === null ? null : Number(value);
const tolerance = (currentDrill.config?.tolerancePct || 10) / 100;
- correct = numValue !== null && Math.abs(numValue - q.expected) <= Math.abs(q.expected * tolerance);
+ correct = answered !== null && Math.abs(answered - q.expected) <= Math.abs(q.expected * tolerance);
} else {
- correct = numValue === q.expected;
+ answered = value === null ? null : Number(value);
+ correct = answered === q.expected;
}
const answer = {
prompt: q.prompt,
expected: q.expected,
- answered: numValue,
+ answered,
correct,
responseMs
};