@chenpu17/cc-gw 0.8.0-beta.2 → 0.8.0
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/README.md +32 -2
- package/package.json +6 -5
- package/src/web/dist/assets/About-DockN9He.js +1 -0
- package/src/web/dist/assets/{ApiKeys-DXJYgiYr.js → ApiKeys-Fx_SaOSe.js} +1 -1
- package/src/web/dist/assets/{Dashboard-_T1jT56-.js → Dashboard-De61szKh.js} +1 -1
- package/src/web/dist/assets/{DialogShell-s3yKnQyp.js → DialogShell-BKB8x8Yv.js} +1 -1
- package/src/web/dist/assets/{Events-B7l9cIhA.js → Events-CmUNBQ-L.js} +1 -1
- package/src/web/dist/assets/{Help-M_B7c7Hj.js → Help-Bo6GcOG7.js} +1 -1
- package/src/web/dist/assets/{Login-CXG8h1Xd.js → Login-uKKAO1uN.js} +1 -1
- package/src/web/dist/assets/{Logs-DVPaFD7W.js → Logs-ChD1V5Mf.js} +1 -1
- package/src/web/dist/assets/{ModelManagement-m4p97Xel.js → ModelManagement-DTlt9WMp.js} +1 -1
- package/src/web/dist/assets/{PageHeader-KQ9mjVAV.js → PageHeader-DWkUnwoU.js} +1 -1
- package/src/web/dist/assets/{PageSection-C9Wb9Oe3.js → PageSection-9-z2ysug.js} +1 -1
- package/src/web/dist/assets/{PageState-D-1-sNyq.js → PageState-5sxEzXut.js} +1 -1
- package/src/web/dist/assets/{Profiler-Bb-I7NR2.js → Profiler-DBeKtgDs.js} +1 -1
- package/src/web/dist/assets/{Settings-CdZ_GGjR.js → Settings-YMHmPlBz.js} +1 -1
- package/src/web/dist/assets/{Skeleton-H3SErRWs.js → Skeleton-CvBK2w-C.js} +1 -1
- package/src/web/dist/assets/{badge-3ORqzzzc.js → badge-tREH_88e.js} +1 -1
- package/src/web/dist/assets/{card-D1l7si2X.js → card-yK3LQB_K.js} +1 -1
- package/src/web/dist/assets/{gateway-CFNtAOS2.js → gateway-D-NOc-e6.js} +1 -1
- package/src/web/dist/assets/{index-MqPrlTQ4.js → index-BiTh8byX.js} +2 -2
- package/src/web/dist/assets/{input-Bb_t6wr6.js → input-CXrASgDm.js} +1 -1
- package/src/web/dist/assets/{label-8HO4VSYV.js → label-CzHv4dNP.js} +1 -1
- package/src/web/dist/assets/{popover-5I-o07-i.js → popover-C-WmNbKp.js} +1 -1
- package/src/web/dist/assets/{select-kdaAyzec.js → select-DH6I1mKJ.js} +1 -1
- package/src/web/dist/assets/{switch-DLCOPP-U.js → switch-IXq8M3lq.js} +1 -1
- package/src/web/dist/assets/{useApiQuery-Bcqr7uHV.js → useApiQuery-CCy5_Mc8.js} +1 -1
- package/src/web/dist/assets/{useAppMutation-CqHoYeK1.js → useAppMutation-COEUmNH4.js} +1 -1
- package/src/web/dist/index.html +1 -1
- package/src/web/dist/assets/About-bnb_BU6z.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-De61szKh.js","assets/vendor-CjJPKsTb.js","assets/PageHeader-DWkUnwoU.js","assets/badge-tREH_88e.js","assets/PageState-5sxEzXut.js","assets/select-DH6I1mKJ.js","assets/radix-54BMi3RD.js","assets/EChart-Dqa_Xbrn.js","assets/charts-react-BeVWPrMt.js","assets/charts-core-vuhzGmuT.js","assets/charts-engine-BJQRnjQ_.js","assets/PageSection-9-z2ysug.js","assets/card-yK3LQB_K.js","assets/Skeleton-CvBK2w-C.js","assets/i18n-CfLThlXq.js","assets/useApiQuery-CCy5_Mc8.js","assets/query-D3IfCUhp.js","assets/queryKeys-BMvyDTQS.js","assets/router-CmaL1NgV.js","assets/Logs-ChD1V5Mf.js","assets/input-CXrASgDm.js","assets/label-CzHv4dNP.js","assets/DialogShell-BKB8x8Yv.js","assets/clipboard-CALi6bTW.js","assets/utils-DQfq7gRo.js","assets/popover-C-WmNbKp.js","assets/gateway-D-NOc-e6.js","assets/Events-CmUNBQ-L.js","assets/ModelManagement-DTlt9WMp.js","assets/useAppMutation-COEUmNH4.js","assets/switch-IXq8M3lq.js","assets/ApiKeys-Fx_SaOSe.js","assets/Settings-YMHmPlBz.js","assets/About-DockN9He.js","assets/Help-Bo6GcOG7.js","assets/Login-uKKAO1uN.js","assets/Profiler-DBeKtgDs.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{J as ue,r,j as t,K,L as pe,N as me,O as he,P as ge,S as fe,T as ye,U as ve,V as be,W as Pe,X as Te,Y as Ce,Z as we,$ as xe,a0 as ke,a1 as U,a2 as Ae,a3 as Ie,a4 as z,a5 as B,a6 as Ee,a7 as Re,a8 as Se,a9 as De,aa as Le,q as qe}from"./vendor-CjJPKsTb.js";import{Q as He}from"./query-D3IfCUhp.js";import{i as C,a as Ne,I as je,u as b}from"./i18n-CfLThlXq.js";import{u as S,O as Me,N as H,a as W,B as Fe,R as Oe,b as T}from"./router-CmaL1NgV.js";import{S as _e,a as V,b as G,P as Ke,C as $,I as Q,c as Y,d as J,R as X,L as Z,e as ee,f as Ue,T as ze,g as Be,h as We,i as Ve,j as Ge,k as te}from"./radix-54BMi3RD.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function a(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=a(n);fetch(n.href,i)}})();const A={themeMode:"cc-gw-theme",language:"cc-gw-language",dashboard:{endpointFilter:"cc-gw.dashboard.endpoint-filter"},logs:{visibleColumns:"cc-gw.logs.visible-columns",density:"cc-gw.logs.density",pageSize:"cc-gw.logs.page-size",filtersExpanded:"cc-gw.logs.filters-expanded",providerFilter:"cc-gw.logs.provider-filter",endpointFilter:"cc-gw.logs.endpoint-filter",modelFilter:"cc-gw.logs.model-filter",statusFilter:"cc-gw.logs.status-filter",fromDate:"cc-gw.logs.from-date",toDate:"cc-gw.logs.to-date",selectedApiKeys:"cc-gw.logs.selected-api-keys"},apiKeys:{rangeDays:"cc-gw.api-keys.range-days",search:"cc-gw.api-keys.search",statusFilter:"cc-gw.api-keys.status-filter"}},$e={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容",consoleSubtitle:"网关控制平面",environmentLabel:"运行状态",online:"服务在线"},nav:{dashboard:"仪表盘",logs:"请求日志",events:"事件",models:"模型与路由管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于",profiler:"性能分析",group:{overview:"概览",admin:"管理"}},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",yes:"是",edit:"编辑",delete:"删除",create:"创建",save:"保存",saving:"保存中...",cancel:"取消",actions:{loading:"处理中...",refresh:"刷新",refreshing:"刷新中...",manualRefresh:"手动刷新",reset:"重置",close:"关闭",openNavigation:"打开导航",closeNavigation:"关闭导航",save:"保存设置",saving:"保存中...",cancel:"取消",copy:"复制",testConnection:"测试连接",testingConnection:"测试中...",cleanup:"清理历史日志",cleaning:"清理中...",checkUpdates:"检查更新",logout:"退出登录"},theme:{label:"主题",light:"亮色",dark:"暗色",system:"跟随系统"},status:{success:"成功",error:"失败",enabled:"已启用",disabled:"已禁用"},notifications:{featureInProgress:"功能开发中,敬请期待。"},units:{request:"次",ms:"ms",token:"Tokens",msPerToken:"ms/Token"},noMatches:"无匹配项",unknownError:"未知错误",filters:{activeCount:"{{count}} 个筛选条件",collapse:"收起筛选",expand:"展开筛选",allRequests:"全部请求"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",labels:{providers:"Provider 数量",activeClientAddresses:"活跃来源地址",activeClientSessions:"活跃会话",uniqueClientAddressesLastHour:"1小时活跃客户端 IP",uniqueClientSessionsLastHour:"1小时会话",todayRequests:"今日请求",activeRequests:"活跃转发连接",cpu:"CPU 占用率",database:"数据库",memory:"内存占用"},filters:{endpoint:"端点筛选",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{listeningLabel:"监听地址",listening:"监听:{{host}}:{{port}}",providers:"Provider 数量:{{value}}",todayRequests:"今日请求:{{value}}",active:"活动请求:{{value}}",dbSize:"数据库:{{value}}",memory:"内存占用:{{value}}"},actions:{compact:"释放数据库空间",compacting:"整理中..."},toast:{overviewError:"统计数据获取失败",dailyError:"趋势数据获取失败",modelError:"模型统计获取失败",statusError:"状态信息获取失败",dbError:"数据库信息获取失败",recentError:"最近请求获取失败",compactSuccess:{title:"数据库整理完成",desc:"空闲页已整理,建议稍后刷新确认容量。"},compactError:{title:"数据库整理失败",desc:"错误信息:{{message}}"}},cards:{todayRequests:"今日请求数",todayInput:"今日输入 Tokens",todayCacheRead:"今日缓存读取",todayCacheCreation:"今日缓存写入",todayOutput:"今日输出 Tokens",todayCached:"今日缓存 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",lineCached:"缓存 Tokens",lineCacheRead:"缓存读取",lineCacheCreation:"缓存写入",axisTokens:"Tokens",ttftLabel:"TTFT(ms)",tpotLabel:"TPOT(ms/Token)",ttftTitle:"TTFT 模型对比",ttftDesc:"比较不同模型的首 Token 耗时 (TTFT)",ttftEmpty:"暂无 TTFT 数据。",tpotTitle:"TPOT 模型对比",tpotDesc:"比较不同模型的平均 Token 耗时 (TPOT)",tpotEmpty:"暂无 TPOT 数据。",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/Token)",empty:"暂无数据"},insights:{totalRequests:"趋势期总请求",totalRequestsHint:"最近 14 天累计请求量",busiestDay:"最忙的一天",busiestDayHint:"{{value}} 次请求",topModel:"最高频模型",topModelHint:"{{value}} 次调用",fastestTtft:"最快 TTFT 模型"},recent:{title:"最新请求",subtitle:"仅展示最近 {{count}} 条记录",loading:"加载中...",empty:"暂无请求记录",routePlaceholder:"未指定",columns:{time:"时间",endpoint:"端点",provider:"Provider",route:"路由",latency:"耗时(ms)",status:"状态"}},modelTable:{title:"模型性能摘要",description:"统计每个后端模型的请求数、平均耗时、TTFT 与 TPOT。",empty:"暂无模型统计数据。",columns:{model:"Provider/模型",requests:"请求数",latency:"平均耗时",ttft:"TTFT",tpot:"TPOT"}}},logs:{title:"请求日志",description:"查看近期请求,支持筛选 Provider、模型、成功状态及时间范围。",filtersTitle:"筛选条件",filtersDescription:"组合多种条件精准定位请求记录。",summary:{total:"记录总数:{{value}}"},filters:{provider:"Provider",providerAll:"全部 Provider",endpoint:"请求端点",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai",apiKey:"API Key",apiKeyHint:"可多选,不选择时将展示全部密钥。",modelId:"模型 ID",modelPlaceholder:"如 deepseek-chat",status:"状态",statusAll:"全部",statusSuccess:"成功",statusError:"失败",startDate:"起始日期",endDate:"结束日期",apiKeyAll:"全部密钥",apiKeySelected:"{{count}} 个已选"},actions:{columns:"列设置",visibleCount:"已显示 {{count}} 列",manualRefresh:"手动刷新",refreshing:"刷新中...",export:"导出 ZIP 日志",exporting:"导出中...",detail:"详情"},quickViews:{all:"全部流量",errors:"仅看失败",today:"今天",anthropic:"Anthropic",openai:"OpenAI"},table:{loading:"正在加载日志...",empty:"未找到符合条件的日志记录。",density:{comfortable:"标准",compact:"紧凑"},requestedModelFallback:"未指定",apiKeyUnknown:"未知密钥",columns:{time:"时间",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",routedModel:"路由模型",apiKey:"API Key",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",stream:"Stream",latency:"耗时(ms)",ttft:"TTFT(ms)",tpot:"TPOT(ms/Token)",status:"状态",error:"错误信息",actions:"操作"},pagination:{perPage:"每页",unit:"条",previous:"上一页",next:"下一页",pageLabel:"第 {{page}} / {{total}} 页"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",toast:{listError:{title:"日志获取失败",desc:"错误信息:{{message}}"},providerError:{title:"Provider 列表获取失败",desc:"错误信息:{{message}}"},exportSuccess:{title:"导出完成",desc:"ZIP 压缩包已开始下载,包内包含 `logs.json`。"},exportError:{title:"导出失败",desc:"错误信息:{{message}}"}},stream:{streaming:"流式",single:"单次"},detail:{title:"日志详情",id:"ID #{{id}}",infoSection:"基本信息",info:{time:"时间",sessionId:"Session ID",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",noRequestedModel:"未指定",model:"路由模型",stream:"Stream",latency:"耗时",status:"状态",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",ttft:"TTFT (首 Token 耗时)",tpot:"TPOT (平均 ms/Token)",error:"错误信息"},summary:{route:"{{from}} → {{to}}",latency:"耗时:{{value}}",ttft:"TTFT:{{value}}",tpot:"TPOT:{{value}}",stream:"Stream:{{value}}"},payload:{title:"Payloads",helperWithUpstream:"客户端与上游链路内容已分开展示。",helperClientOnly:"当前请求未发生额外链路改写,仅展示客户端侧内容。",clientRequest:"客户端请求体",upstreamRequest:"上游请求体",upstreamResponse:"上游响应体",clientResponse:"客户端响应体",emptyRequest:"暂无请求内容",emptyResponse:"暂无响应内容"},apiKey:{title:"密钥信息",name:"密钥名称",identifier:"密钥 ID",masked:"掩码展示",maskedUnavailable:"暂无掩码信息",raw:"原始密钥",rawUnavailable:"未记录原始密钥",rawMasked:"原始密钥(已脱敏)",rawMaskedHint:"出于安全考虑,仅展示部分前后缀。如需完整值,请在上游服务中重新生成。",missing:"未记录",lastUsed:"最后使用"},copy:{requestSuccess:"请求体已复制到剪贴板。",responseSuccess:"响应体已复制到剪贴板。",keySuccess:"API 密钥已复制到剪贴板。",empty:"{{label}}为空,无法复制。",failure:"复制失败",failureFallback:"无法复制内容,请稍后再试。"},loadError:"无法加载日志详情。"}},providers:{title:"模型提供商",description:"管理集成的模型服务,查看默认模型及支持能力。",emptyState:"暂无 Provider,请点击“新增提供商”以开始配置。",emptyFiltered:"当前筛选条件下没有匹配的 Provider。",count:"已配置:{{count}} 个 Provider",filters:{searchPlaceholder:"按名称、ID 或 Base URL 搜索",typeAll:"全部类型"},toast:{createSuccess:"已添加 Provider:{{name}}",updateSuccess:"已更新 Provider:{{name}}",testSuccess:"Provider 连通性检查通过。",testSuccessDesc:"状态:{{status}} · 耗时:{{duration}}",testFailure:"Provider 连通性检查失败:{{message}}",loadFailure:"获取配置失败:{{message}}",deleteSuccess:"已删除 Provider:{{name}}",deleteFailure:"删除 Provider 失败:{{message}}"},actions:{add:"新增提供商",refresh:"刷新",refreshing:"刷新中...",edit:"编辑",delete:"删除",test:"测试连接"},quickAddHuawei:{button:"一键添加华为云模型",title:"一键添加华为云模型",description:"输入 API Key 即可快速添加华为云 DeepSeek V3.1、KIMI-K2 与 Qwen3-235B-A22B 模型。",apiKeyLabel:"API Key",apiKeyPlaceholder:"请输入华为云 API Key",note:"完成后可在提供商列表中查看并进一步调整配置。",submit:"添加",providerLabel:"华为云",validation:{apiKey:"请填写 API Key"},toast:{success:"已添加华为云模型",added:"已添加 {{name}}",failure:"添加失败,请稍后重试"}},testDialog:{title:"连接测试选项",subtitle:"针对 {{name}} 的测试请求",description:"部分 Claude 兼容服务需要额外 Header 才能通过诊断。请选择需要附加的 Header,不勾选则保持最简请求。",headerValue:"Header 值:{{value}}",presetLabel:"模拟 Claude Code 请求(推荐)",presetDescription:"附加 Claude CLI 常用的 Header(anthropic-beta、x-app、user-agent 等)以提升兼容性。",presetPreviewSummary:"查看将附加的 Header 列表",preservedInfo:"以下 Header 将自动附加(来自当前配置):",cancel:"取消",primary:"开始测试",options:{beta:{label:"`anthropic-beta` 头",description:"启用 Claude Code 的实验特性(如工具流式);fox code_cc 等服务通常要求此头。"},browser:{label:"`anthropic-dangerous-direct-browser-access` 头",description:"标记请求来自受信客户端,Claude Code 默认会携带此头。"},xApp:{label:"`x-app` 头",description:"标识请求来源,Claude CLI 默认发送为 cli。"},userAgent:{label:"`user-agent` 头",description:"模拟 Claude CLI 的 User-Agent 值。"},accept:{label:"`accept` 头",description:"声明客户端接受 JSON 响应格式。"},acceptLanguage:{label:"`accept-language` 头",description:"兼容要求语言信息的服务。"},secFetchMode:{label:"`sec-fetch-mode` 头",description:"与浏览器/CLI 保持一致的访问信息。"},acceptEncoding:{label:"`accept-encoding` 头",description:"允许 gzip/deflate 压缩响应内容。"},stainlessHelper:{label:"`x-stainless-helper-method` 头",description:"表明请求使用 Claude CLI 的 stream helper。"},stainlessRetry:{label:"`x-stainless-retry-count` 头",description:"Claude CLI 当前的重试计数。"},stainlessTimeout:{label:"`x-stainless-timeout` 头",description:"Claude CLI 设定的超时时间(秒)。"},stainlessLang:{label:"`x-stainless-lang` 头",description:"Claude CLI 所使用的语言标识。"},stainlessPackage:{label:"`x-stainless-package-version` 头",description:"Claude CLI 的包版本号。"},stainlessOs:{label:"`x-stainless-os` 头",description:"调用方所在的操作系统。"},stainlessArch:{label:"`x-stainless-arch` 头",description:"调用方 CPU 架构信息。"},stainlessRuntime:{label:"`x-stainless-runtime` 头",description:"运行时环境标识,例如 node。"},stainlessRuntimeVersion:{label:"`x-stainless-runtime-version` 头",description:"运行时环境的版本号。"}}},card:{defaultModelLabel:"默认模型",defaultModel:"默认模型:{{model}}",noDefault:"未设置默认模型",modelsTitle:"支持模型",noModels:"尚未配置模型。",authMode:"认证方式",modelCount:"{{count}} 个模型",passthrough:"透传模式"},drawer:{createTitle:"新增 Provider",editTitle:"编辑 Provider",quickStart:"快速配置",description:"配置基础信息与模型列表。",formSummary:"当前草稿",modelsDescription:"维护支持的模型列表。",defaultHint:"当前默认模型:{{model}}",summary:{type:"Provider 类型",auth:"认证方式",models:"模型数量",untitled:"未命名 Provider"},sections:{type:"1. 选择 Provider 类型",basic:"2. 填写基础信息",auth:"3. 设置认证",checklist:"提交前检查"},hints:{type:"先选择 Provider 模板,可自动填入推荐 Base URL。",basic:"ID 用于路由映射;显示名称用于界面展示。",auth:"根据上游接口要求选择 Header 认证方式。",customProvider:"自定义兼容服务",checkUrl:"确认 Base URL 指向上游 API 根路径。",checkAuth:"确认密钥与认证 Header 类型匹配。",checkModels:"如需路由提示和默认模型,请补充模型列表。",advancedTitle:"高级模式说明",advancedBody:"开启后可单独维护显示名称与模型别名;如果只是快速接入,保留默认同步即可。"},fields:{id:"Provider ID",idPlaceholder:"如 openai",label:"显示名称",labelPlaceholder:"如 官方主账号",baseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",type:"Provider 类型",apiKey:"API Key(可选)",apiKeyPlaceholder:"可留空以从环境变量读取",authMode:"认证方式",authModeHint:"选择 API 认证方式,填写对应的密钥值。",authModeApiKey:"默认方式(Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"模型配置",showAdvanced:"显示高级选项",hideAdvanced:"隐藏高级选项",addModel:"新增模型",modelId:"模型 ID",modelIdPlaceholder:"如 claude-sonnet-4-5-20250929",modelLabel:"显示名称(可选)",modelLabelPlaceholder:"如 GPT-4 旗舰",setDefault:"设为默认模型",removeModel:"删除模型"},errors:{idRequired:"请填写 Provider ID",idDuplicate:"该 Provider ID 已存在",baseUrlInvalid:"Base URL 格式无效",modelsRequired:"请至少配置一个模型",modelInvalid:"模型 ID 不可为空或重复",defaultInvalid:"默认模型必须在模型列表中"},toast:{saveFailure:"保存失败:{{message}}"},noModelsTitle:"透传模式已启用",noModelsHint:'当前未配置模型列表。该 Provider 将以"透传"模式使用,可在模型路由中映射,或在请求中直接指定模型。',routeExample:"路由映射示例:"},confirm:{delete:"确认删除 Provider「{{name}}」?"}},modelManagement:{title:"模型与路由管理",description:"统一维护模型提供商配置、模型路由映射与自定义端点。",header:{providersHelper:"先维护 Provider 供应池,再为内置端点和自定义端点配置路由规则。",routingHelper:"当前工作区正在编辑「{{name}}」的路由规则,保持单工作区上下文以减少切换混淆。"},overview:{synced:"工作区已同步",unsavedCount:"未保存 {{count}}",providersStat:"Providers",providersStatHint:"已接入的上游供应池",routeWorkspacesStat:"路由工作区",routeWorkspacesStatHint:"内置端点 + 自定义端点",customEndpointsStat:"自定义端点",customEndpointsStatHint:"额外暴露的接入入口",activeWorkspace:"当前工作区",activeWorkspaceProvider:"Provider 清单",activeWorkspaceRouting:"路由编辑区",providerAndSystem:"资源与内置路由",providerPoolTag:"Provider 池",systemEndpointTag:"内置端点",customEndpoints:"自定义端点",customEndpointsHint:"自定义端点保留紧凑横向卡片,便于快速切换、编辑和删除。",headerWithCustom:"优先在此处切换和维护自定义端点,避免主工作区被多列布局挤压。",headerWithoutCustom:"先配置提供商与内置路由,需要时再补充自定义端点。",endpointEnabled:"已启用",endpointDisabled:"已停用",endpointProtocols:"{{count}} 条协议路径",endpointNoProtocol:"尚未配置协议路径",endpointMorePaths:"另有 {{count}} 条路径",endpointManagedExternally:"该端点不可删除,仅可调整配置。",routesEditorHint:"源模型 -> 目标 provider:model",suggestionHint:"一键补充该端点常见的源模型写法,减少手工录入。",resourceCardTitle:"Provider 供应池",resourceCardDescription:"Provider 只表示上游模型资源与鉴权配置,不直接决定外部请求入口。",entryCardTitle:"Endpoint 入口层",entryCardDescription:"Anthropic、OpenAI 与自定义端点才是网关对外暴露的入口;路由与模板都按 endpoint 作用域管理。"},providersSemantics:{title:"先维护 Provider 资源池,再维护 Endpoint 路由",description:"这里配置的是上游供应商、认证方式和模型清单;真正对客户端暴露的仍是内置端点与自定义端点。"},tabs:{providers:"模型提供商",providersDesc:"配置上游模型提供商以及认证信息。",anthropic:"Anthropic 路由",anthropicDesc:"管理 /anthropic 端点的模型映射和默认配置。",openai:"OpenAI 路由",openaiDesc:"管理 /openai 端点的模型映射和默认配置。",customEndpoint:"自定义端点"},addEndpoint:"添加端点",createEndpoint:"创建端点",editEndpoint:"编辑端点",deleteEndpointConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',deleteEndpointSuccess:"端点删除成功",deleteEndpointError:"删除失败:{{error}}",createEndpointSuccess:"端点创建成功",createEndpointError:"创建失败:{{error}}",updateEndpointSuccess:"端点更新成功",updateEndpointError:"更新失败:{{error}}",endpointValidationError:"请填写所有必填字段",pathValidationError:"请填写所有路径信息",atLeastOnePath:"至少需要一个路径",endpointId:"端点 ID",endpointIdPlaceholder:"如 custom-api",endpointIdHint:"ID 创建后不可修改,用于内部标识。",endpointLabel:"显示名称",endpointLabelPlaceholder:"如 我的自定义 API",endpointPath:"访问路径",endpointPaths:"访问路径",endpointPathPlaceholder:"如 /custom/api",endpointPathHint:"路径需以 / 开头,修改后立即生效。",endpointProtocol:"协议类型",endpointEnabled:"启用此端点",endpointRoutingHint:"创建后,您可以在此端点的路由配置 Tab 中设置模型路由规则。",addPath:"添加路径",removePath:"删除路径",protocolAnthropic:"Anthropic 协议",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-auto":"OpenAI 协议(支持 Chat Completions 和 Responses API)。请确保路径以 /v1/chat/completions 或 /v1/responses 结尾。","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},actions:{saveRoutes:"保存路由",unsaved:"有未保存修改",footerTitle:"路由操作",footerDirtyHint:"已修改当前路由规则,请在此处完成保存。",footerSavedHint:"当前路由已与服务器保持同步。"},routesEditorTitle:"路由规则",emptyRoutesHint:"点击下方按钮添加路由规则。",routing:{selectTarget:"请选择目标 Provider:模型"},claudeValidation:{title:"Claude Code 请求校验防护(实验特性)",description:"开启后,仅允许符合 Claude Code 协议的 /anthropic 请求;不合规请求会直接返回 430。",toggleLabel:"启用校验",statusEnabled:"已启用 Claude Code 校验",statusDisabled:"当前未启用(默认)"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:'已保存模板 "{{name}}"。',presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:'已应用模板 "{{name}}"。',presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:'模板 "{{name}}" 已删除。',presetDeleteFailure:"删除模板失败:{{message}}",claudeValidationEnabled:"Claude Code 请求校验防护(实验特性)已启用。",claudeValidationDisabled:"Claude Code 请求校验防护(实验特性)已关闭。",claudeValidationFailure:"更新 Claude 校验防护状态失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中...",rulesCount:"{{count}} 条规则",noRules:"空模板",previewTooltip:"悬停查看路由规则",diffTitle:"应用模板确认",diffDescription:'以下路由将被替换为模板 "{{name}}" 的配置:',diffAdded:"新增",diffRemoved:"移除",diffChanged:"变更",diffConfirm:"确认应用",diffEmpty:"模板与当前配置相同,无需变更。"},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:'确定要删除模板 "{{name}}" 吗?'}},events:{title:"安全事件",description:"查看校验防护与系统检测记录,及时发现异常访问。",filters:{title:"筛选条件",allLevels:"全部严重级别",typePlaceholder:"按事件类型过滤(可留空)"},actions:{newest:"最新",older:"更早"},levels:{info:"提示",warn:"警告",error:"错误"},empty:{title:"暂无事件记录",subtitle:"当前没有可用的安全事件。"},details:"查看详情",defaultTitle:"未命名事件",defaultMessage:"未提供详细描述。",toast:{loadFailure:"加载事件失败:{{message}}"}},settings:{title:"设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",protocolRestartRequired:"配置已保存!请执行 cc-gw restart --daemon 重启服务使协议配置生效",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全",protocol:"协议配置",jump:"跳转到"},overview:{title:"当前运行概览",description:"先确认当前监听方式、访问保护和配置文件位置,再进入具体调优。",unsavedCount:"待保存 {{count}} 项",cards:{protocols:"协议入口",security:"控制台访问",configFile:"配置文件"},values:{authEnabled:"已启用登录保护",authDisabled:"未启用登录保护",httpOnly:"仅 HTTP",httpsOnly:"仅 HTTPS",httpAndHttps:"HTTP + HTTPS"}},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 127.0.0.1",retention:"日志保留天数",logExportTimeout:"日志导出超时 (秒)",logExportTimeoutHint:"默认 60 秒;导出量较大时可调高,范围 5-600 秒。",bodyLimit:"请求体大小上限 (MB)",bodyLimitHint:"默认 10 MB;如 Claude Code 的 /compact 遇到 413,可适当调大。",defaults:"默认模型配置",storeRequestPayloads:"保存请求内容",storeRequestPayloadsHint:"开启后会在日志数据库中保留客户端请求;如发生协议转换,也会额外保存发往上游的请求体。",storeResponsePayloads:"保存响应内容",storeResponsePayloadsHint:"开启后会保留客户端响应;如发生协议转换,也会保存上游原始响应。流式响应会整理为完整消息而不是 chunk 片段。",logLevel:"日志级别",logLevelOption:{fatal:"致命 (fatal)",error:"错误 (error)",warn:"警告 (warn)",info:"信息 (info)",debug:"调试 (debug)",trace:"跟踪 (trace)"},enableRoutingFallback:"启用模型回退策略",enableRoutingFallbackHint:"无匹配模型时自动落到首个可用模型。默认关闭,建议仅在明确需要时开启。"},auth:{description:"开启 Web UI 登录后,所有管理接口仅对已登录用户开放,模型代理端点仍保持兼容。",enable:"启用 Web UI 登录保护",enableHint:"推荐在多人共用或生产环境中开启,访问 /ui 与 /api/* 将需要先登录。",username:"登录用户名",usernamePlaceholder:"设置用于登录的用户名",password:"登录密码",passwordPlaceholder:"至少 6 位字符",confirmPassword:"确认密码",confirmPasswordPlaceholder:"再次输入登录密码",status:"当前状态",statusEnabled:"已启用登录保护",statusDisabled:"未启用登录保护",passwordHintRequired:"首次启用或修改用户名时必须设置新密码(不少于 6 位)。",passwordHintOptional:"如需更新密码可填写新值,留空则沿用旧密码。",actions:{save:"保存安全设置"},toast:{success:"安全设置已更新。",failure:"保存失败:{{message}}"},validation:{username:"请填写用户名",minLength:"密码至少需要 6 位字符",passwordRequired:"请设置登录密码",confirmMismatch:"两次输入的密码不一致"}},protocol:{description:"配置 HTTP 和 HTTPS 服务端口,默认同时启用两个协议",restartWarning:"⚠️ 修改协议配置后需要重启服务才能生效",restartHint:"保存配置后,请执行以下命令重启服务:",restartTip:"💡 提示:端口、协议启用状态、证书路径需要重启;Provider 和路由配置支持热加载无需重启",http:{enable:"启用 HTTP",hint:"标准 HTTP 协议,适用于本地开发和内网环境",port:"HTTP 端口",host:"HTTP 主机地址"},https:{enable:"启用 HTTPS",hint:"HTTPS 加密协议",port:"HTTPS 端口",host:"HTTPS 主机地址",keyPath:"证书私钥路径",certPath:"证书文件路径",caPath:"CA 证书路径 (可选)",warning:"⚠️ 关于 HTTPS 证书",invalidCert:"自签名证书无效:",invalidCertDetail:"Claude Code 和大多数 AI 工具无法信任自签名证书,会导致连接失败。",recommended:"推荐方案:",recommendedDetail:"本地开发环境建议使用 HTTP 协议(127.0.0.1 本地访问非常安全)。",tip:"💡 如需 HTTPS,请使用受信任 CA(如 Let's Encrypt)签发的正式证书,或配置反向代理(如 Nginx/Caddy)处理 HTTPS。"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",logExportTimeout:"日志导出超时需在 5-600 秒之间",bodyLimit:"请求体大小需在 1-2048 MB 之间",protocolRequired:"至少需要启用 HTTP 或 HTTPS 协议",httpPort:"HTTP 端口必须在 1-65535 之间",httpsPort:"HTTPS 端口必须在 1-65535 之间",httpsCertificate:"HTTPS 已启用但缺少证书路径,请手动配置受信任的证书",routePair:"请填写完整的来源模型与目标模型配置。",routeDuplicate:"模型 {{model}} 已存在映射,请勿重复配置。"},defaults:{completion:"对话:{{model}}",reasoning:"推理:{{model}}",background:"后台:{{model}}",none:"未设置默认模型"},routing:{title:"模型路由映射",description:"为 Claude Code 发起的模型请求指定实际 Provider 与模型 ID(如将 claude 系列映射至 Kimi)。如需禁用映射,可留空或移除。",titleByEndpoint:"{{endpoint}} 路由配置",descriptionByEndpoint:{anthropic:"当 Claude Code 通过 /anthropic 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。",openai:"当 Codex 通过 /openai 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。"},wildcardHint:"来源模型支持使用 * 通配符(如 claude-*),匹配度更高的规则优先;若目标写成 providerId:*,会将请求里的模型名原样转发给对应 Provider。",add:"新增映射",empty:"尚未配置映射,系统将使用默认模型策略。",source:"来源模型",target:"目标 Provider:模型",sourceLabel:"来源模型",sourcePlaceholder:"如 claude-sonnet-4-5-20250929",targetLabel:"目标 Provider:模型",targetPlaceholder:"如 kimi:kimi-k2-0905-preview",customTargetOption:"自定义目标…",providerPassthroughOption:"{{provider}} · 透传原始模型 (*)",remove:"移除",suggested:"常用 Anthropic 模型"},file:{description:"当前配置存储在本地文件,可通过编辑该文件进行离线修改。",unknown:"未知路径"},cleanup:{description:"立即清理早于当前保留天数的日志记录。",softLabel:"轻度操作",softTitle:"清理过期日志",softDescription:"仅删除超过保留天数的历史日志,适合日常维护。",confirmTitle:"清理历史日志",confirmDescription:"该操作会删除超过保留天数的历史日志,但不会影响当前较新的记录。",hardLabel:"高风险操作",hardTitle:"彻底清空日志",clearAllTitle:"彻底清空日志",clearAll:"彻底清空",clearingAll:"清空中...",confirmCleanup:"该操作会删除超过保留天数的历史日志,但不会影响当前较新的记录。",confirmClearAll:"此操作会删除全部请求日志和日统计数据,且无法恢复。",clearAllWarning:"该操作会删除所有日志记录及日统计数据,请谨慎操作。"}},help:{title:"使用指南",intro:"完整的 cc-gw 配置和使用指南,帮助您从零开始搭建 AI 模型网关。",note:"所有配置变更都会实时生效。建议通过 Web UI 进行配置管理,CLI 主要用于服务启动和重启。",helper:"推荐顺序:先启动服务,再配置 Provider,然后创建 API 密钥,最后接入 Claude Code 或 Codex。",clientConfig:{title:"客户端配置指南",subtitle:"选择您的客户端工具,按照步骤进行配置"},advancedGuide:{title:"高级使用指南",subtitle:"日常使用技巧与最佳实践"},sections:{configuration:{title:"🚀 基础配置流程",items:["📦 **安装并启动服务**:运行 `npm install -g @chenpu17/cc-gw && cc-gw start --daemon --port 4100`,然后访问 http://127.0.0.1:4100/ui",'🔧 **配置模型提供商**:在"模型管理 → 模型提供商"中添加至少一个 Provider,配置 Base URL、API Key 和默认模型','🔑 **生成网关 API Key(可选)**:在"API 密钥"页面创建 API 密钥,为不同客户端创建独立密钥。默认情况下,所有请求都可以通过网关访问。']},claudeCodeConfig:{title:"⚡ Claude Code 配置",items:["🎯 **配置环境变量**:\n```bash\nexport ANTHROPIC_BASE_URL=http://127.0.0.1:4100/anthropic\nexport ANTHROPIC_API_KEY=sk-ant-oat01-8HEmUDacamV1...\n```\n写入 ~/.bashrc 或 ~/.zshrc 后执行 `source ~/.bashrc` 或 `source ~/.zshrc` 让变量生效。",'🔧 **插件设置配置**:\n- 在 Claude Code 插件设置中选择"自定义 API"\n- 填入 Base URL:`http://127.0.0.1:4100/anthropic`\n- 填入 API Key:使用你的实际 API Key(如 `sk-ant-oat01-8HEmUDacamV1...`)','✅ **快速验证**:\n```bash\nclaude "你好,请简短回应"\n```\n输出正常即代表配置成功,可在"请求日志"页看到对应记录。']},codexConfig:{title:"🛠️ Codex CLI 配置",items:[`📝 **编辑配置文件**:
|
|
3
3
|
在 \`~/.codex/config.toml\` 进行配置:
|
|
4
4
|
\`\`\`toml
|
|
@@ -58,4 +58,4 @@ env_key = "cc_gw_key"
|
|
|
58
58
|
"protocol": "anthropic"
|
|
59
59
|
}
|
|
60
60
|
\`\`\`
|
|
61
|
-
After configuration, clients access via \`http://127.0.0.1:4100/claude/v1/messages\` (path auto-expansion).`,'Enable "Store request bodies" / "Store response bodies" to inspect and copy client-side and upstream payloads from the log drawer when troubleshooting.',"If you do not need payload-level troubleshooting, turn off payload storage to reduce local disk usage and privacy exposure.","Use **routing presets** to save common routing configurations and quickly switch between different provider setups.","If you edit ~/.cc-gw/config.json manually, refresh the Settings page or restart cc-gw so the UI reflects the latest configuration."]}},faq:{title:"Frequently asked questions",items:[{q:"How can I change the default model for each endpoint?",a:'Go to "Model Management → Routing" and choose defaults for /anthropic and /openai. Saving applies the change right away.'},{q:"How do I use custom endpoints?",a:'Create a custom endpoint in the "Model Management" page by configuring a base path (e.g., `/my-endpoint`) and protocol type. The system automatically registers full API paths based on the protocol. For example, after configuring `/claude` + `anthropic` protocol, clients access via `http://127.0.0.1:4100/claude/v1/messages`.\n\nIf you encounter 404 errors, check:\n1) Is the endpoint enabled?\n2) Are clients using the complete path (including protocol subpath)?\n3) Check server logs to confirm route registration'},{q:"Why are cached token numbers missing?",a:"Upstream providers must return cached_tokens or input_tokens_details.cached_tokens. Enable cache metrics on the provider if supported."},{q:"How can I use different models for different clients?",a:'Create separate API keys for each client and configure different routing rules in "Model Management → Routing". You can also create dedicated custom endpoints for different clients.'}]}},apiKeys:{title:"API Keys Management",description:"Create and manage API keys for gateway access",helper:"Use separate keys for each client, environment, or automation task so you can audit, restrict, and revoke access cleanly.",createNew:"Create New Key",createAction:"Create",createDescription:"Create a new API key for authentication and optionally add a description.",descriptionLabel:"Key description (optional)",keyDescriptionPlaceholder:"e.g. Internal staging access only",keyNamePlaceholder:"Enter key name",keyCreated:"API Key Created",saveKeyWarning:"Keep this key secure. You can also reveal the full key anytime from the key list.",wildcard:"Any Key",wildcardHint:"When enabled, any custom key — including an empty key — is accepted. Disable this key to enforce strict authentication.",status:{enabled:"Enabled",disabled:"Disabled"},actions:{enable:"Enable",disable:"Disable",delete:"Delete",reveal:"Reveal key",hide:"Hide key"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",deleteDialogTitle:"Delete API key",confirmDelete:"Are you sure you want to delete this API key? This action cannot be undone.",errors:{nameRequired:"Key name is required"},analytics:{title:"Key Usage Analytics",description:"Highlights for the past {{days}} days of API key activity",range:{today:"Today",week:"Last 7 days",month:"Last 30 days"},cards:{total:"Total keys",enabled:"Enabled keys",active:"Active keys ({{days}} days)"},charts:{requests:"Top 10 keys by request count",tokens:"Top 10 keys by token usage"},tokens:{input:"Input tokens",output:"Output tokens"},requestsSeries:"Requests",empty:"No activity for the selected range.",unknownKey:"Unknown key"},quickStart:{title:"Recommended workflow",description:"Start with separate keys per client, then tighten endpoint access as needed.",create:{title:"Split keys by client",description:"Create different keys for Claude Code, Codex, CI, or staging so logs stay easy to trace."},restrict:{title:"Restrict endpoint access",description:"Limit keys to Anthropic, OpenAI, or custom endpoints when you want tighter isolation."},wildcard:{title:"Use wildcard sparingly",description:"Wildcard access is convenient for migration, but named keys are safer for production."}},list:{title:"Key Inventory",empty:"No API keys found. Use the button above to create one.",emptyFiltered:"No API keys match the current filters."},filters:{searchPlaceholder:"Search by name, description, or endpoint",all:"All",enabled:"Enabled",disabled:"Disabled"},summary:{totalCount:"{{count}} keys",wildcard:"Wildcard keys: {{count}}",restricted:"Restricted keys: {{count}}",unrestricted:"Unrestricted keys: {{count}}"},toast:{keyCreated:"API key created successfully",keyUpdated:"API key updated successfully",keyDeleted:"API key deleted successfully",keyCopied:"Key copied to clipboard",createFailure:"Failed to create: {{message}}",updateFailure:"Failed to update: {{message}}",deleteFailure:"Failed to delete: {{message}}",revealFailure:"Failed to reveal key",copyFailure:"Failed to copy"},allowedEndpoints:"Allowed Endpoints",allEndpoints:"All endpoints (unrestricted)",editEndpoints:"Edit Endpoint Access",endpointRestricted:"Restricted",selectEndpoints:"Select which endpoints this key can access. Leave empty to allow all."},about:{title:"About",description:"Review cc-gw version details, build metadata, and current runtime status.",app:{title:"Application",subtitle:"Gateway build metadata at a glance.",labels:{name:"Name",version:"Version",buildTime:"Build time",runtime:"Backend runtime",backendVersion:"Backend version"},hint:{buildTime:"Timestamps are recorded in UTC so you can trace deployments easily."}},status:{title:"Runtime status",subtitle:"Live metrics reported by the running gateway.",loading:"Fetching status...",empty:"Unable to retrieve status information.",labels:{host:"Listen host",port:"Listen port",providers:"Providers configured",active:"Active requests",platform:"Platform",pid:"Process PID"},hint:{active:"Active request totals refresh roughly every minute."}},support:{title:"Operational notes",subtitle:"Maintenance guidance",description:"Manage providers, routing, and logs in the Web UI; advanced settings live in ~/.cc-gw/config.json.",tip:"Consider keeping ~/.cc-gw/config.json under version control or managing it via automation scripts.",actions:{checkUpdates:"Check for updates"}},toast:{statusError:{title:"Failed to load status"},updatesPlanned:"Update checks will arrive in a future release."}},endpoints:{title:"Custom Endpoints",description:"Manage custom API endpoints with multiple protocol support.",createButton:"Add Endpoint",createTitle:"Create Endpoint",editTitle:"Edit Endpoint",emptyTitle:"No custom endpoints",emptyDescription:'Click "Add Endpoint" to create your first custom endpoint.',loadError:"Failed to load endpoints",id:"ID",path:"Path",disabled:"Disabled",hasRouting:"Routing configured",protocols:{anthropic:"Anthropic Protocol","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},form:{id:"Endpoint ID",idPlaceholder:"e.g. custom-api",idHint:"ID cannot be changed after creation, used for internal identification.",label:"Display Name",labelPlaceholder:"e.g. My Custom API",path:"Access Path",pathPlaceholder:"e.g. /custom/api",pathHint:"Path must start with /. Changes take effect immediately.",protocol:"Protocol Type",enabled:"Enable this endpoint"},routing:{title:"Routing Configuration (Optional)",modelRoutes:"Model Routing Rules",addRoute:"Add Rule",noRoutes:"No routing rules",sourceModelPlaceholder:"Source model (e.g. claude-3-5-sonnet-20241022)",targetPlaceholder:"Target (e.g. anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"Format: source model → provider:model, wildcards supported (e.g. gpt-* → openai:*)",defaults:"Default Model Configuration",defaultCompletion:"Default for completion tasks",defaultReasoning:"Default for reasoning tasks",defaultBackground:"Default for background tasks",longContextThreshold:"Long context threshold (tokens)",defaultPlaceholder:"e.g. anthropic:claude-3-5-sonnet-20241022"},createSuccess:"Endpoint created successfully",createError:"Failed to create: {{error}}",updateSuccess:"Endpoint updated successfully",updateError:"Failed to update: {{error}}",deleteSuccess:"Endpoint deleted successfully",deleteError:"Failed to delete: {{error}}",deleteConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',validationError:"Please fill in all required fields"},profiler:{description:"Record and analyze LLM session latency and token usage."}}}};function Qe(){if(typeof window>"u")return"zh";const e=window.localStorage.getItem(A.language);return e==="zh"||e==="en"?e:"zh"}function N(e){if(typeof window>"u")return;const o=e.toLowerCase().startsWith("zh")?"zh":"en";window.localStorage.setItem(A.language,o)}C.isInitialized||(C.use(Ne).init({resources:$e,lng:Qe(),fallbackLng:"en",interpolation:{escapeValue:!1}}),C.on("languageChanged",N),N(C.language));function Ye(e,o){const a=o,s=a==null?void 0:a.status;return s===401||s===403||s===404?!1:e<2}function Je(){return new ue({defaultOptions:{queries:{retry:Ye,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}function Xe(e){return typeof e=="function"?e():e}function Ze(e,o,a={}){const{serialize:s=JSON.stringify,deserialize:n=JSON.parse}=a,[i,l]=r.useState(()=>{const d=Xe(o);if(typeof window>"u")return d;const u=window.localStorage.getItem(e);if(u===null)return d;try{return n(u)}catch{return d}});return r.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,s(i))}catch{}},[e,i]),[i,l]}const oe=r.createContext(void 0);function et(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function j(e){const o=document.documentElement;o.dataset.theme=e,e==="dark"?o.classList.add("dark"):o.classList.remove("dark")}function tt({children:e}){const[o,a]=Ze(A.themeMode,"system",{serialize:i=>i,deserialize:i=>i==="light"||i==="dark"||i==="system"?i:"system"}),s=r.useMemo(()=>typeof window<"u"?et(o):"light",[o]);r.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=d=>{o==="system"&&j(d.matches?"dark":"light")};return i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[o]),r.useEffect(()=>{typeof window>"u"||j(s)},[s]);const n=r.useMemo(()=>({mode:o,resolved:s,setMode:a}),[o,s]);return t.jsx(oe.Provider,{value:n,children:e})}function ot(){const e=r.useContext(oe);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const ae=r.createContext(void 0);function at(){return`toast_${Math.random().toString(36).slice(2)}`}function st({children:e}){const[o,a]=r.useState([]),s=r.useCallback(d=>{a(u=>u.filter(c=>c.id!==d))},[]),n=r.useCallback(d=>{a(u=>u.map(c=>c.id===d?{...c,dismissing:!0}:c)),setTimeout(()=>s(d),200)},[s]),i=r.useCallback(d=>{const u=d.id??at();a(m=>[...m,{...d,id:u}]);const c=d.durationMs??3e3;c>0&&setTimeout(()=>n(u),c)},[n]),l=r.useMemo(()=>({toasts:o,pushToast:i,dismissToast:n}),[o,n,i]);return t.jsxs(ae.Provider,{value:l,children:[e,t.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:o.map(d=>t.jsx("div",{role:"alert",className:`rounded-md border border-border bg-card p-4 text-card-foreground shadow-lg ${d.dismissing?"animate-toast-out":"animate-toast-in"} ${d.variant==="error"?"border-destructive/20 bg-destructive/10 text-destructive":d.variant==="success"?"border-[hsl(var(--success)/0.2)] bg-[hsl(var(--success-bg))] text-[hsl(var(--success)/1)]":""}`,children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:d.title}),d.description?t.jsx("p",{className:"mt-1 text-sm opacity-75",children:d.description}):null]}),t.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>d.id&&n(d.id),children:"×"})]})},d.id))})]})}function Gt(){const e=r.useContext(ae);if(!e)throw new Error("useToast must be used within ToastProvider");return e}const g=K.create({baseURL:"/",timeout:15e3,withCredentials:!0});g.interceptors.request.use(e=>{const o=(e.method??"get").toLowerCase();if(o==="get"||o==="head"){const a=pe.from(e.headers);a.set("Cache-Control","no-cache"),a.set("Pragma","no-cache"),e.headers=a}return e});g.interceptors.response.use(e=>e,e=>Promise.reject(e));function I(e){var o,a,s;if(K.isAxiosError(e)){const n=(o=e.response)==null?void 0:o.status;return{message:((s=(a=e.response)==null?void 0:a.data)==null?void 0:s.error)||e.message||"请求失败,请稍后再试",status:n,code:String(n??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}async function nt(e){return(await g.request(e)).data}async function v(e){return(await e).data}const $t={list:async()=>v(g.get("/api/custom-endpoints")),create:async e=>v(g.post("/api/custom-endpoints",e)),update:async(e,o)=>v(g.put(`/api/custom-endpoints/${e}`,o)),delete:async e=>v(g.delete(`/api/custom-endpoints/${e}`))},E={session:async()=>nt({url:"/auth/session",method:"GET"}),login:async(e,o)=>v(g.post("/auth/login",{username:e,password:o})),logout:async()=>v(g.post("/auth/logout"))},se=r.createContext(void 0);function it({children:e}){const o=r.useRef(!0),[a,s]=r.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),n=r.useCallback(c=>{o.current&&s(c)},[]),i=r.useCallback(async()=>{n(c=>({...c,loading:!0,error:null}));try{const c=await E.session();n(()=>({loading:!1,authEnabled:!!c.authEnabled,isAuthenticated:!c.authEnabled||!!c.authenticated,username:c.username??void 0,error:null}))}catch(c){const m=I(c);n(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:m.message}))}},[n]),l=r.useCallback(async(c,m)=>{n(p=>({...p,loading:!0,error:null}));try{await E.login(c,m),await i()}catch(p){const y=I(p);throw n(P=>({...P,loading:!1,error:y.message,isAuthenticated:!1})),y}},[i,n]),d=r.useCallback(async()=>{n(c=>({...c,loading:!0}));try{await E.logout()}catch(c){const m=I(c);n(p=>({...p,error:m.message}))}finally{await i()}},[i,n]);r.useEffect(()=>{o.current=!0,i();const c=g.interceptors.response.use(m=>m,async m=>{var p;return((p=m==null?void 0:m.response)==null?void 0:p.status)===401&&await i(),Promise.reject(m)});return()=>{o.current=!1,g.interceptors.response.eject(c)}},[i]);const u=r.useMemo(()=>({...a,refresh:i,login:l,logout:d}),[a,i,l,d]);return t.jsx(se.Provider,{value:u,children:e})}function D(){const e=r.useContext(se);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function rt({children:e}){const[o]=r.useState(()=>Je());return t.jsx(He,{client:o,children:t.jsx(je,{i18n:C,children:t.jsx(tt,{children:t.jsx(st,{children:t.jsx(it,{children:e})})})})})}function h(...e){return me(he(e))}function ne({label:e}){const{t:o}=b();return t.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[t.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl border border-primary/15 bg-primary/10 text-primary",children:t.jsx(ge,{className:"h-6 w-6 animate-spin","aria-hidden":"true"})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e??o("common.loading")})]})})}const lt="modulepreload",dt=function(e){return"/"+e},M={},f=function(o,a,s){let n=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=Promise.allSettled(a.map(u=>{if(u=dt(u),u in M)return;M[u]=!0;const c=u.endsWith(".css"),m=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":lt,c||(p.as="script"),p.crossOrigin="",p.href=u,d&&p.setAttribute("nonce",d),document.head.appendChild(p),c)return new Promise((y,P)=>{p.addEventListener("load",y),p.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return n.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return o().catch(i)})},ct=r.lazy(()=>f(()=>import("./Dashboard-_T1jT56-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ut=r.lazy(()=>f(()=>import("./Logs-DVPaFD7W.js"),__vite__mapDeps([19,1,2,3,12,20,21,5,6,14,22,4,23,15,16,17,24,25,13,26,18]))),pt=r.lazy(()=>f(()=>import("./Events-B7l9cIhA.js"),__vite__mapDeps([27,1,2,3,11,12,4,15,16,17,20,5,6,14,18]))),F=r.lazy(()=>f(()=>import("./ModelManagement-m4p97Xel.js"),__vite__mapDeps([28,1,29,22,6,16,2,3,14,20,21,5,30,17,12,25,26,15,18]))),mt=r.lazy(()=>f(()=>import("./ApiKeys-DXJYgiYr.js"),__vite__mapDeps([31,1,2,3,29,22,6,16,20,21,15,17,14,7,8,9,10,11,12,23,18]))),ht=r.lazy(()=>f(()=>import("./Settings-CdZ_GGjR.js"),__vite__mapDeps([32,1,29,22,6,16,2,3,12,20,21,30,5,14,15,26,23,17,18]))),gt=r.lazy(()=>f(()=>import("./About-bnb_BU6z.js"),__vite__mapDeps([33,1,2,3,11,12,4,15,16,17,14,18,6]))),ft=r.lazy(()=>f(()=>import("./Help-M_B7c7Hj.js"),__vite__mapDeps([34,1,2,3,11,12,23,14,16,18,6]))),yt=r.lazy(()=>f(()=>import("./Login-CXG8h1Xd.js"),__vite__mapDeps([35,1,12,20,21,14,18,16,6]))),vt=r.lazy(()=>f(()=>import("./Profiler-Bb-I7NR2.js"),__vite__mapDeps([36,1,16,4,3,24,17,14,18,6]))),ie=[{path:"/",index:!0,element:ct,nav:{icon:fe,labelKey:"nav.dashboard",descriptionKey:"dashboard.description",matchPaths:["/"]}},{path:"/logs",element:ut,nav:{icon:ye,labelKey:"nav.logs",descriptionKey:"logs.description"}},{path:"/models",element:F,nav:{icon:ve,labelKey:"nav.models",descriptionKey:"modelManagement.description",matchPaths:["/models","/providers"]}},{path:"/providers",element:F},{path:"/events",element:pt,nav:{icon:be,labelKey:"nav.events",descriptionKey:"events.description"}},{path:"/api-keys",element:mt,nav:{icon:Pe,labelKey:"nav.apiKeys",descriptionKey:"apiKeys.description"}},{path:"/profiler",element:vt,nav:{icon:Te,labelKey:"nav.profiler",descriptionKey:"profiler.description"}},{path:"/settings",element:ht,nav:{icon:Ce,labelKey:"nav.settings",descriptionKey:"settings.description"}},{path:"/help",element:ft,nav:{icon:we,labelKey:"nav.help",descriptionKey:"help.intro"}},{path:"/about",element:gt,nav:{icon:xe,labelKey:"nav.about",descriptionKey:"about.description"}}],bt=[{path:"/login",element:yt}],w=ie.filter(e=>!!e.nav);function Pt(e){return e==="/"?w[0]:w.find(o=>(o.nav.matchPaths??[o.path]).some(s=>s!=="/"&&e.startsWith(s)))??w[0]}function Tt(){return typeof window>"u"?"/":window.location.pathname.startsWith("/ui")?"/ui":"/"}const Ct=ke("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-[0_8px_20px_-12px_hsl(var(--primary)/0.4)] hover:-translate-y-0.5 hover:bg-primary/95 hover:shadow-[0_14px_28px_-14px_hsl(var(--primary)/0.45)]",destructive:"bg-destructive text-destructive-foreground shadow-[0_8px_20px_-12px_rgba(220,38,38,0.55)] hover:-translate-y-0.5 hover:bg-destructive/95",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary/90 text-secondary-foreground hover:bg-secondary",ghost:"text-muted-foreground hover:bg-accent hover:text-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3.5 text-[13px]",lg:"h-11 px-8",icon:"h-10 w-10 rounded-2xl"}},defaultVariants:{variant:"default",size:"default"}}),x=r.forwardRef(({className:e,variant:o,size:a,asChild:s=!1,...n},i)=>{const l=s?_e:"button";return t.jsx(l,{className:h(Ct({variant:o,size:a,className:e})),ref:i,...n})});x.displayName="Button";const re=Ue,le=ze,wt=r.forwardRef(({className:e,inset:o,children:a,...s},n)=>t.jsxs(V,{ref:n,className:h("flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",e),...s,children:[a,t.jsx(U,{className:"ml-auto"})]}));wt.displayName=V.displayName;const xt=r.forwardRef(({className:e,...o},a)=>t.jsx(G,{ref:a,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));xt.displayName=G.displayName;const L=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ke,{children:t.jsx($,{ref:s,sideOffset:o,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));L.displayName=$.displayName;const q=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx(Q,{ref:s,className:h("relative flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",e),...a}));q.displayName=Q.displayName;const kt=r.forwardRef(({className:e,children:o,checked:a,...s},n)=>t.jsxs(Y,{ref:n,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ae,{className:"h-4 w-4"})})}),o]}));kt.displayName=Y.displayName;const At=r.forwardRef(({className:e,children:o,...a},s)=>t.jsxs(X,{ref:s,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ie,{className:"h-2 w-2 fill-current"})})}),o]}));At.displayName=X.displayName;const It=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx(Z,{ref:s,className:h("px-3 py-2 text-sm font-semibold",o&&"pl-8",e),...a}));It.displayName=Z.displayName;const Et=r.forwardRef(({className:e,...o},a)=>t.jsx(ee,{ref:a,className:h("-mx-1 my-1 h-px bg-muted",e),...o}));Et.displayName=ee.displayName;const O=[{mode:"light",labelKey:"common.theme.light",icon:z},{mode:"dark",labelKey:"common.theme.dark",icon:B},{mode:"system",labelKey:"common.theme.system",icon:Ee}];function Rt(){const{mode:e,setMode:o,resolved:a}=ot(),{t:s}=b(),n=O.find(l=>l.mode===e),i=(n==null?void 0:n.icon)||(a==="dark"?B:z);return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":s("common.theme.label"),"data-testid":"theme-switcher-trigger",children:[t.jsx(i,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:s((n==null?void 0:n.labelKey)??"common.theme.label")})]})}),t.jsx(L,{align:"end",children:O.map(l=>{const d=l.icon,u=l.mode===e;return t.jsxs(q,{onClick:()=>o(l.mode),className:u?"bg-accent":"",children:[t.jsx(d,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),s(l.labelKey)]},l.mode)})})]})}const _=[{code:"zh",labelKey:"language.zh",nativeName:"中文"},{code:"en",labelKey:"language.en",nativeName:"English"}];function St(){const{i18n:e,t:o}=b(),a=e.language.startsWith("zh")?"zh":"en",s=_.find(i=>i.code===a),n=i=>{typeof window<"u"&&window.localStorage.setItem(A.language,i),e.changeLanguage(i)};return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":o("common.languageSelector"),"data-testid":"language-switcher-trigger",children:[t.jsx(Re,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.nativeName)??"Language"})]})}),t.jsx(L,{align:"end",children:_.map(i=>t.jsx(q,{onClick:()=>n(i.code),className:i.code===a?"bg-accent":"",children:i.nativeName},i.code))})]})}const Dt=Be,Lt=We,qt=Ve,de=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ge,{children:t.jsx(te,{ref:s,sideOffset:o,className:h("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));de.displayName=te.displayName;function Ht(e,o){return(o.nav.matchPaths??[o.path]).some(s=>s==="/"?e==="/":e.startsWith(s))}const Nt=["/","/logs","/models","/events","/profiler"],jt=["/api-keys","/settings","/help","/about"];function k({label:e,items:o,pathname:a,compact:s,onNavigate:n}){const{t:i}=b();return o.length===0?null:t.jsxs("div",{className:"space-y-0.5",children:[!s&&t.jsx("p",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/60",children:e}),o.map(l=>{const d=l.nav.icon,u=Ht(a,l),c=i(l.nav.labelKey);return s?t.jsxs(Lt,{children:[t.jsx(qt,{asChild:!0,children:t.jsx(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center justify-center rounded-full p-2.5 transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),"aria-label":c,children:t.jsx(d,{className:"h-5 w-5","aria-hidden":"true"})})}),t.jsx(de,{side:"right",children:c})]},l.path):t.jsxs(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center gap-3 rounded-full px-3 py-2 text-sm font-medium transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:[t.jsx(d,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate",children:c}),u&&t.jsx(U,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]},l.path)})]})}function R({compact:e,onNavigate:o}){const{t:a}=b(),s=S(),{authEnabled:n,username:i}=D(),l=w.filter(u=>Nt.includes(u.path)),d=w.filter(u=>jt.includes(u.path));return t.jsxs("div",{className:h("flex h-full flex-col",e?"items-center":""),children:[t.jsxs("div",{className:h("flex shrink-0 items-center border-b border-border",e?"h-16 w-full justify-center":"h-16 gap-3 px-5"),children:[t.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-xs font-bold text-primary-foreground",children:"GW"}),!e&&t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:a("app.title")}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a("app.consoleSubtitle")})]})]}),t.jsx("div",{className:h("flex-1 overflow-y-auto",e?"w-full p-2":"space-y-4 p-3"),children:e?t.jsx(Dt,{delayDuration:0,children:t.jsxs("div",{className:"space-y-1",children:[t.jsx(k,{label:"",items:l,pathname:s.pathname,compact:!0,onNavigate:o}),t.jsx("div",{className:"my-2 border-t border-border"}),t.jsx(k,{label:"",items:d,pathname:s.pathname,compact:!0,onNavigate:o})]})}):t.jsxs(t.Fragment,{children:[t.jsx(k,{label:a("nav.group.overview"),items:l,pathname:s.pathname,onNavigate:o}),t.jsx(k,{label:a("nav.group.admin"),items:d,pathname:s.pathname,onNavigate:o})]})}),n&&i&&!e&&t.jsx("div",{className:"shrink-0 border-t border-border p-3",children:t.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-2 py-2",children:[t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-semibold text-muted-foreground",children:i.slice(0,2).toUpperCase()}),t.jsx("span",{className:"flex-1 truncate text-xs text-muted-foreground",children:i})]})})]})}function Mt(){const{t:e}=b(),o=S(),[a,s]=r.useState(!1),{authEnabled:n,username:i,logout:l}=D(),[d,u]=r.useState(!1);r.useEffect(()=>{s(!1)},[o.pathname]);const c=r.useMemo(()=>Pt(o.pathname),[o.pathname]),m=e(c.nav.labelKey),p=e(c.nav.descriptionKey),y=async()=>{if(!d){u(!0);try{await l()}finally{u(!1)}}};return t.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[t.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-4 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground",children:e("app.skipToContent")}),t.jsx("aside",{className:"hidden w-16 shrink-0 flex-col border-r border-border bg-card md:flex lg:hidden",children:t.jsx(R,{compact:!0})}),t.jsx("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-border bg-card lg:flex",children:t.jsx(R,{})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsxs("header",{className:"sticky top-0 z-30 flex h-16 shrink-0 items-center justify-between gap-4 border-b border-border bg-card px-4 lg:px-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(x,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>s(P=>!P),"aria-label":e(a?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":a,"aria-controls":"mobile-nav",children:a?t.jsx(Se,{className:"h-5 w-5"}):t.jsx(De,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),t.jsx("p",{className:"hidden text-xs text-muted-foreground sm:block",children:p})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n&&i&&t.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:e("login.status",{username:i})}),n&&t.jsx(x,{variant:"ghost",size:"sm",onClick:()=>void y(),disabled:d,children:e(d?"common.actions.loading":"common.actions.logout")}),t.jsx(St,{}),t.jsx(Rt,{})]})]}),t.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"mx-auto max-w-7xl px-4 py-6 lg:px-8 lg:py-8 animate-in fade-in slide-in-from-bottom-4 duration-300",children:t.jsx(Me,{})})})]}),a&&t.jsxs("div",{className:"fixed inset-0 z-40 md:hidden",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>s(!1)}),t.jsx("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-64 border-r border-border bg-card shadow-lg animate-in slide-in-from-left duration-200",children:t.jsx(R,{onNavigate:()=>s(!1)})})]})]})}function Ft({children:e}){const{authEnabled:o,isAuthenticated:a,loading:s}=D(),n=S();return s?t.jsx(ne,{}):!o||a?e:t.jsx(W,{to:"/login",replace:!0,state:{from:n}})}function Ot(){return t.jsx(Ft,{children:t.jsx(Mt,{})})}function _t(){return t.jsx(Fe,{basename:Tt(),children:t.jsx(r.Suspense,{fallback:t.jsx(ne,{}),children:t.jsxs(Oe,{children:[t.jsx(T,{path:"/",element:t.jsx(Ot,{}),children:ie.map(e=>{const o=e.element;return e.index?t.jsx(T,{index:!0,element:t.jsx(o,{})},"index"):t.jsx(T,{path:e.path.slice(1),element:t.jsx(o,{})},e.path)})}),bt.map(e=>{const o=e.element;return t.jsx(T,{path:e.path,element:t.jsx(o,{})},e.path)}),t.jsx(T,{path:"*",element:t.jsx(W,{to:"/",replace:!0})})]})})})}function Kt(){return t.jsx(rt,{children:t.jsx(_t,{})})}const ce=document.getElementById("root");if(!ce)throw new Error("Root element #root not found");Le.createRoot(ce).render(t.jsx(qe.StrictMode,{children:t.jsx(Kt,{})}));export{x as B,ne as L,Dt as T,Ze as a,g as b,h as c,$t as d,Lt as e,qt as f,de as g,v as h,D as i,nt as r,A as s,I as t,Gt as u};
|
|
61
|
+
After configuration, clients access via \`http://127.0.0.1:4100/claude/v1/messages\` (path auto-expansion).`,'Enable "Store request bodies" / "Store response bodies" to inspect and copy client-side and upstream payloads from the log drawer when troubleshooting.',"If you do not need payload-level troubleshooting, turn off payload storage to reduce local disk usage and privacy exposure.","Use **routing presets** to save common routing configurations and quickly switch between different provider setups.","If you edit ~/.cc-gw/config.json manually, refresh the Settings page or restart cc-gw so the UI reflects the latest configuration."]}},faq:{title:"Frequently asked questions",items:[{q:"How can I change the default model for each endpoint?",a:'Go to "Model Management → Routing" and choose defaults for /anthropic and /openai. Saving applies the change right away.'},{q:"How do I use custom endpoints?",a:'Create a custom endpoint in the "Model Management" page by configuring a base path (e.g., `/my-endpoint`) and protocol type. The system automatically registers full API paths based on the protocol. For example, after configuring `/claude` + `anthropic` protocol, clients access via `http://127.0.0.1:4100/claude/v1/messages`.\n\nIf you encounter 404 errors, check:\n1) Is the endpoint enabled?\n2) Are clients using the complete path (including protocol subpath)?\n3) Check server logs to confirm route registration'},{q:"Why are cached token numbers missing?",a:"Upstream providers must return cached_tokens or input_tokens_details.cached_tokens. Enable cache metrics on the provider if supported."},{q:"How can I use different models for different clients?",a:'Create separate API keys for each client and configure different routing rules in "Model Management → Routing". You can also create dedicated custom endpoints for different clients.'}]}},apiKeys:{title:"API Keys Management",description:"Create and manage API keys for gateway access",helper:"Use separate keys for each client, environment, or automation task so you can audit, restrict, and revoke access cleanly.",createNew:"Create New Key",createAction:"Create",createDescription:"Create a new API key for authentication and optionally add a description.",descriptionLabel:"Key description (optional)",keyDescriptionPlaceholder:"e.g. Internal staging access only",keyNamePlaceholder:"Enter key name",keyCreated:"API Key Created",saveKeyWarning:"Keep this key secure. You can also reveal the full key anytime from the key list.",wildcard:"Any Key",wildcardHint:"When enabled, any custom key — including an empty key — is accepted. Disable this key to enforce strict authentication.",status:{enabled:"Enabled",disabled:"Disabled"},actions:{enable:"Enable",disable:"Disable",delete:"Delete",reveal:"Reveal key",hide:"Hide key"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",deleteDialogTitle:"Delete API key",confirmDelete:"Are you sure you want to delete this API key? This action cannot be undone.",errors:{nameRequired:"Key name is required"},analytics:{title:"Key Usage Analytics",description:"Highlights for the past {{days}} days of API key activity",range:{today:"Today",week:"Last 7 days",month:"Last 30 days"},cards:{total:"Total keys",enabled:"Enabled keys",active:"Active keys ({{days}} days)"},charts:{requests:"Top 10 keys by request count",tokens:"Top 10 keys by token usage"},tokens:{input:"Input tokens",output:"Output tokens"},requestsSeries:"Requests",empty:"No activity for the selected range.",unknownKey:"Unknown key"},quickStart:{title:"Recommended workflow",description:"Start with separate keys per client, then tighten endpoint access as needed.",create:{title:"Split keys by client",description:"Create different keys for Claude Code, Codex, CI, or staging so logs stay easy to trace."},restrict:{title:"Restrict endpoint access",description:"Limit keys to Anthropic, OpenAI, or custom endpoints when you want tighter isolation."},wildcard:{title:"Use wildcard sparingly",description:"Wildcard access is convenient for migration, but named keys are safer for production."}},list:{title:"Key Inventory",empty:"No API keys found. Use the button above to create one.",emptyFiltered:"No API keys match the current filters."},filters:{searchPlaceholder:"Search by name, description, or endpoint",all:"All",enabled:"Enabled",disabled:"Disabled"},summary:{totalCount:"{{count}} keys",wildcard:"Wildcard keys: {{count}}",restricted:"Restricted keys: {{count}}",unrestricted:"Unrestricted keys: {{count}}"},toast:{keyCreated:"API key created successfully",keyUpdated:"API key updated successfully",keyDeleted:"API key deleted successfully",keyCopied:"Key copied to clipboard",createFailure:"Failed to create: {{message}}",updateFailure:"Failed to update: {{message}}",deleteFailure:"Failed to delete: {{message}}",revealFailure:"Failed to reveal key",copyFailure:"Failed to copy"},allowedEndpoints:"Allowed Endpoints",allEndpoints:"All endpoints (unrestricted)",editEndpoints:"Edit Endpoint Access",endpointRestricted:"Restricted",selectEndpoints:"Select which endpoints this key can access. Leave empty to allow all."},about:{title:"About",description:"Review cc-gw version details, build metadata, and current runtime status.",app:{title:"Application",subtitle:"Gateway build metadata at a glance.",labels:{name:"Name",version:"Version",buildTime:"Build time",runtime:"Backend runtime",backendVersion:"Backend version"},hint:{buildTime:"Timestamps are recorded in UTC so you can trace deployments easily."}},status:{title:"Runtime status",subtitle:"Live metrics reported by the running gateway.",loading:"Fetching status...",empty:"Unable to retrieve status information.",labels:{host:"Listen host",port:"Listen port",providers:"Providers configured",active:"Active requests",platform:"Platform",pid:"Process PID"},hint:{active:"Active request totals refresh roughly every minute."}},support:{title:"Operational notes",subtitle:"Maintenance guidance",description:"Manage providers, routing, and logs in the Web UI; advanced settings live in ~/.cc-gw/config.json.",tip:"Consider keeping ~/.cc-gw/config.json under version control or managing it via automation scripts.",actions:{checkUpdates:"Check for updates"}},toast:{statusError:{title:"Failed to load status"},updatesPlanned:"Update checks will arrive in a future release."}},endpoints:{title:"Custom Endpoints",description:"Manage custom API endpoints with multiple protocol support.",createButton:"Add Endpoint",createTitle:"Create Endpoint",editTitle:"Edit Endpoint",emptyTitle:"No custom endpoints",emptyDescription:'Click "Add Endpoint" to create your first custom endpoint.',loadError:"Failed to load endpoints",id:"ID",path:"Path",disabled:"Disabled",hasRouting:"Routing configured",protocols:{anthropic:"Anthropic Protocol","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},form:{id:"Endpoint ID",idPlaceholder:"e.g. custom-api",idHint:"ID cannot be changed after creation, used for internal identification.",label:"Display Name",labelPlaceholder:"e.g. My Custom API",path:"Access Path",pathPlaceholder:"e.g. /custom/api",pathHint:"Path must start with /. Changes take effect immediately.",protocol:"Protocol Type",enabled:"Enable this endpoint"},routing:{title:"Routing Configuration (Optional)",modelRoutes:"Model Routing Rules",addRoute:"Add Rule",noRoutes:"No routing rules",sourceModelPlaceholder:"Source model (e.g. claude-3-5-sonnet-20241022)",targetPlaceholder:"Target (e.g. anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"Format: source model → provider:model, wildcards supported (e.g. gpt-* → openai:*)",defaults:"Default Model Configuration",defaultCompletion:"Default for completion tasks",defaultReasoning:"Default for reasoning tasks",defaultBackground:"Default for background tasks",longContextThreshold:"Long context threshold (tokens)",defaultPlaceholder:"e.g. anthropic:claude-3-5-sonnet-20241022"},createSuccess:"Endpoint created successfully",createError:"Failed to create: {{error}}",updateSuccess:"Endpoint updated successfully",updateError:"Failed to update: {{error}}",deleteSuccess:"Endpoint deleted successfully",deleteError:"Failed to delete: {{error}}",deleteConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',validationError:"Please fill in all required fields"},profiler:{description:"Record and analyze LLM session latency and token usage."}}}};function Qe(){if(typeof window>"u")return"zh";const e=window.localStorage.getItem(A.language);return e==="zh"||e==="en"?e:"zh"}function N(e){if(typeof window>"u")return;const o=e.toLowerCase().startsWith("zh")?"zh":"en";window.localStorage.setItem(A.language,o)}C.isInitialized||(C.use(Ne).init({resources:$e,lng:Qe(),fallbackLng:"en",interpolation:{escapeValue:!1}}),C.on("languageChanged",N),N(C.language));function Ye(e,o){const a=o,s=a==null?void 0:a.status;return s===401||s===403||s===404?!1:e<2}function Je(){return new ue({defaultOptions:{queries:{retry:Ye,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}function Xe(e){return typeof e=="function"?e():e}function Ze(e,o,a={}){const{serialize:s=JSON.stringify,deserialize:n=JSON.parse}=a,[i,l]=r.useState(()=>{const d=Xe(o);if(typeof window>"u")return d;const u=window.localStorage.getItem(e);if(u===null)return d;try{return n(u)}catch{return d}});return r.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,s(i))}catch{}},[e,i]),[i,l]}const oe=r.createContext(void 0);function et(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function j(e){const o=document.documentElement;o.dataset.theme=e,e==="dark"?o.classList.add("dark"):o.classList.remove("dark")}function tt({children:e}){const[o,a]=Ze(A.themeMode,"system",{serialize:i=>i,deserialize:i=>i==="light"||i==="dark"||i==="system"?i:"system"}),s=r.useMemo(()=>typeof window<"u"?et(o):"light",[o]);r.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=d=>{o==="system"&&j(d.matches?"dark":"light")};return i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[o]),r.useEffect(()=>{typeof window>"u"||j(s)},[s]);const n=r.useMemo(()=>({mode:o,resolved:s,setMode:a}),[o,s]);return t.jsx(oe.Provider,{value:n,children:e})}function ot(){const e=r.useContext(oe);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const ae=r.createContext(void 0);function at(){return`toast_${Math.random().toString(36).slice(2)}`}function st({children:e}){const[o,a]=r.useState([]),s=r.useCallback(d=>{a(u=>u.filter(c=>c.id!==d))},[]),n=r.useCallback(d=>{a(u=>u.map(c=>c.id===d?{...c,dismissing:!0}:c)),setTimeout(()=>s(d),200)},[s]),i=r.useCallback(d=>{const u=d.id??at();a(m=>[...m,{...d,id:u}]);const c=d.durationMs??3e3;c>0&&setTimeout(()=>n(u),c)},[n]),l=r.useMemo(()=>({toasts:o,pushToast:i,dismissToast:n}),[o,n,i]);return t.jsxs(ae.Provider,{value:l,children:[e,t.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:o.map(d=>t.jsx("div",{role:"alert",className:`rounded-md border border-border bg-card p-4 text-card-foreground shadow-lg ${d.dismissing?"animate-toast-out":"animate-toast-in"} ${d.variant==="error"?"border-destructive/20 bg-destructive/10 text-destructive":d.variant==="success"?"border-[hsl(var(--success)/0.2)] bg-[hsl(var(--success-bg))] text-[hsl(var(--success)/1)]":""}`,children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:d.title}),d.description?t.jsx("p",{className:"mt-1 text-sm opacity-75",children:d.description}):null]}),t.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>d.id&&n(d.id),children:"×"})]})},d.id))})]})}function Gt(){const e=r.useContext(ae);if(!e)throw new Error("useToast must be used within ToastProvider");return e}const g=K.create({baseURL:"/",timeout:15e3,withCredentials:!0});g.interceptors.request.use(e=>{const o=(e.method??"get").toLowerCase();if(o==="get"||o==="head"){const a=pe.from(e.headers);a.set("Cache-Control","no-cache"),a.set("Pragma","no-cache"),e.headers=a}return e});g.interceptors.response.use(e=>e,e=>Promise.reject(e));function I(e){var o,a,s;if(K.isAxiosError(e)){const n=(o=e.response)==null?void 0:o.status;return{message:((s=(a=e.response)==null?void 0:a.data)==null?void 0:s.error)||e.message||"请求失败,请稍后再试",status:n,code:String(n??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}async function nt(e){return(await g.request(e)).data}async function v(e){return(await e).data}const $t={list:async()=>v(g.get("/api/custom-endpoints")),create:async e=>v(g.post("/api/custom-endpoints",e)),update:async(e,o)=>v(g.put(`/api/custom-endpoints/${e}`,o)),delete:async e=>v(g.delete(`/api/custom-endpoints/${e}`))},E={session:async()=>nt({url:"/auth/session",method:"GET"}),login:async(e,o)=>v(g.post("/auth/login",{username:e,password:o})),logout:async()=>v(g.post("/auth/logout"))},se=r.createContext(void 0);function it({children:e}){const o=r.useRef(!0),[a,s]=r.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),n=r.useCallback(c=>{o.current&&s(c)},[]),i=r.useCallback(async()=>{n(c=>({...c,loading:!0,error:null}));try{const c=await E.session();n(()=>({loading:!1,authEnabled:!!c.authEnabled,isAuthenticated:!c.authEnabled||!!c.authenticated,username:c.username??void 0,error:null}))}catch(c){const m=I(c);n(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:m.message}))}},[n]),l=r.useCallback(async(c,m)=>{n(p=>({...p,loading:!0,error:null}));try{await E.login(c,m),await i()}catch(p){const y=I(p);throw n(P=>({...P,loading:!1,error:y.message,isAuthenticated:!1})),y}},[i,n]),d=r.useCallback(async()=>{n(c=>({...c,loading:!0}));try{await E.logout()}catch(c){const m=I(c);n(p=>({...p,error:m.message}))}finally{await i()}},[i,n]);r.useEffect(()=>{o.current=!0,i();const c=g.interceptors.response.use(m=>m,async m=>{var p;return((p=m==null?void 0:m.response)==null?void 0:p.status)===401&&await i(),Promise.reject(m)});return()=>{o.current=!1,g.interceptors.response.eject(c)}},[i]);const u=r.useMemo(()=>({...a,refresh:i,login:l,logout:d}),[a,i,l,d]);return t.jsx(se.Provider,{value:u,children:e})}function D(){const e=r.useContext(se);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function rt({children:e}){const[o]=r.useState(()=>Je());return t.jsx(He,{client:o,children:t.jsx(je,{i18n:C,children:t.jsx(tt,{children:t.jsx(st,{children:t.jsx(it,{children:e})})})})})}function h(...e){return me(he(e))}function ne({label:e}){const{t:o}=b();return t.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[t.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl border border-primary/15 bg-primary/10 text-primary",children:t.jsx(ge,{className:"h-6 w-6 animate-spin","aria-hidden":"true"})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e??o("common.loading")})]})})}const lt="modulepreload",dt=function(e){return"/"+e},M={},f=function(o,a,s){let n=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=Promise.allSettled(a.map(u=>{if(u=dt(u),u in M)return;M[u]=!0;const c=u.endsWith(".css"),m=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":lt,c||(p.as="script"),p.crossOrigin="",p.href=u,d&&p.setAttribute("nonce",d),document.head.appendChild(p),c)return new Promise((y,P)=>{p.addEventListener("load",y),p.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return n.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return o().catch(i)})},ct=r.lazy(()=>f(()=>import("./Dashboard-De61szKh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ut=r.lazy(()=>f(()=>import("./Logs-ChD1V5Mf.js"),__vite__mapDeps([19,1,2,3,12,20,21,5,6,14,22,4,23,15,16,17,24,25,13,26,18]))),pt=r.lazy(()=>f(()=>import("./Events-CmUNBQ-L.js"),__vite__mapDeps([27,1,2,3,11,12,4,15,16,17,20,5,6,14,18]))),F=r.lazy(()=>f(()=>import("./ModelManagement-DTlt9WMp.js"),__vite__mapDeps([28,1,29,22,6,16,2,3,14,20,21,5,30,17,12,25,26,15,18]))),mt=r.lazy(()=>f(()=>import("./ApiKeys-Fx_SaOSe.js"),__vite__mapDeps([31,1,2,3,29,22,6,16,20,21,15,17,14,7,8,9,10,11,12,23,18]))),ht=r.lazy(()=>f(()=>import("./Settings-YMHmPlBz.js"),__vite__mapDeps([32,1,29,22,6,16,2,3,12,20,21,30,5,14,15,26,23,17,18]))),gt=r.lazy(()=>f(()=>import("./About-DockN9He.js"),__vite__mapDeps([33,1,2,3,11,12,4,15,16,17,14,18,6]))),ft=r.lazy(()=>f(()=>import("./Help-Bo6GcOG7.js"),__vite__mapDeps([34,1,2,3,11,12,23,14,16,18,6]))),yt=r.lazy(()=>f(()=>import("./Login-uKKAO1uN.js"),__vite__mapDeps([35,1,12,20,21,14,18,16,6]))),vt=r.lazy(()=>f(()=>import("./Profiler-DBeKtgDs.js"),__vite__mapDeps([36,1,16,4,3,24,17,14,18,6]))),ie=[{path:"/",index:!0,element:ct,nav:{icon:fe,labelKey:"nav.dashboard",descriptionKey:"dashboard.description",matchPaths:["/"]}},{path:"/logs",element:ut,nav:{icon:ye,labelKey:"nav.logs",descriptionKey:"logs.description"}},{path:"/models",element:F,nav:{icon:ve,labelKey:"nav.models",descriptionKey:"modelManagement.description",matchPaths:["/models","/providers"]}},{path:"/providers",element:F},{path:"/events",element:pt,nav:{icon:be,labelKey:"nav.events",descriptionKey:"events.description"}},{path:"/api-keys",element:mt,nav:{icon:Pe,labelKey:"nav.apiKeys",descriptionKey:"apiKeys.description"}},{path:"/profiler",element:vt,nav:{icon:Te,labelKey:"nav.profiler",descriptionKey:"profiler.description"}},{path:"/settings",element:ht,nav:{icon:Ce,labelKey:"nav.settings",descriptionKey:"settings.description"}},{path:"/help",element:ft,nav:{icon:we,labelKey:"nav.help",descriptionKey:"help.intro"}},{path:"/about",element:gt,nav:{icon:xe,labelKey:"nav.about",descriptionKey:"about.description"}}],bt=[{path:"/login",element:yt}],w=ie.filter(e=>!!e.nav);function Pt(e){return e==="/"?w[0]:w.find(o=>(o.nav.matchPaths??[o.path]).some(s=>s!=="/"&&e.startsWith(s)))??w[0]}function Tt(){return typeof window>"u"?"/":window.location.pathname.startsWith("/ui")?"/ui":"/"}const Ct=ke("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-[0_8px_20px_-12px_hsl(var(--primary)/0.4)] hover:-translate-y-0.5 hover:bg-primary/95 hover:shadow-[0_14px_28px_-14px_hsl(var(--primary)/0.45)]",destructive:"bg-destructive text-destructive-foreground shadow-[0_8px_20px_-12px_rgba(220,38,38,0.55)] hover:-translate-y-0.5 hover:bg-destructive/95",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary/90 text-secondary-foreground hover:bg-secondary",ghost:"text-muted-foreground hover:bg-accent hover:text-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3.5 text-[13px]",lg:"h-11 px-8",icon:"h-10 w-10 rounded-2xl"}},defaultVariants:{variant:"default",size:"default"}}),x=r.forwardRef(({className:e,variant:o,size:a,asChild:s=!1,...n},i)=>{const l=s?_e:"button";return t.jsx(l,{className:h(Ct({variant:o,size:a,className:e})),ref:i,...n})});x.displayName="Button";const re=Ue,le=ze,wt=r.forwardRef(({className:e,inset:o,children:a,...s},n)=>t.jsxs(V,{ref:n,className:h("flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",e),...s,children:[a,t.jsx(U,{className:"ml-auto"})]}));wt.displayName=V.displayName;const xt=r.forwardRef(({className:e,...o},a)=>t.jsx(G,{ref:a,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));xt.displayName=G.displayName;const L=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ke,{children:t.jsx($,{ref:s,sideOffset:o,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));L.displayName=$.displayName;const q=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx(Q,{ref:s,className:h("relative flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",e),...a}));q.displayName=Q.displayName;const kt=r.forwardRef(({className:e,children:o,checked:a,...s},n)=>t.jsxs(Y,{ref:n,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ae,{className:"h-4 w-4"})})}),o]}));kt.displayName=Y.displayName;const At=r.forwardRef(({className:e,children:o,...a},s)=>t.jsxs(X,{ref:s,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ie,{className:"h-2 w-2 fill-current"})})}),o]}));At.displayName=X.displayName;const It=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx(Z,{ref:s,className:h("px-3 py-2 text-sm font-semibold",o&&"pl-8",e),...a}));It.displayName=Z.displayName;const Et=r.forwardRef(({className:e,...o},a)=>t.jsx(ee,{ref:a,className:h("-mx-1 my-1 h-px bg-muted",e),...o}));Et.displayName=ee.displayName;const O=[{mode:"light",labelKey:"common.theme.light",icon:z},{mode:"dark",labelKey:"common.theme.dark",icon:B},{mode:"system",labelKey:"common.theme.system",icon:Ee}];function Rt(){const{mode:e,setMode:o,resolved:a}=ot(),{t:s}=b(),n=O.find(l=>l.mode===e),i=(n==null?void 0:n.icon)||(a==="dark"?B:z);return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":s("common.theme.label"),"data-testid":"theme-switcher-trigger",children:[t.jsx(i,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:s((n==null?void 0:n.labelKey)??"common.theme.label")})]})}),t.jsx(L,{align:"end",children:O.map(l=>{const d=l.icon,u=l.mode===e;return t.jsxs(q,{onClick:()=>o(l.mode),className:u?"bg-accent":"",children:[t.jsx(d,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),s(l.labelKey)]},l.mode)})})]})}const _=[{code:"zh",labelKey:"language.zh",nativeName:"中文"},{code:"en",labelKey:"language.en",nativeName:"English"}];function St(){const{i18n:e,t:o}=b(),a=e.language.startsWith("zh")?"zh":"en",s=_.find(i=>i.code===a),n=i=>{typeof window<"u"&&window.localStorage.setItem(A.language,i),e.changeLanguage(i)};return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":o("common.languageSelector"),"data-testid":"language-switcher-trigger",children:[t.jsx(Re,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.nativeName)??"Language"})]})}),t.jsx(L,{align:"end",children:_.map(i=>t.jsx(q,{onClick:()=>n(i.code),className:i.code===a?"bg-accent":"",children:i.nativeName},i.code))})]})}const Dt=Be,Lt=We,qt=Ve,de=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ge,{children:t.jsx(te,{ref:s,sideOffset:o,className:h("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));de.displayName=te.displayName;function Ht(e,o){return(o.nav.matchPaths??[o.path]).some(s=>s==="/"?e==="/":e.startsWith(s))}const Nt=["/","/logs","/models","/events","/profiler"],jt=["/api-keys","/settings","/help","/about"];function k({label:e,items:o,pathname:a,compact:s,onNavigate:n}){const{t:i}=b();return o.length===0?null:t.jsxs("div",{className:"space-y-0.5",children:[!s&&t.jsx("p",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/60",children:e}),o.map(l=>{const d=l.nav.icon,u=Ht(a,l),c=i(l.nav.labelKey);return s?t.jsxs(Lt,{children:[t.jsx(qt,{asChild:!0,children:t.jsx(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center justify-center rounded-full p-2.5 transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),"aria-label":c,children:t.jsx(d,{className:"h-5 w-5","aria-hidden":"true"})})}),t.jsx(de,{side:"right",children:c})]},l.path):t.jsxs(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center gap-3 rounded-full px-3 py-2 text-sm font-medium transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:[t.jsx(d,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate",children:c}),u&&t.jsx(U,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]},l.path)})]})}function R({compact:e,onNavigate:o}){const{t:a}=b(),s=S(),{authEnabled:n,username:i}=D(),l=w.filter(u=>Nt.includes(u.path)),d=w.filter(u=>jt.includes(u.path));return t.jsxs("div",{className:h("flex h-full flex-col",e?"items-center":""),children:[t.jsxs("div",{className:h("flex shrink-0 items-center border-b border-border",e?"h-16 w-full justify-center":"h-16 gap-3 px-5"),children:[t.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-xs font-bold text-primary-foreground",children:"GW"}),!e&&t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:a("app.title")}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a("app.consoleSubtitle")})]})]}),t.jsx("div",{className:h("flex-1 overflow-y-auto",e?"w-full p-2":"space-y-4 p-3"),children:e?t.jsx(Dt,{delayDuration:0,children:t.jsxs("div",{className:"space-y-1",children:[t.jsx(k,{label:"",items:l,pathname:s.pathname,compact:!0,onNavigate:o}),t.jsx("div",{className:"my-2 border-t border-border"}),t.jsx(k,{label:"",items:d,pathname:s.pathname,compact:!0,onNavigate:o})]})}):t.jsxs(t.Fragment,{children:[t.jsx(k,{label:a("nav.group.overview"),items:l,pathname:s.pathname,onNavigate:o}),t.jsx(k,{label:a("nav.group.admin"),items:d,pathname:s.pathname,onNavigate:o})]})}),n&&i&&!e&&t.jsx("div",{className:"shrink-0 border-t border-border p-3",children:t.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-2 py-2",children:[t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-semibold text-muted-foreground",children:i.slice(0,2).toUpperCase()}),t.jsx("span",{className:"flex-1 truncate text-xs text-muted-foreground",children:i})]})})]})}function Mt(){const{t:e}=b(),o=S(),[a,s]=r.useState(!1),{authEnabled:n,username:i,logout:l}=D(),[d,u]=r.useState(!1);r.useEffect(()=>{s(!1)},[o.pathname]);const c=r.useMemo(()=>Pt(o.pathname),[o.pathname]),m=e(c.nav.labelKey),p=e(c.nav.descriptionKey),y=async()=>{if(!d){u(!0);try{await l()}finally{u(!1)}}};return t.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[t.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-4 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground",children:e("app.skipToContent")}),t.jsx("aside",{className:"hidden w-16 shrink-0 flex-col border-r border-border bg-card md:flex lg:hidden",children:t.jsx(R,{compact:!0})}),t.jsx("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-border bg-card lg:flex",children:t.jsx(R,{})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsxs("header",{className:"sticky top-0 z-30 flex h-16 shrink-0 items-center justify-between gap-4 border-b border-border bg-card px-4 lg:px-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(x,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>s(P=>!P),"aria-label":e(a?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":a,"aria-controls":"mobile-nav",children:a?t.jsx(Se,{className:"h-5 w-5"}):t.jsx(De,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),t.jsx("p",{className:"hidden text-xs text-muted-foreground sm:block",children:p})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n&&i&&t.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:e("login.status",{username:i})}),n&&t.jsx(x,{variant:"ghost",size:"sm",onClick:()=>void y(),disabled:d,children:e(d?"common.actions.loading":"common.actions.logout")}),t.jsx(St,{}),t.jsx(Rt,{})]})]}),t.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"mx-auto max-w-7xl px-4 py-6 lg:px-8 lg:py-8 animate-in fade-in slide-in-from-bottom-4 duration-300",children:t.jsx(Me,{})})})]}),a&&t.jsxs("div",{className:"fixed inset-0 z-40 md:hidden",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>s(!1)}),t.jsx("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-64 border-r border-border bg-card shadow-lg animate-in slide-in-from-left duration-200",children:t.jsx(R,{onNavigate:()=>s(!1)})})]})]})}function Ft({children:e}){const{authEnabled:o,isAuthenticated:a,loading:s}=D(),n=S();return s?t.jsx(ne,{}):!o||a?e:t.jsx(W,{to:"/login",replace:!0,state:{from:n}})}function Ot(){return t.jsx(Ft,{children:t.jsx(Mt,{})})}function _t(){return t.jsx(Fe,{basename:Tt(),children:t.jsx(r.Suspense,{fallback:t.jsx(ne,{}),children:t.jsxs(Oe,{children:[t.jsx(T,{path:"/",element:t.jsx(Ot,{}),children:ie.map(e=>{const o=e.element;return e.index?t.jsx(T,{index:!0,element:t.jsx(o,{})},"index"):t.jsx(T,{path:e.path.slice(1),element:t.jsx(o,{})},e.path)})}),bt.map(e=>{const o=e.element;return t.jsx(T,{path:e.path,element:t.jsx(o,{})},e.path)}),t.jsx(T,{path:"*",element:t.jsx(W,{to:"/",replace:!0})})]})})})}function Kt(){return t.jsx(rt,{children:t.jsx(_t,{})})}const ce=document.getElementById("root");if(!ce)throw new Error("Root element #root not found");Le.createRoot(ce).render(t.jsx(qe.StrictMode,{children:t.jsx(Kt,{})}));export{x as B,ne as L,Dt as T,Ze as a,g as b,h as c,$t as d,Lt as e,qt as f,de as g,v as h,D as i,nt as r,A as s,I as t,Gt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as s}from"./vendor-CjJPKsTb.js";import{c as n}from"./index-
|
|
1
|
+
import{r as i,j as s}from"./vendor-CjJPKsTb.js";import{c as n}from"./index-BiTh8byX.js";const l=i.forwardRef(({className:e,type:r,...o},t)=>s.jsx("input",{type:r,className:n("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:t,...o}));l.displayName="Input";export{l as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as r}from"./vendor-CjJPKsTb.js";import{c as t}from"./index-
|
|
1
|
+
import{r as o,j as r}from"./vendor-CjJPKsTb.js";import{c as t}from"./index-BiTh8byX.js";const l=o.forwardRef(({className:e,...a},s)=>r.jsx("label",{ref:s,className:t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...a}));l.displayName="Label";export{l as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as o}from"./vendor-CjJPKsTb.js";import{l as n,m,n as p,o as t}from"./radix-54BMi3RD.js";import{c as l}from"./index-
|
|
1
|
+
import{r as i,j as o}from"./vendor-CjJPKsTb.js";import{l as n,m,n as p,o as t}from"./radix-54BMi3RD.js";import{c as l}from"./index-BiTh8byX.js";const x=n,b=m,f=i.forwardRef(({className:a,align:e="center",sideOffset:s=4,...r},d)=>o.jsx(p,{children:o.jsx(t,{ref:d,align:e,sideOffset:s,className:l("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));f.displayName=t.displayName;export{x as P,b as a,f as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e,al as d,a2 as w,ak as N}from"./vendor-CjJPKsTb.js";import{r as g,V as j,s as n,t as b,u as S,v as i,w as v,x as c,y as R,z as C,A as m,B as p,D as f,E as u}from"./radix-54BMi3RD.js";import{c as o}from"./index-
|
|
1
|
+
import{r,j as e,al as d,a2 as w,ak as N}from"./vendor-CjJPKsTb.js";import{r as g,V as j,s as n,t as b,u as S,v as i,w as v,x as c,y as R,z as C,A as m,B as p,D as f,E as u}from"./radix-54BMi3RD.js";import{c as o}from"./index-BiTh8byX.js";const U=g,L=j,I=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(n,{ref:l,className:o("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(b,{asChild:!0,children:e.jsx(d,{className:"h-4 w-4 opacity-50"})})]}));I.displayName=n.displayName;const x=r.forwardRef(({className:t,...s},a)=>e.jsx(m,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(N,{className:"h-4 w-4"})}));x.displayName=m.displayName;const h=r.forwardRef(({className:t,...s},a)=>e.jsx(p,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(d,{className:"h-4 w-4"})}));h.displayName=p.displayName;const B=r.forwardRef(({className:t,children:s,position:a="popper",...l},y)=>e.jsx(S,{children:e.jsxs(i,{ref:y,className:o("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...l,children:[e.jsx(x,{}),e.jsx(v,{className:o("p-2",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(h,{})]})}));B.displayName=i.displayName;const k=r.forwardRef(({className:t,...s},a)=>e.jsx(f,{ref:a,className:o("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));k.displayName=f.displayName;const z=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(c,{ref:l,className:o("relative flex w-full cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(R,{children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx(C,{children:s})]}));z.displayName=c.displayName;const D=r.forwardRef(({className:t,...s},a)=>e.jsx(u,{ref:a,className:o("-mx-1 my-1 h-px bg-muted",t),...s}));D.displayName=u.displayName;export{U as S,I as a,L as b,B as c,z as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e}from"./vendor-CjJPKsTb.js";import{p as r,q as n}from"./radix-54BMi3RD.js";import{c as s}from"./index-
|
|
1
|
+
import{r as i,j as e}from"./vendor-CjJPKsTb.js";import{p as r,q as n}from"./radix-54BMi3RD.js";import{c as s}from"./index-BiTh8byX.js";const c=i.forwardRef(({className:a,...t},o)=>e.jsx(r,{className:s("peer inline-flex h-7 w-12 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-[inset_0_0_0_1px_rgba(15,23,42,0.06)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...t,ref:o,children:e.jsx(n,{className:s("pointer-events-none block h-6 w-6 rounded-full bg-background shadow-[0_3px_10px_rgba(15,23,42,0.18)] ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));c.displayName=r.displayName;export{c as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aC as o}from"./vendor-CjJPKsTb.js";import{a as u}from"./query-D3IfCUhp.js";import{r as s,t as i}from"./index-
|
|
1
|
+
import{aC as o}from"./vendor-CjJPKsTb.js";import{a as u}from"./query-D3IfCUhp.js";import{r as s,t as i}from"./index-BiTh8byX.js";function m(r,e,a){return u({queryKey:r,placeholderData:o,...a,queryFn:async()=>{try{return await s(e)}catch(t){throw i(t)}}})}export{m as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a}from"./vendor-CjJPKsTb.js";import{D as h,A as D,a as g,b as A,c as w,d as C,e as y}from"./DialogShell-
|
|
1
|
+
import{j as a}from"./vendor-CjJPKsTb.js";import{D as h,A as D,a as g,b as A,c as w,d as C,e as y}from"./DialogShell-BKB8x8Yv.js";import{B as f,u as B,t as N}from"./index-BiTh8byX.js";import{u as b,b as k}from"./query-D3IfCUhp.js";function v({open:p,onOpenChange:n,title:l,description:i,confirmLabel:o,cancelLabel:e,onConfirm:x,loading:u=!1,confirmVariant:m="destructive",children:t}){return a.jsx(h,{open:p,onOpenChange:n,children:a.jsxs(D,{className:"max-w-md",children:[a.jsxs(g,{children:[a.jsx(A,{children:l}),i?a.jsx(w,{children:i}):null]}),a.jsx(C,{className:"space-y-4",children:t?a.jsx("div",{className:"text-sm text-muted-foreground",children:t}):null}),a.jsxs(y,{children:[a.jsx(f,{variant:"outline",onClick:()=>n(!1),disabled:u,children:e}),a.jsx(f,{variant:m,onClick:()=>void x(),disabled:u,children:o})]})]})})}function H({mutationFn:p,successToast:n,errorToast:l,invalidateKeys:i,onSuccess:o,onError:e,...x}){const u=b(),{pushToast:m}=B();return k({...x,mutationFn:async t=>{try{return await p(t)}catch(s){throw N(s)}},onSuccess:async(t,s,c,d)=>{i!=null&&i.length&&await Promise.all(i.map(j=>u.invalidateQueries({queryKey:j})));const r=n==null?void 0:n(t,s);r&&m({...r,variant:"success"}),await(o==null?void 0:o(t,s,c,d))},onError:async(t,s,c,d)=>{const r=l==null?void 0:l(t,s);r&&m({...r,variant:"error"}),await(e==null?void 0:e(t,s,c,d))}})}export{v as C,H as u};
|
package/src/web/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
|
|
6
6
|
<meta name="format-detection" content="telephone=no" />
|
|
7
7
|
<title>cc-gw 控制台</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BiTh8byX.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vendor-CjJPKsTb.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/query-D3IfCUhp.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/i18n-CfLThlXq.js">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as e,ab as P,aA as T,aB as u,aj as B,Z as R}from"./vendor-CjJPKsTb.js";import{P as q}from"./PageHeader-KQ9mjVAV.js";import{P as m}from"./PageSection-C9Wb9Oe3.js";import{P as A,a as C}from"./PageState-D-1-sNyq.js";import{u as I}from"./useApiQuery-Bcqr7uHV.js";import{u as V,B as p}from"./index-MqPrlTQ4.js";import{q as F}from"./queryKeys-BMvyDTQS.js";import{B as o}from"./badge-3ORqzzzc.js";import{C as l,a as n}from"./card-D1l7si2X.js";import{u as G}from"./i18n-CfLThlXq.js";import"./query-D3IfCUhp.js";import"./router-CmaL1NgV.js";import"./radix-54BMi3RD.js";const z="0.8.0-beta.2",M={version:z};function ae(){var b,h,f,j,v,g,N,y,w,k;const{t:a}=G(),{pushToast:s}=V(),t=I(F.status.gateway(),{url:"/api/status",method:"GET"},{staleTime:6e4});c.useEffect(()=>{t.isError&&t.error&&s({title:a("about.toast.statusError.title"),description:t.error.message,variant:"error"})},[s,t.error,t.isError,a]);const i=M.version,d="2026-03-23T11:39:19.198Z",L=c.useMemo(()=>{var r,S;return[{label:a("about.app.labels.name"),value:e.jsx("span",{className:"font-mono",children:"cc-gw"})},{label:a("about.app.labels.version"),value:e.jsxs("span",{"data-visual-volatile":"true",className:"font-mono text-primary",children:["v",i]})},{label:a("about.app.labels.buildTime"),value:e.jsx("span",{"data-visual-volatile":"true",children:d}),hint:a("about.app.hint.buildTime")},{label:a("about.app.labels.runtime"),value:e.jsx("span",{className:"font-mono",children:((r=t.data)==null?void 0:r.runtime)??"rust"})},{label:a("about.app.labels.backendVersion"),value:e.jsx("span",{"data-visual-volatile":"true",className:"font-mono",children:((S=t.data)==null?void 0:S.backendVersion)??"-"})}]},[i,d,(b=t.data)==null?void 0:b.backendVersion,(h=t.data)==null?void 0:h.runtime,a]),x=c.useMemo(()=>{var r;return t.data?[{label:a("about.status.labels.host"),value:t.data.host??"127.0.0.1"},{label:a("about.status.labels.port"),value:e.jsx("span",{"data-visual-volatile":"true",children:t.data.port.toLocaleString()})},{label:a("about.status.labels.providers"),value:t.data.providers.toLocaleString()},{label:a("about.status.labels.active"),value:(t.data.activeRequests??0).toLocaleString(),hint:a("about.status.hint.active")},{label:a("about.status.labels.platform"),value:t.data.platform??"-"},{label:a("about.status.labels.pid"),value:e.jsx("span",{"data-visual-volatile":"true",children:((r=t.data.pid)==null?void 0:r.toLocaleString())??"-"})}]:[]},[t.data,a]);return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(q,{icon:e.jsx(T,{className:"h-5 w-5","aria-hidden":"true"}),title:a("about.title"),description:a("about.description"),badge:e.jsxs("span",{"data-visual-volatile":"true",children:["v",i]}),eyebrow:"Runtime",breadcrumb:"Gateway / About",helper:a("about.support.description"),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("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2 text-xs text-muted-foreground",children:"manual refresh only"}),e.jsxs(p,{onClick:()=>s({title:a("about.toast.updatesPlanned"),variant:"info"}),className:"w-full sm:w-auto",children:[e.jsx(P,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),a("about.support.actions.checkUpdates")]})]})}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.3fr)_minmax(320px,0.9fr)]",children:[e.jsx(l,{className:"overflow-hidden",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/20 bg-accent px-3 py-1 text-xs font-semibold uppercase tracking-wider text-primary",children:[e.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Runtime snapshot"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{"data-visual-volatile":"true",className:"text-3xl font-semibold tracking-tight text-foreground",children:[((f=t.data)==null?void 0:f.host)??"127.0.0.1",":",((j=t.data)==null?void 0:j.port)??"-"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("about.description")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(o,{variant:"outline",children:((v=t.data)==null?void 0:v.runtime)??"rust"}),e.jsx(o,{variant:"outline",children:((g=t.data)==null?void 0:g.platform)??"-"}),e.jsxs(o,{variant:"secondary",children:[a("about.status.labels.providers"),": ",((y=(N=t.data)==null?void 0:N.providers)==null?void 0:y.toLocaleString())??"-"]}),e.jsxs(o,{variant:"secondary",children:[a("about.status.labels.active"),": ",(((w=t.data)==null?void 0:w.activeRequests)??0).toLocaleString()]})]})]})})}),e.jsx(l,{className:"overflow-hidden",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Build"}),e.jsxs("p",{"data-visual-volatile":"true",className:"font-mono text-lg text-primary",children:["v",i]}),e.jsx("p",{"data-visual-volatile":"true",className:"text-sm text-muted-foreground",children:d}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 text-sm text-muted-foreground",children:a("about.support.tip")})]})})})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(m,{title:a("about.app.title"),description:a("about.app.subtitle"),children:e.jsx(E,{items:L})}),e.jsx(m,{title:a("about.status.title"),description:a("about.status.subtitle"),actions:e.jsxs(p,{variant:"outline",size:"sm",onClick:()=>void t.refetch(),disabled:t.isFetching,children:[e.jsx(B,{className:Q(t.isFetching),"aria-hidden":"true"}),t.isFetching?a("common.actions.refreshing"):a("common.actions.refresh")]}),children:t.isLoading?e.jsx(A,{compact:!0,label:a("about.status.loading")}):t.isError?e.jsx(C,{compact:!0,tone:"danger",icon:e.jsx(u,{className:"h-5 w-5","aria-hidden":"true"}),title:a("common.status.error"),description:((k=t.error)==null?void 0:k.message)??a("common.unknownError"),action:e.jsx(p,{variant:"outline",size:"sm",onClick:()=>void t.refetch(),children:a("common.actions.refresh")})}):x.length>0?e.jsx(E,{items:x}):e.jsx(C,{compact:!0,tone:"primary",icon:e.jsx(u,{className:"h-5 w-5","aria-hidden":"true"}),title:a("about.status.empty"),description:a("common.actions.refresh")})})]}),e.jsx(m,{title:a("about.support.title"),description:e.jsxs("span",{className:"space-y-1",children:[e.jsx("span",{className:"block text-sm font-medium text-primary",children:a("about.support.subtitle")}),e.jsx("span",{children:a("about.support.description")})]}),children:e.jsx(l,{children:e.jsxs(n,{className:"flex flex-col gap-4 pt-5 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(R,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:a("about.support.tip")})]}),e.jsx("code",{className:"inline-flex self-start rounded-lg border border-border bg-secondary px-3 py-2 text-xs font-medium",children:"~/.cc-gw/config.json"})]})})})]})}function E({items:a}){return a.length===0?null:e.jsx("dl",{className:"grid gap-4 sm:grid-cols-2",children:a.map(s=>e.jsx(l,{children:e.jsxs(n,{className:"pt-5",children:[e.jsx("dt",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:s.label}),e.jsx("dd",{className:"mt-2 text-sm font-semibold text-foreground",children:s.value}),s.hint?e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.hint}):null]})},s.label))})}function Q(a){return`mr-2 h-4 w-4${a?" animate-spin":""}`}export{ae as default};
|