Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(assistant-ui-demo): restore mock chat model streaming

Steven Enamakelc8b97a0ca6d2
diff --git a/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx b/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
index 4a39de1b27..19191348d0 100644
--- a/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
+++ b/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
@@ -17,13 +17,8 @@ import {
QuoteBlock,
SelectionToolbar,
} from '@/components/assistant-ui/quote';
-import {
- Reasoning,
- ReasoningContent,
- ReasoningRoot,
- ReasoningText,
- ReasoningTrigger,
-} from '@/components/assistant-ui/reasoning';
+import { Reasoning } from '@/components/assistant-ui/reasoning';
+import { OpenHumanReasoningGroup } from '@/components/assistant-ui/reasoning-group';
import { ToolFallback } from '@/components/assistant-ui/tool-fallback';
import {
ToolGroupContent,
@@ -634,14 +629,11 @@ const AssistantMessage: FC = () => {
</ToolGroupRoot>
);
case 'group-reasoning': {
- const running = part.status.type === 'running';
return (
- <ReasoningRoot defaultOpen={running}>
- <ReasoningTrigger active={running} />
- <ReasoningContent aria-busy={running}>
- <ReasoningText>{children}</ReasoningText>
- </ReasoningContent>
- </ReasoningRoot>
+ <OpenHumanReasoningGroup
+ indices={part.indices}
+ running={part.status.type === 'running'}
+ />
);
}
case 'text':
diff --git a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockChatModel.ts b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockChatModel.ts
index 20809f8b46..72b1a8f745 100644
--- a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockChatModel.ts
+++ b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockChatModel.ts
@@ -190,9 +190,19 @@ export const mockChatModelAdapter: ChatModelAdapter = {
case 'text': {
const at = parts.length;
let text = '';
+ // Reasoning carries the same timing the live app stamps, so the
+ // panel's "Thinking… Ns" badge and "Thought for Ns" label show here.
+ const startedAt = Date.now();
for (const piece of chunk(step.text)) {
text += piece;
- parts[at] = { type: step.kind, text };
+ parts[at] =
+ step.kind === 'reasoning'
+ ? {
+ type: 'reasoning',
+ text,
+ providerMetadata: { openhuman: { startedAt, endedAt: Date.now() } },
+ }
+ : { type: step.kind, text };
dirty = false;
yield emit();
await sleep(CHUNK_MS, abortSignal);
diff --git a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
index 427c555534..a0225cc71b 100644
--- a/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
+++ b/app/src/pages/dev/assistant-ui-demo/assistantUiMock/mockScript.ts
@@ -92,7 +92,13 @@ Send another message to replay it.`;
export const MOCK_SCRIPT: readonly MockStep[] = [
{
kind: 'reasoning',
- text: `The user is exercising the demo, so there is no real question to answer. What I can do is make the turn cover every part the transcript knows how to render, in the order a real turn would produce them.`,
+ text: `**Reading the request**
+
+The user is exercising the demo, so there is no real question to answer.
+
+**Planning the turn**
+
+What I can do is make the turn cover every part the transcript knows how to render, in the order a real turn would produce them: reasoning, tools, delegations, then prose.`,
},
{ kind: 'text', text: INTRO },
@@ -150,7 +156,9 @@ export const MOCK_SCRIPT: readonly MockStep[] = [
{
kind: 'reasoning',
- text: `Both delegations are still working. Nothing about them blocks this turn, so I can keep going and fold their reports in when they land.`,
+ text: `**Checking on the delegations**
+
+Both delegations are still working. Nothing about them blocks this turn, so I can keep going and fold their reports in when they land.`,
},
{
kind: 'tool',