MCPcopy
hub / github.com/Narcooo/inkos / renderTruthBody

Function renderTruthBody

packages/studio/src/components/chat/BookSidebar.tsx:48–82  ·  view source on GitHub ↗
(
  file: string | null,
  content: string,
  frontmatter: TruthFrontmatter | null,
  body: string | null,
)

Source from the content-addressed store, hash-verified

46// cards, current_state.md hides its engineering seed note, and files with YAML
47// frontmatter (story_frame.md) render structured cards above clean prose.
48function renderTruthBody(
49 file: string | null,
50 content: string,
51 frontmatter: TruthFrontmatter | null,
52 body: string | null,
53) {
54 if (file === "pending_hooks.md") {
55 return <PendingHooksView content={content} />;
56 }
57 if (file === "current_state.md") {
58 const { isEmpty, body: stateBody } = presentCurrentState(content);
59 return isEmpty ? (
60 <p className="text-[14px] leading-6 text-muted-foreground/60 italic">
61 还没有运行状态。开始写作后,每写完一章这里会自动记录最新的故事进展。
62 </p>
63 ) : (
64 <Streamdown plugins={streamdownPlugins} mode="static">{stateBody}</Streamdown>
65 );
66 }
67 if (file === "emotional_arcs.md" && !hasTableRows(content)) {
68 return (
69 <p className="text-[14px] leading-6 text-muted-foreground/60 italic">
70 还没有情感弧线记录。开始写作后,这里会记录角色在各章的情绪变化。
71 </p>
72 );
73 }
74 return (
75 <>
76 <FrontmatterCards cards={frontmatterToCards(frontmatter)} />
77 <Streamdown plugins={streamdownPlugins} mode="static">
78 {relabelOkrJargon(stripStructuralMarkers(body ?? content))}
79 </Streamdown>
80 </>
81 );
82}
83
84function ArtifactView({ bookId }: { readonly bookId: string }) {
85 const artifactFile = useChatStore((s) => s.artifactFile);

Callers 1

ArtifactViewFunction · 0.85

Calls 5

presentCurrentStateFunction · 0.90
hasTableRowsFunction · 0.90
frontmatterToCardsFunction · 0.90
relabelOkrJargonFunction · 0.90
stripStructuralMarkersFunction · 0.90

Tested by

no test coverage detected