module Web.View.CollectiveProposals.Show where
import Web.View.Prelude
import Web.View.CollectiveProposals.Index (consensusBadge)
import Data.Aeson (Value)
data ShowView = ShowView
{ proposal :: !CollectiveProposal
, agentContributions :: ![(CollectiveProposalContribution, Text)]
-- ^ (contribution, agent name)
}
instance View ShowView where
html ShowView { .. } = [hsx|
{proposal.title}
{proposal.taskType}
{consensusBadge proposal.consensusStatus}
{maybe mempty renderProposalSummary proposal.summary}
{maybe mempty renderFinalContent proposal.finalContent}
Agent Contributions ({show (length agentContributions)})
{forEach agentContributions renderContrib}
|]
renderProposalSummary :: Text -> Html
renderProposalSummary s = [hsx|{s}
|]
renderFinalContent :: Value -> Html
renderFinalContent fc = [hsx|
Synthesized Recommendation
{show fc}
|]
renderContrib :: (CollectiveProposalContribution, Text) -> Html
renderContrib (contrib, agentName) = [hsx|
{agentName}
{maybe "" (\m -> "model: " <> m) contrib.modelUsed}
{maybe "" (\t -> " ยท " <> show t <> " tokens out") contrib.tokensOut}
{show contrib.content}
|]