@chenpu17/cc-gw 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/web/dist/assets/{About-DADVPUhW.js → About-C_IouOGj.js} +1 -1
- package/src/web/dist/assets/{ApiKeys-DdFhoA4z.js → ApiKeys-Dz-M_uW5.js} +1 -1
- package/src/web/dist/assets/{ConfirmDialog-DopoB7CA.js → ConfirmDialog-COgrXiJw.js} +1 -1
- package/src/web/dist/assets/{Dashboard-CBDC3lcl.js → Dashboard-81R9MI8r.js} +1 -1
- package/src/web/dist/assets/{Events-UNpWTigu.js → Events-B1zBaQzl.js} +1 -1
- package/src/web/dist/assets/{Help-D1pNXm10.js → Help-DM0vXHor.js} +1 -1
- package/src/web/dist/assets/{Login-B_yWya4w.js → Login-ygiPlEBP.js} +1 -1
- package/src/web/dist/assets/{Logs-DMxgWFjk.js → Logs-DKh46bsP.js} +1 -1
- package/src/web/dist/assets/ModelManagement-71W1a6n9.js +1 -0
- package/src/web/dist/assets/{Profiler-B24pf-u2.js → Profiler-l9K8vLHs.js} +1 -1
- package/src/web/dist/assets/{RoutingManagement-CiODaKbs.js → RoutingManagement-CYdcFS8f.js} +1 -1
- package/src/web/dist/assets/{Settings-DkDJipv4.js → Settings-DJp6w85X.js} +1 -1
- package/src/web/dist/assets/{app-Bd27xdw7.js → app-C09yoSxh.js} +2 -2
- package/src/web/dist/assets/{gateway-BJysEYM8.js → gateway-Bf1h2eFf.js} +1 -1
- package/src/web/dist/assets/{landing-DjqZxabN.js → landing-BF3DRAr3.js} +1 -1
- package/src/web/dist/assets/package-anTRKkYU.js +1 -0
- package/src/web/dist/assets/{useApiQuery-rsgixQ8H.js → useApiQuery-828HesQD.js} +1 -1
- package/src/web/dist/assets/{useAppMutation-Cxb97sFV.js → useAppMutation-Com8yWoS.js} +1 -1
- package/src/web/dist/assets/{useModelManagementState-M3Ms-cuY.js → useModelManagementState-DY72pEhZ.js} +1 -1
- package/src/web/dist/index.html +1 -1
- package/src/web/dist/landing.html +2 -2
- package/src/web/dist/assets/ModelManagement-BTDHuojc.js +0 -1
- package/src/web/dist/assets/package-_RyhJB5F.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,ax as ce,aB as me,aC as ue,N as xe,r as f,aa as pe,S as he}from"./vendor-LWJeAdU1.js";import{L as fe}from"./router-DspBTS8b.js";import{C as be}from"./ConfirmDialog-DopoB7CA.js";import{P as ge}from"./PageHeader-C01S2XTN.js";import{B as b}from"./app-Bd27xdw7.js";import{B as W}from"./queryKeys-DDTfNI_C.js";import{C as J,a as Z}from"./card-BMPheH9g.js";import{I as M}from"./input-1_zNDnlx.js";import{u as E}from"./i18n-B3N4Df3E.js";import{D as ve,A as je,a as ye,b as we,c as Ne,d as ke,e as Me}from"./DialogShell-blgQezT9.js";import{L as C}from"./label-B5W3eu-E.js";import{S as Ce}from"./switch-BqheRBDw.js";import{u as De}from"./useModelManagementState-M3Ms-cuY.js";import{c as Te}from"./global-B_AcmMvG.js";import"./query-Cpxr1dul.js";import"./radix-bG5h1Ymq.js";import"./gateway-BJysEYM8.js";import"./useAppMutation-Cxb97sFV.js";import"./useApiQuery-rsgixQ8H.js";function Pe({providersLength:d,filteredProviders:a,defaultLabels:c,providerSearch:g,providerTypeFilter:p,configPending:y,testingProviderId:s,onOpenEdit:t,onTestConnection:i,onRequestDelete:m,onProviderSearchChange:v,onResetFilters:w}){const{t:h}=E(),A=u=>{const D=u.authMode??(u.type==="anthropic"?"authToken":"apiKey");return D==="authToken"?"Bearer":D==="xAuthToken"?"X-Auth-Token":u.type==="anthropic"?"X-API-Key":h("providers.card.providerDefault")};return e.jsx(J,{className:"rounded-[1.35rem] border border-white/70 bg-card/95 shadow-[0_22px_56px_-46px_rgba(15,23,42,0.24)]",children:e.jsxs(Z,{className:"space-y-4 p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 rounded-[1.1rem] bg-secondary/60 p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(M,{value:g,onChange:u=>v(u.target.value),placeholder:h("providers.filters.searchPlaceholder"),className:"h-10 bg-card/90 sm:max-w-[520px]"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(W,{variant:"secondary",className:"rounded-full px-3 py-1 text-xs",children:h("providers.count",{count:a.length})}),e.jsx(b,{variant:"ghost",size:"sm",onClick:w,disabled:!g.trim()&&p==="all",className:"h-8 rounded-full px-3 text-xs",children:h("common.actions.reset")})]})]}),y?e.jsx("div",{className:"flex min-h-[200px] items-center justify-center rounded-lg bg-secondary text-sm text-muted-foreground",children:h("common.loading")}):d===0?e.jsxs("div",{className:"rounded-lg border-2 border-dashed border-border/30 p-12 text-center text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium",children:h("providers.emptyState")}),e.jsx("p",{className:"mt-2 text-xs",children:h("providers.emptyStateSub",{default:"点击上方按钮添加您的第一个提供商"})})]}):a.length===0?e.jsx("div",{className:"rounded-lg border-2 border-dashed border-border/30 p-12 text-center text-sm text-muted-foreground",children:e.jsx("p",{className:"font-medium",children:h("providers.emptyFiltered")})}):e.jsx("div",{className:"space-y-3",children:e.jsx("div",{className:"grid gap-2.5 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5",children:a.map(u=>{var j;const D=A(u),T=((j=u.models)==null?void 0:j.length)??0,P=c.get(u.id);return e.jsx(Ue,{provider:u,authMode:D,modelCount:T,defaultModel:P,isTesting:s===u.id,onEdit:()=>t(u),onTest:()=>i(u),onDelete:()=>m(u),t:h},u.id)})})})]})})}function Ue({provider:d,authMode:a,modelCount:c,defaultModel:g,isTesting:p,onEdit:y,onTest:s,onDelete:t,t:i}){const m=!!g,v=m?"success":"warning",w=i(m?"providers.status.ready":"providers.status.needsDefault");return e.jsx(J,{className:"overflow-hidden rounded-[1rem] border border-border/60 bg-[linear-gradient(180deg,rgba(255,255,255,0.97)_0%,rgba(250,251,253,0.94)_100%)] shadow-[0_14px_32px_-30px_rgba(15,23,42,0.2)] transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_20px_38px_-32px_rgba(59,130,246,0.18)] dark:border-white/10 dark:bg-[linear-gradient(180deg,rgba(15,23,42,0.92)_0%,rgba(2,6,23,0.88)_100%)]",children:e.jsxs(Z,{className:"space-y-2.5 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2.5",children:e.jsx("h4",{className:"truncate text-[14px] font-semibold tracking-[-0.02em] text-foreground",title:d.label||d.id,children:d.label||d.id})}),e.jsx("code",{className:"mt-0.5 block truncate text-[11px] text-muted-foreground",title:d.id,children:d.id})]}),e.jsx(W,{variant:v,className:"shrink-0 rounded-full px-2 py-0.5 text-[10px]",children:w})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[e.jsx(Q,{icon:e.jsx(ce,{className:"h-3.5 w-3.5"}),label:i("providers.card.authMode"),value:a}),e.jsx(Q,{icon:e.jsx(me,{className:"h-3.5 w-3.5"}),label:i("providers.card.modelsTitle"),value:c>0?i("providers.card.modelCount",{count:c}):i("providers.card.passthrough")})]}),e.jsxs("div",{className:"space-y-1.5 rounded-[0.85rem] bg-secondary/45 p-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] dark:bg-slate-900/[0.42]",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx(ue,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("code",{className:"truncate",title:d.baseUrl,children:d.baseUrl})]}),e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground/70",children:i("providers.card.defaultModelLabel")}),g?e.jsx("code",{className:"min-w-0 truncate rounded-full border border-border/65 bg-background/82 px-2 py-0.5 text-[10px] text-foreground dark:border-white/10 dark:bg-slate-950/[0.58]",title:g,children:g}):e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:i("providers.card.noDefault")})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1 border-t border-border/45 pt-2",children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:y,className:"h-7 rounded-full px-2 text-[11px]",children:i("providers.actions.edit")}),e.jsx(b,{variant:"ghost",size:"sm",onClick:s,disabled:p,className:"h-7 rounded-full px-2 text-[11px]",children:p?e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"mr-1 h-3 w-3 animate-spin"}),i("common.actions.testingConnection")]}):i("providers.actions.test")}),e.jsx(b,{variant:"ghost",size:"sm",onClick:t,className:"h-7 rounded-full px-2 text-[11px] text-destructive hover:bg-destructive/10 hover:text-destructive",children:i("providers.actions.delete")})]})]})})}function Q({icon:d,label:a,value:c}){return e.jsxs("div",{className:"min-w-0 rounded-[0.75rem] bg-secondary/55 px-2 py-1.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.58)] dark:bg-slate-900/[0.5]",children:[e.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[d,e.jsx("span",{className:"truncate",children:a})]}),e.jsx("p",{className:"truncate text-[11px] font-medium text-foreground",title:c,children:c})]})}function Ae({open:d,provider:a,options:c,usePreset:g,preservedExtras:p,onPresetChange:y,onConfirm:s,onClose:t}){const{t:i}=E();return a?e.jsx(ve,{open:d,onOpenChange:m=>!m&&t(),children:e.jsxs(je,{className:"max-w-2xl",children:[e.jsxs(ye,{children:[e.jsx(we,{children:i("providers.testDialog.title")}),e.jsx(Ne,{children:i("providers.testDialog.subtitle",{name:a.label||a.id})})]}),e.jsxs(ke,{className:"space-y-4",children:[e.jsx("div",{className:"rounded-xl bg-accent p-4 text-sm text-primary",children:i("providers.testDialog.description")}),e.jsxs("div",{className:"space-y-4 rounded-xl bg-secondary/50 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"provider-test-preset",children:i("providers.testDialog.presetLabel")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("providers.testDialog.presetDescription")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(Ce,{id:"provider-test-preset",checked:g,onCheckedChange:y})})]}),g?e.jsx("div",{className:"space-y-2",children:e.jsxs("details",{className:"rounded-xl border border-transparent bg-card p-2 text-xs shadow-[var(--surface-shadow)]",children:[e.jsx("summary",{className:"cursor-pointer text-primary hover:underline",children:i("providers.testDialog.presetPreviewSummary")}),e.jsx("div",{className:"mt-2 space-y-1",children:c.map(m=>e.jsxs("code",{className:"block rounded-lg bg-secondary px-2 py-1 text-xs",children:[m.key,": ",m.value]},m.key))})]})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:i("providers.testDialog.presetDescription")})]}),Object.keys(p).length>0&&e.jsxs("div",{className:"space-y-2 rounded-xl bg-secondary/50 p-4 text-xs",children:[e.jsx("p",{className:"font-medium",children:i("providers.testDialog.preservedInfo")}),Object.entries(p).map(([m,v])=>e.jsxs("code",{className:"block rounded-lg border border-transparent bg-card px-2 py-1 shadow-[var(--surface-shadow)]",children:[m,": ",v]},m))]})]}),e.jsxs(Me,{children:[e.jsx(b,{variant:"outline",onClick:t,children:i("providers.testDialog.cancel")}),e.jsx(b,{onClick:()=>void s(),children:i("providers.testDialog.primary")})]})]})}):null}function F(){return typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2,10)}function Se(){return{_key:F(),id:"",label:""}}const _={openai:{baseUrl:"https://api.openai.com/v1"},deepseek:{baseUrl:"https://api.deepseek.com/v1"},huawei:{baseUrl:"https://api.modelarts-maas.com/v1"},kimi:{baseUrl:"https://api.moonshot.cn/v1"},anthropic:{baseUrl:"https://api.anthropic.com/v1"},custom:{}},V=[{value:"openai",label:"OpenAI"},{value:"deepseek",label:"DeepSeek"},{value:"huawei",label:"Huawei Cloud"},{value:"kimi",label:"Kimi"},{value:"anthropic",label:"Anthropic"},{value:"custom",label:"Custom"}];function I(d){return d==="anthropic"?"authToken":"apiKey"}function Y(d){return d?{id:d.id,label:d.label??d.id,baseUrl:d.baseUrl,apiKey:d.apiKey??"",type:d.type??"custom",defaultModel:d.defaultModel??"",models:(d.models??[]).map(a=>({...a,_key:F()})),authMode:d.authMode??I(d.type??"custom")}:{id:"",label:"",baseUrl:"",apiKey:"",type:"custom",defaultModel:"",models:[],authMode:I("custom")}}function _e(d){return{_key:F(),id:d.id,label:d.label}}function Ie({open:d,mode:a,provider:c,existingProviderIds:g,onClose:p,onSubmit:y}){const{t:s}=E(),[t,i]=f.useState(()=>Y(c)),[m,v]=f.useState({}),[w,h]=f.useState(!1),[A,u]=f.useState(null),D=f.useRef(null),T=f.useRef(null),P=f.useRef(null),[j,H]=f.useState(a==="edit");f.useEffect(()=>{d&&(i(Y(c)),v({}),u(null),h(!1),H(a==="edit"))},[d,c,a]),f.useEffect(()=>{if(!d)return;const r=l=>{l.key==="Escape"&&p()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[d,p]),f.useEffect(()=>{if(d){if(a==="create"&&P.current){P.current.focus();return}T.current&&T.current.focus()}},[d,a]);const L=a==="create",K=f.useMemo(()=>t.models.filter(r=>r.id.trim().length>0),[t.models]),z=f.useMemo(()=>{var r;return((r=V.find(l=>l.value===t.type))==null?void 0:r.label)??"Custom"},[t.type]),q=(r,l)=>s(l==="authToken"?"providers.drawer.fields.authModeAuthToken":l==="xAuthToken"?"providers.drawer.fields.authModeXAuthToken":r==="anthropic"?"providers.drawer.fields.authModeApiKey":"providers.drawer.fields.authModeProviderDefault"),$=t.label.trim()||t.id.trim()||s("providers.drawer.summary.untitled"),X=f.useMemo(()=>[{label:s("providers.drawer.summary.type"),value:z},{label:s("providers.drawer.summary.auth"),value:q(t.type,t.authMode)},{label:s("providers.drawer.summary.models"),value:K.length.toLocaleString()}],[K.length,t.authMode,t.type,z,s]),R=r=>l=>{i(n=>({...n,[r]:l}))},ee=r=>{i(l=>{const o=!j||l.label.trim().length===0||l.label===l.id?r:l.label;return{...l,id:r,label:o}})},re=r=>{i(l=>{var G;const o=_[r??"custom"]??_.custom,x=I(l.type),N=I(r),k=Object.values(_).map(U=>U.baseUrl).filter(U=>!!U),B=!l.baseUrl||k.includes(l.baseUrl),ne=a==="create"&&(l.models.length===0||l.models.every(U=>U.id.trim().length===0)),S={...l,type:r,authMode:l.authMode===x?N:l.authMode};return o!=null&&o.baseUrl&&B&&(S.baseUrl=o.baseUrl),o!=null&&o.models&&ne&&(S.models=o.models.map(_e),S.defaultModel=o.defaultModel??((G=o.models[0])==null?void 0:G.id)??""),S})},se=(r,l)=>{i(n=>{const o=[...n.models];return o[r]={...o[r],...l},{...n,models:o}})},ae=(r,l)=>{i(n=>{const o=[...n.models],x=o[r];if(!x)return n;const N=!j||!x.label||x.label===x.id,k={...x,id:l,label:N?l:x.label};o[r]=k;const B=n.defaultModel===x.id?l:n.defaultModel;return{...n,models:o,defaultModel:B}})},te=r=>{i(l=>{if(r<0||r>=l.models.length)return l;const n=l.models.filter((x,N)=>N!==r);let o=l.defaultModel;return n.some(x=>x.id===o)||(o=""),{...l,models:n,defaultModel:o}})},de=()=>{i(r=>({...r,models:[...r.models,Se()]}))},O=r=>{i(l=>({...l,authMode:r}))},le=()=>{const r={},l=t.id.trim(),n=t.baseUrl.trim();if(a==="create"&&(l.length===0?r.id=s("providers.drawer.errors.idRequired"):g.includes(l)&&(r.id=s("providers.drawer.errors.idDuplicate"))),a==="edit"&&l.length===0&&(r.id=s("providers.drawer.errors.idRequired")),n.length===0)r.baseUrl=s("providers.drawer.errors.baseUrlInvalid");else try{new URL(n)}catch{r.baseUrl=s("providers.drawer.errors.baseUrlInvalid")}if(t.models.length>0){const o=new Set;t.models.some(N=>{const k=N.id.trim();return k.length===0||o.has(k)?!0:(o.add(k),!1)})&&(r.models=s("providers.drawer.errors.modelInvalid"))}return t.defaultModel&&!t.models.some(o=>o.id===t.defaultModel)&&(r.models=s("providers.drawer.errors.defaultInvalid")),v(r),Object.keys(r).length===0},ie=()=>{const r=t.models.map(o=>{var x;return{id:o.id.trim(),label:(x=o.label)!=null&&x.trim()?o.label.trim():void 0}}).filter(o=>o.id.length>0),l=c!=null&&c.extraHeaders&&Object.keys(c.extraHeaders).length>0?c.extraHeaders:void 0,n=t.authMode==="apiKey"&&t.type!=="anthropic"?void 0:t.authMode;return{id:t.id.trim(),label:t.label.trim()||t.id.trim(),baseUrl:t.baseUrl.trim(),apiKey:t.apiKey.trim()||void 0,type:t.type??"custom",defaultModel:t.defaultModel||void 0,models:r.length>0?r:void 0,extraHeaders:l,authMode:n}},oe=async()=>{if(u(null),!!le()){h(!0);try{const r=ie();await y(r)}catch(r){u(s("providers.drawer.toast.saveFailure",{message:r instanceof Error?r.message:"unknown"})),h(!1);return}h(!1),p()}};return d?e.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[e.jsx("div",{className:"flex-1 bg-background/80 backdrop-blur-sm",onClick:p,"aria-hidden":"true"}),e.jsxs("aside",{ref:D,role:"dialog","aria-modal":"true","aria-labelledby":"provider-drawer-title","aria-describedby":"provider-drawer-desc",className:"flex h-full min-h-0 w-full max-w-5xl flex-col border-l border-border/45 bg-background/96 shadow-[var(--surface-shadow-lg)] backdrop-blur",children:[e.jsxs("header",{className:"border-b border-border/45 bg-secondary/45 px-6 py-5 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"inline-flex rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-primary",children:s(L?"providers.drawer.quickStart":"providers.drawer.editTitle")}),e.jsxs("div",{children:[e.jsx("h2",{id:"provider-drawer-title",className:"text-lg font-semibold tracking-[-0.02em]",children:s(L?"providers.drawer.createTitle":"providers.drawer.editTitle")}),e.jsx("p",{id:"provider-drawer-desc",className:"text-sm text-muted-foreground",children:s("providers.drawer.description")})]})]}),e.jsx(b,{type:"button",ref:T,variant:"outline",onClick:p,className:"bg-card",children:s("common.actions.close")})]}),e.jsx("div",{className:"mt-4 grid gap-3 md:grid-cols-3",children:X.map(r=>e.jsxs("div",{className:"rounded-xl border border-transparent bg-card px-4 py-3 shadow-[var(--surface-shadow)]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:r.label}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-foreground",children:r.value})]},r.label))})]}),e.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden xl:grid-cols-[minmax(0,1fr)_280px]",children:[e.jsxs("div",{className:"min-h-0 overflow-y-auto px-6 py-5 pb-10",children:[e.jsxs("section",{className:"space-y-5","aria-labelledby":"provider-type-fields",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{id:"provider-type-fields",className:"text-sm font-semibold",children:s("providers.drawer.sections.type")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("providers.drawer.hints.type")})]}),e.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:V.map(r=>{var n;const l=r.value===t.type;return e.jsxs("button",{type:"button",onClick:()=>re(r.value),className:Te("rounded-2xl border px-4 py-3 text-left transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l?"border-primary bg-primary/10 text-primary shadow-sm":"border-border bg-card text-foreground hover:border-primary/20 hover:bg-accent/50"),children:[e.jsx("div",{className:"text-sm font-semibold",children:r.label}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:((n=_[r.value??"custom"])==null?void 0:n.baseUrl)??s("providers.drawer.hints.customProvider")})]},r.value??"custom")})})]}),e.jsxs("section",{className:"mt-8 space-y-4","aria-labelledby":"provider-basic-info",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{id:"provider-basic-info",className:"text-sm font-semibold",children:s("providers.drawer.sections.basic")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("providers.drawer.hints.basic")})]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:()=>H(r=>!r),className:"bg-card text-xs",children:s(j?"providers.drawer.fields.hideAdvanced":"providers.drawer.fields.showAdvanced")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.id")}),e.jsx(M,{value:t.id,ref:P,onChange:r=>ee(r.target.value),disabled:!L,placeholder:s("providers.drawer.fields.idPlaceholder"),"aria-invalid":!!m.id}),m.id?e.jsx("span",{className:"text-xs text-destructive",children:m.id}):null]}),e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.label")}),e.jsx(M,{value:t.label,onChange:r=>R("label")(r.target.value),placeholder:s("providers.drawer.fields.labelPlaceholder")})]})]}),e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.baseUrl")}),e.jsx(M,{value:t.baseUrl,onChange:r=>R("baseUrl")(r.target.value),placeholder:s("providers.drawer.fields.baseUrlPlaceholder"),"aria-invalid":!!m.baseUrl}),m.baseUrl?e.jsx("span",{className:"text-xs text-destructive",children:m.baseUrl}):null]})]}),e.jsxs("section",{className:"mt-8 space-y-4","aria-labelledby":"provider-auth-fields",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{id:"provider-auth-fields",className:"text-sm font-semibold",children:s("providers.drawer.sections.auth")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("providers.drawer.hints.auth")})]}),e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.apiKey")}),e.jsx(M,{value:t.apiKey,onChange:r=>R("apiKey")(r.target.value),placeholder:s("providers.drawer.fields.apiKeyPlaceholder")})]}),e.jsxs("fieldset",{className:"grid gap-2 rounded-xl border border-transparent bg-card p-4 text-xs shadow-[var(--surface-shadow)]",children:[e.jsx("legend",{className:"px-1 text-muted-foreground",children:s("providers.drawer.fields.authMode")}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s("providers.drawer.fields.authModeHint")}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-xl border border-transparent px-3 py-2 transition hover:bg-accent focus-within:bg-accent",children:[e.jsx("input",{type:"radio",name:"provider-auth-mode",value:"apiKey",checked:t.authMode==="apiKey",onChange:()=>O("apiKey"),className:"mt-0.5 h-4 w-4 accent-[hsl(var(--primary))]"}),e.jsx("span",{children:q(t.type,"apiKey")})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-xl border border-transparent px-3 py-2 transition hover:bg-accent focus-within:bg-accent",children:[e.jsx("input",{type:"radio",name:"provider-auth-mode",value:"authToken",checked:t.authMode==="authToken",onChange:()=>O("authToken"),className:"mt-0.5 h-4 w-4 accent-[hsl(var(--primary))]"}),e.jsx("span",{children:s("providers.drawer.fields.authModeAuthToken")})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-xl border border-transparent px-3 py-2 transition hover:bg-accent focus-within:bg-accent",children:[e.jsx("input",{type:"radio",name:"provider-auth-mode",value:"xAuthToken",checked:t.authMode==="xAuthToken",onChange:()=>O("xAuthToken"),className:"mt-0.5 h-4 w-4 accent-[hsl(var(--primary))]"}),e.jsx("span",{children:s("providers.drawer.fields.authModeXAuthToken")})]})]})]}),e.jsxs("section",{className:"mt-8 space-y-4","aria-labelledby":"provider-model-fields",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{id:"provider-model-fields",className:"text-sm font-semibold",children:s("providers.drawer.fields.models")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("providers.drawer.modelsDescription")})]}),e.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:de,className:"bg-card text-xs",children:s("providers.drawer.fields.addModel")})]}),m.models?e.jsx("p",{className:"text-xs text-destructive",children:m.models}):null,e.jsxs("div",{className:"space-y-4",children:[t.models.map((r,l)=>e.jsxs("div",{className:"rounded-xl border border-transparent bg-card p-4 shadow-[var(--surface-shadow)]",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.modelId")}),e.jsx(M,{value:r.id,onChange:n=>ae(l,n.target.value),placeholder:s("providers.drawer.fields.modelIdPlaceholder")})]}),j?e.jsxs(C,{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s("providers.drawer.fields.modelLabel")}),e.jsx(M,{value:r.label??"",onChange:n=>se(l,{label:n.target.value}),placeholder:s("providers.drawer.fields.modelLabelPlaceholder")})]}):null]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("input",{type:"radio",name:"defaultModel",value:r.id,checked:t.defaultModel===r.id,onChange:()=>i(n=>({...n,defaultModel:r.id})),disabled:r.id.trim().length===0,className:"h-4 w-4 accent-[hsl(var(--primary))]"}),s("providers.drawer.fields.setDefault")]}),e.jsx(b,{type:"button",variant:"ghost",size:"sm",className:"h-auto px-2 text-destructive",onClick:()=>te(l),disabled:t.models.length===0,children:s("providers.drawer.fields.removeModel")})]})]},r._key)),t.models.length===0?e.jsx("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-5 dark:border-amber-800 dark:bg-amber-950/30",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold text-amber-900 dark:text-amber-200",children:s("providers.drawer.noModelsTitle")}),e.jsx("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-300",children:s("providers.drawer.noModelsHint",{providerId:t.id||"provider-id"})}),e.jsxs("div",{className:"rounded-lg bg-secondary/50 p-2.5",children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-foreground",children:s("providers.drawer.routeExample")}),e.jsxs("code",{className:"block rounded-lg border border-transparent bg-card px-2.5 py-1.5 font-mono text-xs text-foreground shadow-[var(--surface-shadow)]",children:['"claude-*": "',(t.id||"provider-id").trim()||"provider-id",':*"']})]})]})}):null]}),K.length>1?e.jsx("div",{className:"text-xs text-muted-foreground",children:s("providers.drawer.defaultHint",{model:t.defaultModel||s("providers.card.noDefault")})}):null]})]}),e.jsx("aside",{className:"hidden min-h-0 overflow-y-auto border-l border-border/45 bg-secondary/40 px-5 py-5 xl:block",children:e.jsxs("div",{className:"sticky top-0 space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-transparent bg-card p-4 shadow-[var(--surface-shadow)]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:s("providers.drawer.formSummary")}),e.jsx("p",{className:"mt-2 text-base font-semibold",children:$}),e.jsx("div",{className:"mt-4 space-y-3 text-sm",children:X.map(r=>e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:r.label}),e.jsx("span",{className:"text-right font-medium",children:r.value})]},r.label))})]}),e.jsxs("div",{className:"rounded-xl border border-transparent bg-card p-4 shadow-[var(--surface-shadow)]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:s("providers.drawer.sections.checklist")}),e.jsxs("ul",{className:"mt-3 space-y-2 text-sm text-muted-foreground",children:[e.jsx("li",{children:s("providers.drawer.hints.checkUrl")}),e.jsx("li",{children:s("providers.drawer.hints.checkAuth")}),e.jsx("li",{children:s("providers.drawer.hints.checkModels")})]})]}),j&&e.jsxs("div",{className:"rounded-xl bg-accent p-4 text-sm text-foreground",children:[e.jsx("p",{className:"font-medium text-primary",children:s("providers.drawer.hints.advancedTitle")}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("providers.drawer.hints.advancedBody")})]})]})})]}),e.jsxs("footer",{className:"flex items-center justify-between gap-3 border-t border-border/45 bg-secondary/45 px-6 py-4 text-sm backdrop-blur-sm",children:[e.jsx("div",{className:"flex flex-col text-xs text-destructive","aria-live":"polite",children:A?e.jsx("span",{children:A}):null}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{type:"button",variant:"outline",onClick:p,disabled:w,className:"bg-card",children:s("common.actions.cancel")}),e.jsx(b,{type:"button",onClick:oe,disabled:w,children:s(w?"common.actions.saving":"common.actions.save")})]})]})]})]}):null}function er(){const{t:d}=E(),a=De();return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(ge,{icon:e.jsx(he,{className:"h-5 w-5","aria-hidden":"true"}),title:d("providers.title"),description:d("providers.description"),eyebrow:d("modelManagement.providersEyebrow"),breadcrumb:"Gateway / Providers",badge:d("providers.count",{count:a.providerCount}),actions:e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e.jsx(b,{asChild:!0,variant:"outline",className:"w-full sm:w-auto",children:e.jsxs(fe,{to:"/routing",children:[d("nav.routing"),e.jsx(pe,{className:"h-4 w-4","aria-hidden":"true"})]})}),e.jsx(b,{onClick:a.handleOpenCreate,className:"w-full sm:w-auto",children:d("providers.actions.add")})]})}),e.jsx(Pe,{configPending:a.configQuery.isPending||!a.config&&a.configQuery.isFetching,defaultLabels:a.defaultLabels,filteredProviders:a.filteredProviders,onOpenEdit:a.handleOpenEdit,onRequestDelete:c=>a.setConfirmAction({kind:"provider",provider:c}),onResetFilters:()=>{a.setProviderSearch(""),a.setProviderTypeFilter("all")},onProviderSearchChange:a.setProviderSearch,onProviderTypeChange:a.setProviderTypeFilter,onTestConnection:a.initiateTestConnection,providerSearch:a.providerSearch,providerTypeFilter:a.providerTypeFilter,providersLength:a.providers.length,testingProviderId:a.testingProviderId}),e.jsx(Ie,{open:a.drawerOpen,mode:a.drawerMode,provider:a.drawerMode==="edit"?a.editingProvider:void 0,existingProviderIds:a.providers.map(c=>c.id).filter(c=>a.drawerMode==="edit"&&a.editingProvider?c!==a.editingProvider.id:!0),onClose:()=>{a.setDrawerOpen(!1),a.setEditingProvider(void 0),a.setDrawerMode("create")},onSubmit:a.handleProviderSubmit}),e.jsx(Ae,{open:a.testDialogOpen,provider:a.testDialogProvider,options:a.anthropicTestHeaderOptions,preservedExtras:a.testDialogPreservedExtras,usePreset:a.testDialogUsePreset,onPresetChange:a.setTestDialogUsePreset,onConfirm:a.confirmTestDialog,onClose:a.closeTestDialog}),e.jsx(be,{open:!!a.confirmAction,onOpenChange:c=>{!c&&!a.confirmingAction&&a.setConfirmAction(null)},title:a.confirmDialogTitle,description:a.confirmDialogDescription,confirmLabel:a.confirmingAction?d("common.actions.loading"):d("common.delete"),cancelLabel:d("common.actions.cancel"),loading:a.confirmingAction,onConfirm:a.handleConfirmDialog,children:a.confirmDialogName?e.jsx("div",{className:"rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2 font-mono text-xs text-foreground",children:a.confirmDialogName}):null})]})}export{er as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const o="0.8.9",s={version:o};export{s as p};
|