PageSourceSearch

https://creator-business-builder.lovable.app/assets/app.admin.ai-CjVznGDc.js

js creator-business-builder.lovable.app collected 2026-10-03 03:28:18 UTC 2,964 bytes, 1 lines download raw bytes

1import{r as c,j as e,U as y,t as n,s as m}from"./index-C6RMC_rY.js";import{u as b}from"./useServerFn-D8uxhI6B.js";import{a as N}from"./ai.functions-BPerNgOe.js";import{S as g}from"./switch-Dp_Len_B.js";import"./index-DIDjHFMv.js";import"./index-DC4j_v-9.js";import"./utils-BQHNewu7.js";function G(){const p=b(N),[x,d]=c.useState([]),[i,u]=c.useState(""),l=()=>p().then(d).catch(s=>n.error(String(s?.message??s)));c.useEffect(()=>{l()},[]);async function h(s,t){const{error:a}=await m.rpc("admin_set_ai",{_ws:s.id,_beta:!0,_unlimited:t});if(a)return n.error(a.message);d(r=>r.map(o=>o.id===s.id?{...o,unlimited:t}:o))}async function f(s){const t=prompt(`Grant how many AI credits to ${s.name}? (negative to remove)`),a=Number(t);if(!t||!Number.isInteger(a)||a===0)return;const{error:r}=await m.rpc("admin_grant_ai_credits",{_ws:s.id,_amount:a,_note:"Granted by super admin"});if(r)return n.error(r.message);n.success(`${a} credits granted`),l()}const j=x.filter(s=>!i||`${s.name} ${s.slug}`.toLowerCase().includes(i.toLowerCase()));return e.jsxs("div",{className:"mx-auto max-w-6xl space-y-6 px-5 py-8 md:py-10",children:[e.jsx(y,{title:"AI assistant"}),e.jsx("p",{className:"text-sm text-ink-soft",children:"The AI assistant is available to every workspace. Give unlimited credits or grant a one-off amount. Plans get a monthly allowance: Trial 300, Starter 2,000, Grow 4,000, Scale 8,000 credits (1 credit = 1,000 AI tokens). Top-up: 2,000 credits for $29."}),e.jsx("input",{type:"search",autoComplete:"off",name:"cajobo-admin-ai-search",className:"input max-w-sm",placeholder:"Search workspaces",value:i,onChange:s=>u(s.target.value)}),e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-surface",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-left text-xs uppercase text-ink-soft",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"Workspace"}),e.jsx("th",{className:"px-4 py-3",children:"Plan"}),e.jsx("th",{className:"px-4 py-3",children:"Unlimited"}),e.jsx("th",{className:"px-4 py-3",children:"Balance"}),e.jsx("th",{className:"px-4 py-3",children:"Questions"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{children:j.map(s=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-ink",children:s.name}),e.jsx("td",{className:"px-4 py-3 capitalize text-ink-soft",children:s.plan}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(g,{checked:s.unlimited,onCheckedChange:t=>{h(s,t)}})}),e.jsx("td",{className:"px-4 py-3 text-ink",children:s.unlimited?"Unlimited":s.balance}),e.jsx("td",{className:"px-4 py-3 text-ink-soft",children:s.questions}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsx("button",{onClick:()=>{f(s)},className:"rounded-lg border border-border px-2.5 py-1 text-xs font-medium hover:bg-surface-2",children:"Grant credits"})})]},s.id))})]})})]})}export{G as component};

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.