PageSourceSearch

https://writey.co/build/assets/Index-BMcgw2T_.js

js writey.co collected 2026-09-24 14:38:08 UTC 6,526 bytes, 1 lines download raw bytes

1import{j as e,b as x}from"./app-BL5hIl4f.js";import{A as y}from"./AdminLayout-boSpiSp7.js";import"./HomeIcon-D6JLb6tp.js";import"./WrenchScrewdriverIcon-BewzIUzm.js";import"./MegaphoneIcon-DurPpSrc.js";function S({providers:r,tools:d,plans:s,default_provider:i,overrides:n}){return e.jsx(y,{title:"Settings",children:e.jsxs("div",{className:"space-y-8 max-w-4xl",children:[e.jsx(h,{providers:r,defaultProvider:i}),e.jsx(k,{tools:d}),e.jsx(f,{plans:s,overrides:n})]})})}const u={openai:"OpenAI"};function p(r){return u[r]??r.charAt(0).toUpperCase()+r.slice(1)}function h({providers:r,defaultProvider:d}){const{data:s,setData:i,post:n,processing:l}=x({providers:r.map(t=>({key:t.key,enabled:t.enabled})),default_provider:d}),g=t=>{i("providers",s.providers.map(o=>o.key===t?{...o,enabled:!o.enabled}:o))},a=t=>{t.preventDefault(),n("/admin/settings/providers")};return e.jsxs("form",{onSubmit:a,className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-1",children:"AI Providers"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-5",children:"Toggle providers and choose which one to use by default."}),e.jsx("div",{className:"space-y-2 mb-6",children:r.map(t=>{const m=s.providers.find(b=>b.key===t.key)?.enabled??!1,c=s.default_provider===t.key;return e.jsxs("div",{className:"flex items-center gap-4 p-3 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800/50",children:[e.jsx("button",{type:"button",onClick:()=>g(t.key),disabled:!t.has_key,title:t.has_key?m?"Disable provider":"Enable provider":"API key not configured",className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 ${m?"bg-indigo-600":"bg-gray-300 dark:bg-gray-600"} ${t.has_key?"":"opacity-50 cursor-not-allowed"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${m?"translate-x-4.5":"translate-x-0.5"}`})}),e.jsxs("div",{className:"flex-1 min-w-0 leading-tight",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-semibold ${m?"text-gray-900 dark:text-white":"text-gray-400 dark:text-gray-500"}`,children:p(t.key)}),c&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",children:"Default"})]}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:[t.models?.default||"No model configured",!t.has_key&&" · No API key"]})]}),m&&!c&&e.jsx("button",{type:"button",onClick:()=>i("default_provider",t.key),className:"flex-shrink-0 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-indigo-600 dark:hover:text-indigo-400",children:"Set as default"})]},t.key)})}),e.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:l?"Saving...":"Save Providers"})]})}function k({tools:r}){const{data:d,setData:s,post:i,processing:n}=x({tools:r.map(a=>({key:a.key,enabled:a.enabled}))}),l=a=>{s("tools",d.tools.map(t=>t.key===a?{...t,enabled:!t.enabled}:t))},g=a=>{a.preventDefault(),i("/admin/settings/tools")};return e.jsxs("form",{onSubmit:g,className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-1",children:"Tools"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-5",children:"Toggle tools on or off."}),e.jsx("div",{className:"space-y-2 mb-6",children:d.tools.map(a=>{const t=r.find(o=>o.key===a.key);return e.jsxs("div",{className:"flex items-center gap-3 p-3 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800/50",children:[e.jsx("button",{type:"button",onClick:()=>l(a.key),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 ${a.enabled?"bg-indigo-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${a.enabled?"translate-x-4.5":"translate-x-0.5"}`})}),e.jsx("span",{className:`text-sm font-medium ${a.enabled?"text-gray-900 dark:text-white":"text-gray-400 dark:text-gray-500"}`,children:t?.name||a.key})]},a.key)})}),e.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:n?"Saving...":"Save Tools"})]})}function f({plans:r,overrides:d}){const{data:s,setData:i,post:n,processing:l}=x({free_daily:d?.limits?.free_daily??r?.free?.tool_uses_per_day??3,pro_daily:d?.limits?.pro_daily??r?.pro?.tool_uses_per_day??""}),g=a=>{a.preventDefault(),n("/admin/settings/limits")};return e.jsxs("form",{onSubmit:g,className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-1",children:"Rate Limits"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-5",children:"Adjust daily tool usage limits per plan."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6 max-w-md",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Free Plan (daily)"}),e.jsx("input",{type:"number",value:s.free_daily,onChange:a=>i("free_daily",parseInt(a.target.value)||1),className:"w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Pro Plan (daily)"}),e.jsx("input",{type:"number",value:s.pro_daily,onChange:a=>i("pro_daily",a.target.value?parseInt(a.target.value):""),placeholder:"Unlimited",className:"w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white text-sm"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Leave empty for unlimited"})]})]}),e.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:l?"Saving...":"Save Limits"})]})}
1export{S 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.