import { createSignal, For, Show } from "solid-js"; import { useParams } from "@solidjs/router"; import { api, type ReportPayload } from "../lib/api"; import { Citations } from "../components/Citations"; export default function Report() { const params = useParams(); const [rep, setRep] = createSignal(null); const [md, setMd] = createSignal(""); const [question, setQuestion] = createSignal("kenapa conviction segitu?"); const [answer, setAnswer] = createSignal(""); const [err, setErr] = createSignal(""); async function load() { setErr(""); try { setRep(await api.report(params.ticker)); } catch (e) { setErr(String(e)); } } async function exportMd() { setMd(await api.reportMd(params.ticker)); } async function ask() { const r = await api.interrogate(params.ticker, question()); setAnswer(r.answer); } return (

Report: {params.ticker}

{err()}

{rep()!.synthesis.recommendation} ยท conviction {rep()!.synthesis.conviction}/5

{rep()!.synthesis.thesis}

{(s) =>

{s.name}

{s.body}

}

Interrogate this report

setQuestion(e.currentTarget.value)} style={{ width: "320px" }} />

{answer()}

{md().slice(0, 2000)}
); }