hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { For, Show } from "solid-js"; |
| 2 | import { 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. */ |
| 5 | export 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 | } |