forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

rag-output-content.tsx24 lines, 985 bytesHistoryRawDownload
1import { For, Show } from "solid-js";
2import { payloadPoints, payloadText } from "@/components/notes/rag-output-document";
3
4/** Render the useful parts of the AI service's open payload without exposing a JSON dump first. */
5export function RagOutputContent(props: { payload: unknown }) {
6 const summary = () => payloadText(props.payload);
7 const points = () => payloadPoints(props.payload);
8
9 return (
10 <div class="space-y-3 text-sm leading-6">
11 <Show when={summary()}>
12 {(text) => <p class="whitespace-pre-wrap text-foreground">{text()}</p>}
13 </Show>
14 <Show when={points().length > 0}>
15 <ul class="list-disc space-y-1 pl-5 text-foreground/85">
16 <For each={points()}>{(point) => <li>{point}</li>}</For>
17 </ul>
18 </Show>
19 <Show when={!summary() && points().length === 0}>
20 <pre class="overflow-x-auto whitespace-pre-wrap text-xs leading-5">{JSON.stringify(props.payload, null, 2)}</pre>
21 </Show>
22 </div>
23 );
24}