PageSourceSearch

https://longevityorbullshit.ai/assets/PromptsPage-BaVG6Pj1.js

js longevityorbullshit.ai collected 2026-10-05 14:16:46 UTC 6,995 bytes, 1 lines download raw bytes

1import{j as e}from"./index-Br5E4rSD.js";import{b as D,r as a}from"./react-vendor-CBchVYx_.js";import{c as V,d as z,e as B,f as F}from"./adminQueries-rz4c34gN.js";import"./helmet-DBXKHbMx.js";import"./supabase-XGDTwd-T.js";function _({title:l,sub:n,right:r}){return e.jsxs("div",{className:"flex items-baseline justify-between mb-4 flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] tracking-[0.2em] uppercase text-muted",children:"// ADMIN"}),e.jsx("h1",{className:"text-2xl font-bold mt-1",children:l}),n?e.jsx("p",{className:"text-[12px] text-muted mt-1",children:n}):null]}),r]})}function O(){const[l,n]=D(),r=l.get("key"),[d,m]=a.useState(null),[p,c]=a.useState(null),[x,u]=a.useState(!0);return a.useEffect(()=>{let s=!1;return u(!0),V().then(i=>{s||(m(i),c(null))}).catch(i=>{s||c(i instanceof Error?i.message:String(i))}).finally(()=>{s||u(!1)}),()=>{s=!0}},[]),r?e.jsx(H,{promptKey:r,onBack:()=>{l.delete("key"),n(l)}}):e.jsxs("div",{children:[e.jsx(_,{title:"Prompts Library",sub:"Edit the prompts that power every AI call. Edits go live on the next call."}),x?e.jsx("div",{className:"border border-dashed border-ink p-6 text-[12px] text-muted",children:"Loading…"}):p?e.jsxs("div",{className:"border border-bs px-3 py-2 text-[12px] text-bs",children:["// ",p]}):!d||d.length===0?e.jsx("div",{className:"border border-dashed border-ink p-6 text-[12px] text-muted",children:"No prompts yet."}):e.jsx("div",{className:"border border-ink overflow-x-auto",children:e.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-ink bg-paper",children:["Key","Function","Model","Version","Updated",""].map(s=>e.jsx("th",{className:"text-left px-3 py-2 tracking-[0.1em] uppercase text-[11px]",children:s},s))})}),e.jsx("tbody",{children:d.map(s=>e.jsxs("tr",{className:"border-b border-ink/30 hover:bg-paper/40",children:[e.jsx("td",{className:"px-3 py-2 font-bold uppercase tracking-[0.1em] text-[12px]",children:s.key}),e.jsx("td",{className:"px-3 py-2 text-muted",children:s.function_name}),e.jsx("td",{className:"px-3 py-2 text-muted",children:s.model}),e.jsxs("td",{className:"px-3 py-2 tabular-nums",children:["v",s.version]}),e.jsx("td",{className:"px-3 py-2 tabular-nums whitespace-nowrap",children:new Date(s.updated_at).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsx("button",{type:"button",className:"lob-pill",onClick:()=>{l.set("key",s.key),n(l)},children:"[ EDIT ]"})})]},s.key))})]})})]})}function H({promptKey:l,onBack:n}){const[r,d]=a.useState(null),[m,p]=a.useState([]),[c,x]=a.useState(null),[u,s]=a.useState(!0),[i,P]=a.useState(!1),[E,y]=a.useState(null),[h,v]=a.useState(""),[b,N]=a.useState(""),[o,k]=a.useState(""),[g,w]=a.useState(""),L=async()=>{s(!0);try{const[t,f]=await Promise.all([z(l),B(l)]);d(t),p(f),t&&(v(t.model),N(t.system),k(t.user_template),w(t.notes??"")),x(null)}catch(t){x(t instanceof Error?t.message:String(t))}finally{s(!1)}};a.useEffect(()=>{L()},[l]);const C=a.useMemo(()=>r?h!==r.model||b!==r.system||o!==r.user_template||(g??"")!==(r.notes??""):!1,[r,h,b,o,g]),A=async()=>{P(!0),y(null);try{await F(l,{model:h,system:b,user_template:o,notes:g||null}),y("Saved. New version is live for the next call."),await L()}catch(t){x(t instanceof Error?t.message:String(t))}finally{P(!1)}},M=t=>{v(t.model),N(t.system),k(t.user_template),w(t.notes??""),y(`Loaded v${t.version} into the editor. Click Save to make it the live version.`)},$=a.useMemo(()=>{const t=Array.from(o.matchAll(/\{\{\s*(\w+)\s*\}\}/g)).map(S=>S[1]),f=Array.from(new Set(t));return f.length?`Placeholders: ${f.map(S=>`{{${S}}}`).join(", ")}`:"No {{placeholders}} detected."},[o]);return e.jsxs("div",{children:[e.jsx(_,{title:`Prompt: ${l}`,sub:r?`Function: ${r.function_name} · Live version: v${r.version}`:"Loading…",right:e.jsx("button",{type:"button",className:"lob-pill",onClick:n,children:"[ ← BACK ]"})}),u?e.jsx("div",{className:"border border-dashed border-ink p-6 text-[12px] text-muted",children:"Loading…"}):c?e.jsxs("div",{className:"border border-bs px-3 py-2 text-[12px] text-bs mb-3",children:["// ",c]}):r?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{label:"Model",children:e.jsx("input",{type:"text",value:h,onChange:t=>v(t.target.value),className:"w-full border border-ink px-3 py-2 text-[13px] font-mono bg-white"})}),e.jsx(j,{label:"System",children:e.jsx("textarea",{value:b,onChange:t=>N(t.target.value),rows:8,className:"w-full border border-ink px-3 py-2 text-[12px] font-mono bg-white leading-relaxed resize-y"})}),e.jsx(j,{label:"User template",hint:$,children:e.jsx("textarea",{value:o,onChange:t=>k(t.target.value),rows:10,className:"w-full border border-ink px-3 py-2 text-[12px] font-mono bg-white leading-relaxed resize-y"})}),e.jsx(j,{label:"Notes (internal)",children:e.jsx("textarea",{value:g,onChange:t=>w(t.target.value),rows:3,className:"w-full border border-ink px-3 py-2 text-[12px] font-mono bg-white leading-relaxed resize-y"})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:A,disabled:!C||i,className:"bg-ink text-white px-3 py-1.5 text-[11px] tracking-[0.15em] uppercase font-bold disabled:opacity-50",children:i?"Saving…":C?"Save new version":"No changes"}),E?e.jsxs("span",{className:"text-[12px] text-muted",children:["// ",E]}):null]})]}),e.jsxs("div",{className:"border border-ink",children:[e.jsx("div",{className:"border-b border-ink bg-paper px-3 py-2 text-[11px] tracking-[0.15em] uppercase font-bold",children:"Version History"}),e.jsx("div",{className:"max-h-[70vh] overflow-auto",children:m.length===0?e.jsx("div",{className:"px-3 py-3 text-[12px] text-muted",children:"No history yet."}):m.map(t=>e.jsxs("div",{className:"border-b border-ink/30 px-3 py-2 text-[12px]",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsxs("div",{className:"font-bold tabular-nums",children:["v",t.version]}),e.jsx("div",{className:"text-[10px] text-muted tabular-nums",children:new Date(t.created_at).toLocaleStr
1ing(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),e.jsx("div",{className:"text-[11px] text-muted truncate",children:t.model}),e.jsx("button",{type:"button",className:"lob-pill mt-1",onClick:()=>M(t),children:"[ LOAD ]"})]},t.id))})]})]}):e.jsx("div",{className:"border border-dashed border-ink p-6 text-[12px] text-muted",children:"Prompt not found."})]})}function j({label:l,hint:n,children:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-1",children:[e.jsx("label",{className:"text-[11px] tracking-[0.15em] uppercase font-bold",children:l}),n?e.jsx("span",{className:"text-[10px] text-muted",children:n}):null]}),r]})}export{O as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.