jishushell 0.4.30 → 0.5.22
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/Dockerfile.hermes-slim +2 -5
- package/apps/anythingllm-container.yaml +287 -0
- package/apps/browserless-chromium-container.yaml +18 -6
- package/apps/filebrowser-container.yaml +164 -0
- package/apps/ollama-binary.yaml +44 -0
- package/apps/ollama-with-hollama-binary.yaml +45 -1
- package/apps/openclaw-binary.yaml +8 -0
- package/apps/openclaw-container.yaml +9 -1
- package/apps/openclaw-with-searxng-container.yaml +4 -0
- package/apps/searxng-container.yaml +5 -4
- package/apps/weknora-container.yaml +471 -0
- package/dist/cli/doctor.js +144 -16
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/panel.js.map +1 -1
- package/dist/config.d.ts +19 -0
- package/dist/config.js +99 -1
- package/dist/config.js.map +1 -1
- package/dist/install.js +4 -4
- package/dist/install.js.map +1 -1
- package/dist/routes/auth.js +2 -2
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/backup.js +64 -11
- package/dist/routes/backup.js.map +1 -1
- package/dist/routes/external-mounts.d.ts +17 -0
- package/dist/routes/external-mounts.js +73 -0
- package/dist/routes/external-mounts.js.map +1 -0
- package/dist/routes/file-mounts.d.ts +13 -0
- package/dist/routes/file-mounts.js +90 -0
- package/dist/routes/file-mounts.js.map +1 -0
- package/dist/routes/files-organize.d.ts +28 -0
- package/dist/routes/files-organize.js +167 -0
- package/dist/routes/files-organize.js.map +1 -0
- package/dist/routes/files.d.ts +31 -0
- package/dist/routes/files.js +321 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/instances.js +87 -12
- package/dist/routes/instances.js.map +1 -1
- package/dist/routes/internal.d.ts +2 -0
- package/dist/routes/internal.js +59 -0
- package/dist/routes/internal.js.map +1 -0
- package/dist/routes/llm.js +29 -0
- package/dist/routes/llm.js.map +1 -1
- package/dist/routes/setup.js +9 -9
- package/dist/routes/setup.js.map +1 -1
- package/dist/routes/system.js +1 -1
- package/dist/routes/system.js.map +1 -1
- package/dist/routes/webdav.d.ts +17 -0
- package/dist/routes/webdav.js +114 -0
- package/dist/routes/webdav.js.map +1 -0
- package/dist/server.js +358 -6
- package/dist/server.js.map +1 -1
- package/dist/services/agent-apps/catalog.d.ts +3 -0
- package/dist/services/agent-apps/catalog.js +40 -13
- package/dist/services/agent-apps/catalog.js.map +1 -1
- package/dist/services/agent-apps/installers/shell-script.d.ts +1 -1
- package/dist/services/agent-apps/installers/shell-script.js +19 -2
- package/dist/services/agent-apps/installers/shell-script.js.map +1 -1
- package/dist/services/agent-apps/types.d.ts +3 -0
- package/dist/services/app/app-compiler.d.ts +1 -1
- package/dist/services/app/app-compiler.js +5 -5
- package/dist/services/app/app-compiler.js.map +1 -1
- package/dist/services/app/app-manager.d.ts +9 -0
- package/dist/services/app/app-manager.js +248 -43
- package/dist/services/app/app-manager.js.map +1 -1
- package/dist/services/app/custom-manager.js.map +1 -1
- package/dist/services/app/hermes-agent-manager.js +1 -0
- package/dist/services/app/hermes-agent-manager.js.map +1 -1
- package/dist/services/app/ollama-manager.js +1 -1
- package/dist/services/app/ollama-manager.js.map +1 -1
- package/dist/services/app/openclaw-manager.js +37 -5
- package/dist/services/app/openclaw-manager.js.map +1 -1
- package/dist/services/app/platform-transform.d.ts +32 -0
- package/dist/services/app/platform-transform.js +65 -0
- package/dist/services/app/platform-transform.js.map +1 -0
- package/dist/services/app-passwords.d.ts +61 -0
- package/dist/services/app-passwords.js +173 -0
- package/dist/services/app-passwords.js.map +1 -0
- package/dist/services/backup-manager.d.ts +11 -0
- package/dist/services/backup-manager.js +220 -8
- package/dist/services/backup-manager.js.map +1 -1
- package/dist/services/capability-endpoint-validator.js +26 -7
- package/dist/services/capability-endpoint-validator.js.map +1 -1
- package/dist/services/connection-apply.d.ts +2 -0
- package/dist/services/connection-apply.js +55 -1
- package/dist/services/connection-apply.js.map +1 -1
- package/dist/services/connection-resolver.js +1 -1
- package/dist/services/connection-resolver.js.map +1 -1
- package/dist/services/connection-transactor.d.ts +2 -0
- package/dist/services/connection-transactor.js +12 -2
- package/dist/services/connection-transactor.js.map +1 -1
- package/dist/services/external-mounts.d.ts +40 -0
- package/dist/services/external-mounts.js +187 -0
- package/dist/services/external-mounts.js.map +1 -0
- package/dist/services/files-manager.d.ts +252 -0
- package/dist/services/files-manager.js +1075 -0
- package/dist/services/files-manager.js.map +1 -0
- package/dist/services/files-mounts.d.ts +42 -0
- package/dist/services/files-mounts.js +207 -0
- package/dist/services/files-mounts.js.map +1 -0
- package/dist/services/instance-manager.js +90 -32
- package/dist/services/instance-manager.js.map +1 -1
- package/dist/services/llm-proxy/index.d.ts +28 -0
- package/dist/services/llm-proxy/index.js +76 -3
- package/dist/services/llm-proxy/index.js.map +1 -1
- package/dist/services/llm-proxy/ssrf.js +6 -2
- package/dist/services/llm-proxy/ssrf.js.map +1 -1
- package/dist/services/llm-proxy/validate-key.d.ts +41 -0
- package/dist/services/llm-proxy/validate-key.js +672 -0
- package/dist/services/llm-proxy/validate-key.js.map +1 -0
- package/dist/services/macos-launchd.d.ts +89 -0
- package/dist/services/macos-launchd.js +273 -0
- package/dist/services/macos-launchd.js.map +1 -0
- package/dist/services/nomad-manager.d.ts +11 -0
- package/dist/services/nomad-manager.js +343 -98
- package/dist/services/nomad-manager.js.map +1 -1
- package/dist/services/organize/applier.d.ts +46 -0
- package/dist/services/organize/applier.js +218 -0
- package/dist/services/organize/applier.js.map +1 -0
- package/dist/services/organize/rules.d.ts +57 -0
- package/dist/services/organize/rules.js +286 -0
- package/dist/services/organize/rules.js.map +1 -0
- package/dist/services/organize/scanner.d.ts +50 -0
- package/dist/services/organize/scanner.js +366 -0
- package/dist/services/organize/scanner.js.map +1 -0
- package/dist/services/organize/store.d.ts +14 -0
- package/dist/services/organize/store.js +82 -0
- package/dist/services/organize/store.js.map +1 -0
- package/dist/services/panel-manager.js +40 -11
- package/dist/services/panel-manager.js.map +1 -1
- package/dist/services/process-manager.js +3 -2
- package/dist/services/process-manager.js.map +1 -1
- package/dist/services/runtime/adapters/custom.js +56 -0
- package/dist/services/runtime/adapters/custom.js.map +1 -1
- package/dist/services/runtime/adapters/hermes.d.ts +4 -3
- package/dist/services/runtime/adapters/hermes.js +166 -64
- package/dist/services/runtime/adapters/hermes.js.map +1 -1
- package/dist/services/runtime/adapters/openclaw-routes.d.ts +8 -2
- package/dist/services/runtime/adapters/openclaw-routes.js +68 -0
- package/dist/services/runtime/adapters/openclaw-routes.js.map +1 -1
- package/dist/services/runtime/adapters/openclaw.d.ts +118 -0
- package/dist/services/runtime/adapters/openclaw.js +1459 -49
- package/dist/services/runtime/adapters/openclaw.js.map +1 -1
- package/dist/services/runtime/instance.d.ts +1 -1
- package/dist/services/runtime/instance.js +1 -1
- package/dist/services/runtime/instance.js.map +1 -1
- package/dist/services/runtime/mcp-shims/anythingllm-shim.d.ts +46 -0
- package/dist/services/runtime/mcp-shims/anythingllm-shim.js +281 -0
- package/dist/services/runtime/mcp-shims/anythingllm-shim.js.map +1 -0
- package/dist/services/runtime/mcp-shims/drive-shim.d.ts +54 -0
- package/dist/services/runtime/mcp-shims/drive-shim.js +489 -0
- package/dist/services/runtime/mcp-shims/drive-shim.js.map +1 -0
- package/dist/services/runtime/types.d.ts +31 -0
- package/dist/services/setup-manager.js +190 -68
- package/dist/services/setup-manager.js.map +1 -1
- package/dist/services/suggestions.js.map +1 -1
- package/dist/services/update-manager.js +32 -14
- package/dist/services/update-manager.js.map +1 -1
- package/dist/services/webdav/server.d.ts +24 -0
- package/dist/services/webdav/server.js +420 -0
- package/dist/services/webdav/server.js.map +1 -0
- package/dist/services/webdav/xml-builder.d.ts +73 -0
- package/dist/services/webdav/xml-builder.js +156 -0
- package/dist/services/webdav/xml-builder.js.map +1 -0
- package/dist/services/workspace-builder.d.ts +29 -0
- package/dist/services/workspace-builder.js +188 -0
- package/dist/services/workspace-builder.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/utils/path-locks.d.ts +30 -0
- package/dist/utils/path-locks.js +63 -0
- package/dist/utils/path-locks.js.map +1 -0
- package/dist/utils/path-safety.d.ts +41 -0
- package/dist/utils/path-safety.js +119 -0
- package/dist/utils/path-safety.js.map +1 -0
- package/dist/utils/safe-write.d.ts +24 -0
- package/dist/utils/safe-write.js +82 -0
- package/dist/utils/safe-write.js.map +1 -0
- package/install/jishu-install.sh +247 -35
- package/install/jishu-uninstall.sh +45 -5
- package/package.json +20 -2
- package/public/assets/ApiKeyField-CvyAOcJS.js +1 -0
- package/public/assets/Dashboard-AuJESBlJ.js +1 -0
- package/public/assets/{HermesChatPanel-_GHoklgo.js → HermesChatPanel-CByPREwb.js} +1 -1
- package/public/assets/HermesConfigForm-DRda8FKX.js +4 -0
- package/public/assets/InitPassword-ka4wNpM5.js +1 -0
- package/public/assets/InstanceDetail-Cg1nS8HX.js +92 -0
- package/public/assets/Login-aPajuQzf.js +1 -0
- package/public/assets/NewInstance-Dd1ebNIx.js +1 -0
- package/public/assets/ProviderRecommendations-DFmADQ7V.js +1 -0
- package/public/assets/Settings-BYQnbLYL.js +1 -0
- package/public/assets/Setup-D05lwDOV.js +1 -0
- package/public/assets/WeixinLoginPanel-D89kdhP4.js +9 -0
- package/public/assets/index-HSXCsceK.css +1 -0
- package/public/assets/index-bnBu0nlQ.js +19 -0
- package/public/assets/registry-C_qeFTkZ.js +2 -0
- package/public/assets/usePolling-Bn93fe7M.js +1 -0
- package/public/assets/{vendor-i18n-ucpM0OR0.js → vendor-i18n-flxcMVeP.js} +2 -2
- package/public/assets/{vendor-react-Bk1hRGiY.js → vendor-react-ZC5T_huj.js} +7 -7
- package/public/index.html +4 -4
- package/scripts/check-app-spec.mjs +18 -4
- package/scripts/check-colima-launchd.mjs +230 -0
- package/scripts/check-new-file-tests.mjs +230 -0
- package/scripts/check-quarantine-expiry.mjs +105 -0
- package/scripts/perf/README.md +49 -0
- package/scripts/perf/auth.js +99 -0
- package/scripts/perf/config.js +63 -0
- package/scripts/perf/instances.js +143 -0
- package/scripts/perf/proxy.js +96 -0
- package/scripts/smoke/files-w1.sh +142 -0
- package/scripts/smoke-backend.mjs +122 -0
- package/scripts/smoke-post-publish.mjs +346 -0
- package/public/assets/Dashboard-rkWp-CXd.js +0 -1
- package/public/assets/HermesConfigForm-anDnwUp_.js +0 -4
- package/public/assets/InitPassword-ZU9_-hDr.js +0 -1
- package/public/assets/InstanceDetail-CN0FH1aw.js +0 -92
- package/public/assets/Login-BItXqYAJ.js +0 -1
- package/public/assets/NewInstance-BousE6kY.js +0 -1
- package/public/assets/ProviderRecommendations-DFYj7Fb6.js +0 -1
- package/public/assets/Settings-Bttc6QmM.js +0 -1
- package/public/assets/Setup-Bsxx1zgj.js +0 -1
- package/public/assets/WeixinLoginPanel-DPZpAKgO.js +0 -9
- package/public/assets/index-8xZy1z5k.css +0 -1
- package/public/assets/index-Dw3HhUYE.js +0 -19
- package/public/assets/input-paste-CrNVAyOy.js +0 -1
- package/public/assets/providers-DtNXh9JD.js +0 -1
- package/public/assets/registry-5s2UB6is.js +0 -2
- package/public/assets/usePolling-Do5Erqm_.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jishushell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.22",
|
|
4
4
|
"description": "JishuShell - Multi-Agent Framework Management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"build": "npm install && tsc && cd frontend && npm install && npm run build",
|
|
24
24
|
"build:backend": "npm install && tsc",
|
|
25
25
|
"build:frontend": "cd frontend && npm install && npm run build",
|
|
26
|
+
"compile": "npm run compile:backend && npm --prefix frontend run build",
|
|
27
|
+
"compile:backend": "tsc",
|
|
28
|
+
"lint": "npx biome check .",
|
|
29
|
+
"lint:fix": "npx biome check --fix .",
|
|
26
30
|
"start": "node dist/cli.js serve",
|
|
27
31
|
"dev": "tsc --watch",
|
|
28
32
|
"test": "vitest run",
|
|
@@ -33,15 +37,21 @@
|
|
|
33
37
|
"test:watch": "vitest",
|
|
34
38
|
"test:coverage": "vitest run --coverage",
|
|
35
39
|
"test:ci": "npm run check:contracts && npm run build:backend && vitest run --coverage && cd frontend && npm install && npm run test",
|
|
40
|
+
"check:quarantine": "node scripts/check-quarantine-expiry.mjs",
|
|
41
|
+
"test:changed": "vitest run --changed",
|
|
42
|
+
"test:mutation": "stryker run",
|
|
43
|
+
"test:ci:backend": "vitest run --coverage --reporter=default --reporter=junit --outputFile.junit=test-results/backend-junit.xml",
|
|
44
|
+
"test:ci:frontend": "npm --prefix frontend run test -- --reporter=default --reporter=junit --outputFile.junit=test-results/frontend-junit.xml",
|
|
36
45
|
"test:ci:full": "npm run test:ci && vitest run --config vitest.e2e-real.config.ts",
|
|
37
46
|
"prepublishOnly": "npm run build && chmod +x dist/cli.js",
|
|
38
47
|
"postinstall": "bash install/post-install.sh",
|
|
39
48
|
"preuninstall": "bash install/post-uninstall.sh",
|
|
40
49
|
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
|
|
41
50
|
"build:pack": "npm run build && npm pack",
|
|
42
|
-
"check:contracts": "node --experimental-strip-types scripts/check-adapter-isolation.ts",
|
|
51
|
+
"check:contracts": "node --experimental-strip-types scripts/check-adapter-isolation.ts && node scripts/check-colima-launchd.mjs",
|
|
43
52
|
"check:i18n": "node scripts/check-i18n.mjs",
|
|
44
53
|
"check:app-spec": "node scripts/check-app-spec.mjs",
|
|
54
|
+
"check:new-file-tests": "node scripts/check-new-file-tests.mjs",
|
|
45
55
|
"version": "node -e \"const fs=require('fs'),v=JSON.parse(fs.readFileSync('./package.json','utf8')).version,fp='./frontend/package.json',p=JSON.parse(fs.readFileSync(fp,'utf8'));p.version=v;fs.writeFileSync(fp,JSON.stringify(p,null,2)+'\\n')\" && git add frontend/package.json"
|
|
46
56
|
},
|
|
47
57
|
"engines": {
|
|
@@ -64,12 +74,20 @@
|
|
|
64
74
|
"@fastify/static": "^8.1.0",
|
|
65
75
|
"@noble/hashes": "^2.0.1",
|
|
66
76
|
"bcryptjs": "^2.4.3",
|
|
77
|
+
"exifr": "^7.1.3",
|
|
67
78
|
"fastify": "^5.2.0",
|
|
68
79
|
"jsonwebtoken": "^9.0.2",
|
|
69
80
|
"systeminformation": "^5.23.0",
|
|
70
81
|
"yaml": "^2.8.3"
|
|
71
82
|
},
|
|
83
|
+
"optionalDependencies": {
|
|
84
|
+
"macos-temperature-sensor": "^1.0.4"
|
|
85
|
+
},
|
|
72
86
|
"devDependencies": {
|
|
87
|
+
"@biomejs/biome": "^2.4.14",
|
|
88
|
+
"@stryker-mutator/core": "^9.6.1",
|
|
89
|
+
"@stryker-mutator/typescript-checker": "^9.6.1",
|
|
90
|
+
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
73
91
|
"@types/bcryptjs": "^2.4.6",
|
|
74
92
|
"@types/jsonwebtoken": "^9.0.7",
|
|
75
93
|
"@types/node": "^22.19.15",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a5 as e,a as j,b as E,g as Q,f as O,aG as A}from"./index-bnBu0nlQ.js";import{c as i}from"./vendor-react-ZC5T_huj.js";import{u as U}from"./vendor-i18n-flxcMVeP.js";const ee=[{providerId:"zhipu",label:"GLM",purchaseUrl:"https://bigmodel.cn/glm-coding"},{providerId:"moonshot",label:"Kimi",purchaseUrl:"https://www.kimi.com/membership/pricing?from=kfc_membership_topbar"},{providerId:"deepseek",label:"DeepSeek",purchaseUrl:"https://platform.deepseek.com/sign_in"},{providerId:"minimax",label:"MiniMax",purchaseUrl:"https://platform.minimaxi.com/subscribe/token-plan"},{providerId:"stepfun",label:"阶跃星辰",purchaseUrl:"https://platform.stepfun.com/step-plan"},{providerId:"xiaomi",label:"小米Mimo",purchaseUrl:"https://platform.xiaomimimo.com/token-plan"}],ne=[{id:"minimax",label:"MiniMax (国内)",group:"国内厂商",baseUrl:"https://api.minimaxi.com/v1",api:"openai-completions",models:[{id:"MiniMax-M2.7",name:"MiniMax M2.7",contextWindow:204800},{id:"MiniMax-M2.7-highspeed",name:"MiniMax M2.7 Highspeed",contextWindow:204800}]},{id:"minimax-intl",label:"MiniMax (国际)",group:"国际厂商",baseUrl:"https://api.minimax.io/anthropic",api:"anthropic-messages",authHeader:!0,models:[{id:"MiniMax-M2.7",name:"MiniMax M2.7",contextWindow:204800},{id:"MiniMax-M2.7-highspeed",name:"MiniMax M2.7 Highspeed",contextWindow:204800}]},{id:"moonshot",label:"Kimi (Moonshot)",group:"国内厂商",baseUrl:"https://api.moonshot.cn/v1",api:"openai-completions",models:[{id:"kimi-k2.5",name:"Kimi K2.5",contextWindow:256e3},{id:"moonshot-v1-128k",name:"Moonshot V1 128K",contextWindow:128e3},{id:"moonshot-v1-32k",name:"Moonshot V1 32K",contextWindow:32e3},{id:"moonshot-v1-8k",name:"Moonshot V1 8K",contextWindow:8e3}]},{id:"moonshot-coding",label:"Kimi (编码计划)",group:"国内厂商",baseUrl:"https://api.moonshot.cn/anthropic",api:"anthropic-messages",authHeader:!0,models:[{id:"kimi-k2.5",name:"Kimi K2.5",contextWindow:256e3},{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",contextWindow:256e3},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",contextWindow:256e3},{id:"kimi-k2-0905-preview",name:"Kimi K2 0905 Preview",contextWindow:256e3},{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo Preview",contextWindow:256e3}]},{id:"moonshot-intl",label:"Kimi (国际)",group:"国际厂商",baseUrl:"https://api.moonshot.ai/v1",api:"openai-completions",models:[{id:"kimi-k2.5",name:"Kimi K2.5",contextWindow:256e3},{id:"moonshot-v1-128k",name:"Moonshot V1 128K",contextWindow:128e3}]},{id:"zhipu",label:"智谱AI (GLM)",group:"国内厂商",baseUrl:"https://open.bigmodel.cn/api/paas/v4",api:"openai-completions",models:[{id:"glm-5.1",name:"GLM-5.1",contextWindow:2e5},{id:"glm-5",name:"GLM-5",contextWindow:2e5},{id:"glm-5-turbo",name:"GLM-5 Turbo",contextWindow:2e5},{id:"glm-4.7",name:"GLM-4.7",contextWindow:2e5},{id:"glm-4.7-flashx",name:"GLM-4.7 FlashX",contextWindow:2e5},{id:"glm-4.7-flash",name:"GLM-4.7 Flash (免费)",contextWindow:2e5},{id:"glm-4-plus",name:"GLM-4 Plus",contextWindow:128e3},{id:"glm-4-long",name:"GLM-4 Long",contextWindow:1e6}]},{id:"zhipu-intl",label:"Z.AI (GLM)",group:"国际厂商",baseUrl:"https://api.z.ai/api/paas/v4",api:"openai-completions",models:[{id:"glm-5.1",name:"GLM-5.1",contextWindow:2e5},{id:"glm-5",name:"GLM-5",contextWindow:2e5},{id:"glm-5-turbo",name:"GLM-5 Turbo",contextWindow:2e5},{id:"glm-4.7",name:"GLM-4.7",contextWindow:2e5},{id:"glm-4.7-flash",name:"GLM-4.7 Flash",contextWindow:2e5},{id:"glm-4-plus",name:"GLM-4 Plus",contextWindow:128e3}]},{id:"byteplus",label:"火山引擎国际版 (Doubao)",group:"国际厂商",baseUrl:"https://ark.ap-southeast.bytepluses.com/api/v3",api:"openai-completions",models:[{id:"seed-2-0-lite-260228",name:"Seed 2.0 Lite",contextWindow:256e3},{id:"seed-2-0-mini-260215",name:"Seed 2.0 Mini",contextWindow:256e3},{id:"seed-1-8-251228",name:"Seed 1.8",contextWindow:256e3}]},{id:"deepseek",label:"DeepSeek",group:"国内厂商",baseUrl:"https://api.deepseek.com/v1",api:"openai-completions",models:[{id:"deepseek-chat",name:"DeepSeek V3.2",contextWindow:128e3},{id:"deepseek-reasoner",name:"DeepSeek V3.2 (推理)",contextWindow:128e3}]},{id:"dashscope",label:"阿里云百炼",group:"国内厂商",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode/v1",api:"openai-completions",models:[{id:"qwen3.5-plus",name:"Qwen 3.5 Plus",contextWindow:1e6},{id:"qwen3.5-flash",name:"Qwen 3.5 Flash",contextWindow:1e6},{id:"qwen3-max",name:"Qwen 3 Max",contextWindow:262144},{id:"qwen3-coder-plus",name:"Qwen 3 Coder Plus",contextWindow:1e6},{id:"qwen3-coder-next",name:"Qwen 3 Coder Next",contextWindow:262144},{id:"qwen3-coder-flash",name:"Qwen 3 Coder Flash",contextWindow:1e6},{id:"qwen-plus",name:"Qwen Plus",contextWindow:1e6},{id:"qwen-long",name:"Qwen Long (10M)",contextWindow:1e7}]},{id:"modelstudio",label:"阿里云百炼 (国际/Coding)",group:"国内厂商",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/v1",api:"openai-completions",models:[{id:"qwen3.5-plus",name:"Qwen 3.5 Plus",contextWindow:1e6},{id:"qwen3-coder-plus",name:"Qwen 3 Coder Plus",contextWindow:1e6},{id:"qwen3-coder-next",name:"Qwen 3 Coder Next",contextWindow:262144}]},{id:"volcengine",label:"火山引擎 (豆包)",group:"国内厂商",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",api:"openai-completions",models:[{id:"doubao-seed-2-0-pro-260215",name:"Doubao Seed 2.0 Pro (需替换为接入点ID)",contextWindow:256e3},{id:"doubao-seed-2-0-lite-260228",name:"Doubao Seed 2.0 Lite (需替换为接入点ID)",contextWindow:256e3},{id:"doubao-seed-2-0-code-preview-260215",name:"Doubao Seed 2.0 Code (需替换为接入点ID)",contextWindow:256e3},{id:"doubao-seed-2-0-mini-260215",name:"Doubao Seed 2.0 Mini (需替换为接入点ID)",contextWindow:256e3},{id:"doubao-seed-1-8-251228",name:"Doubao Seed 1.8 (需替换为接入点ID)",contextWindow:256e3}]},{id:"qianfan",label:"百度千帆 (ERNIE)",group:"国内厂商",baseUrl:"https://qianfan.baidubce.com/v2",api:"openai-completions",models:[{id:"ernie-5.0",name:"ERNIE 5.0",contextWindow:128e3},{id:"ernie-5.0-thinking-preview",name:"ERNIE 5.0 Thinking",contextWindow:128e3},{id:"ernie-4.5-turbo-128k",name:"ERNIE 4.5 Turbo (MoE)",contextWindow:128e3},{id:"ernie-x1.1",name:"ERNIE X1.1 (推理)",contextWindow:64e3},{id:"deepseek-v3.2",name:"DeepSeek V3.2 (千帆)",contextWindow:128e3}]},{id:"tencent",label:"腾讯混元",group:"国内厂商",baseUrl:"https://api.hunyuan.cloud.tencent.com/v1",api:"openai-completions",models:[{id:"hunyuan-2.0-thinking-20251109",name:"Hunyuan 2.0 Think (推理)",contextWindow:128e3},{id:"hunyuan-2.0-instruct-20251111",name:"Hunyuan 2.0 Instruct",contextWindow:128e3},{id:"hunyuan-t1-latest",name:"Hunyuan T1 (推理)",contextWindow:32e3},{id:"hunyuan-turbos-latest",name:"Hunyuan TurboS",contextWindow:32e3},{id:"hunyuan-a13b",name:"Hunyuan A13B (MoE)",contextWindow:224e3},{id:"hunyuan-lite",name:"Hunyuan Lite (免费)",contextWindow:25e4}]},{id:"xiaomi",label:"MiMo (小米)",group:"国内厂商",baseUrl:"https://api.xiaomimimo.com/v1",api:"openai-completions",models:[{id:"mimo-v2-pro",name:"MiMo V2 Pro (推理)",contextWindow:1048576},{id:"mimo-v2-omni",name:"MiMo V2 Omni (多模)",contextWindow:262144},{id:"mimo-v2-flash",name:"MiMo V2 Flash",contextWindow:262144}]},{id:"spark",label:"讯飞星火",group:"国内厂商",baseUrl:"https://spark-api-open.xf-yun.com/v1",api:"openai-completions",models:[{id:"spark-x",name:"Spark X1.5 (推理)",contextWindow:32768},{id:"4.0Ultra",name:"Spark 4.0 Ultra",contextWindow:32768},{id:"pro-128k",name:"Spark Pro 128K",contextWindow:131072},{id:"lite",name:"Spark Lite (免费)",contextWindow:8192}]},{id:"stepfun",label:"阶跃星辰",group:"国内厂商",baseUrl:"https://api.stepfun.com/v1",api:"openai-completions",models:[{id:"step-3.5-flash",name:"Step 3.5 Flash (推理)",contextWindow:262144},{id:"step-3",name:"Step 3 (多模推理)",contextWindow:65536},{id:"step-2-mini",name:"Step 2 Mini",contextWindow:32e3},{id:"step-1o-turbo-vision",name:"Step 1o Turbo Vision",contextWindow:32e3},{id:"step-1-256k",name:"Step 1 256K",contextWindow:256e3}]},{id:"openai",label:"OpenAI",group:"国际厂商",baseUrl:"https://api.openai.com/v1",api:"openai-completions",models:[{id:"gpt-5.4",name:"GPT-5.4",contextWindow:105e4},{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",contextWindow:105e4},{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",contextWindow:4e5},{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",contextWindow:4e5},{id:"o3-pro",name:"o3-pro (推理)",contextWindow:2e5},{id:"o3",name:"o3 (推理)",contextWindow:2e5},{id:"o4-mini",name:"o4-mini (推理)",contextWindow:2e5},{id:"gpt-4.1",name:"GPT-4.1",contextWindow:1e6},{id:"gpt-4.1-mini",name:"GPT-4.1 Mini",contextWindow:1e6}]},{id:"anthropic",label:"Anthropic (Claude)",group:"国际厂商",baseUrl:"https://api.anthropic.com",api:"anthropic-messages",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",contextWindow:1e6},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",contextWindow:1e6},{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",contextWindow:2e5}]},{id:"google",label:"Google Gemini",group:"国际厂商",baseUrl:"https://generativelanguage.googleapis.com",api:"google-generative-ai",models:[{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro (Preview)",contextWindow:1048576},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash (Preview)",contextWindow:1048576},{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite (Preview)",contextWindow:1048576},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",contextWindow:1048576},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",contextWindow:1048576}]},{id:"mistral",label:"Mistral AI",group:"国际厂商",baseUrl:"https://api.mistral.ai/v1",api:"openai-completions",models:[{id:"mistral-large-latest",name:"Mistral Large 3",contextWindow:262144},{id:"mistral-small-latest",name:"Mistral Small 4",contextWindow:256e3},{id:"codestral-latest",name:"Codestral (代码)",contextWindow:256e3},{id:"devstral-latest",name:"Devstral 2 (代码Agent)",contextWindow:256e3},{id:"devstral-2-latest",name:"Devstral 2 123B (代码)",contextWindow:256e3},{id:"magistral-medium-latest",name:"Magistral Medium (推理)",contextWindow:4e4}]},{id:"xai",label:"xAI (Grok)",group:"国际厂商",baseUrl:"https://api.x.ai/v1",api:"openai-completions",models:[{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (推理)",contextWindow:2e6},{id:"grok-4-1-fast-reasoning",name:"Grok 4 Fast (推理)",contextWindow:2e6},{id:"grok-4-1-fast-non-reasoning",name:"Grok 4 Fast",contextWindow:2e6},{id:"grok-4",name:"Grok 4",contextWindow:256e3},{id:"grok-code-fast-1",name:"Grok Code Fast 1 (代码)",contextWindow:256e3},{id:"grok-3",name:"Grok 3",contextWindow:131072},{id:"grok-3-mini",name:"Grok 3 Mini",contextWindow:131072}]},{id:"cohere",label:"Cohere",group:"国际厂商",baseUrl:"https://api.cohere.com/compatibility/v1",api:"openai-completions",models:[{id:"command-a-03-2025",name:"Command A",contextWindow:256e3},{id:"command-a-reasoning-08-2025",name:"Command A (推理)",contextWindow:256e3},{id:"command-a-vision-07-2025",name:"Command A (视觉)",contextWindow:128e3},{id:"command-r-plus-08-2024",name:"Command R+",contextWindow:128e3},{id:"command-r-08-2024",name:"Command R",contextWindow:128e3}]},{id:"groq",label:"Groq",group:"推理加速",baseUrl:"https://api.groq.com/openai/v1",api:"openai-completions",models:[{id:"openai/gpt-oss-120b",name:"GPT-OSS 120B",contextWindow:131072},{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B",contextWindow:131072},{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",contextWindow:128e3},{id:"qwen/qwen3-32b",name:"Qwen 3 32B",contextWindow:128e3},{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B",contextWindow:131072}]},{id:"fireworks",label:"Fireworks AI",group:"推理加速",baseUrl:"https://api.fireworks.ai/inference/v1",api:"openai-completions",models:[{id:"accounts/fireworks/models/deepseek-v3",name:"DeepSeek V3",contextWindow:131072},{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1",contextWindow:163840},{id:"accounts/fireworks/models/deepseek-v3p2",name:"DeepSeek V3.2",contextWindow:163840},{id:"accounts/fireworks/models/deepseek-r1",name:"DeepSeek R1",contextWindow:163840},{id:"accounts/fireworks/models/llama-v3p3-70b-instruct",name:"Llama 3.3 70B",contextWindow:131072},{id:"accounts/fireworks/models/qwen2.5-coder-32b-instruct",name:"Qwen 2.5 Coder 32B",contextWindow:32768}]},{id:"sambanova",label:"SambaNova",group:"推理加速",baseUrl:"https://api.sambanova.ai/v1",api:"openai-completions",models:[{id:"gpt-oss-120b",name:"GPT-OSS 120B",contextWindow:131072},{id:"DeepSeek-R1-0528",name:"DeepSeek R1",contextWindow:65536},{id:"DeepSeek-V3-0324",name:"DeepSeek V3",contextWindow:65536},{id:"DeepSeek-V3.1",name:"DeepSeek V3.1",contextWindow:65536},{id:"DeepSeek-V3.2",name:"DeepSeek V3.2",contextWindow:65536},{id:"Meta-Llama-3.3-70B-Instruct",name:"Llama 3.3 70B",contextWindow:131072},{id:"Qwen3-235B",name:"Qwen 3 235B",contextWindow:65536}]},{id:"cerebras",label:"Cerebras",group:"推理加速",baseUrl:"https://api.cerebras.ai/v1",api:"openai-completions",models:[{id:"gpt-oss-120b",name:"GPT-OSS 120B",contextWindow:131072},{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen 3 235B (MoE)",contextWindow:131072},{id:"zai-glm-4.7",name:"Z.AI GLM 4.7",contextWindow:131072},{id:"llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",contextWindow:131072}]},{id:"hyperbolic",label:"Hyperbolic",group:"推理加速",baseUrl:"https://api.hyperbolic.xyz/v1",api:"openai-completions",models:[{id:"gpt-oss-120b",name:"GPT-OSS 120B",contextWindow:131072},{id:"deepseek-ai/DeepSeek-V3-0324",name:"DeepSeek V3",contextWindow:131072},{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek R1",contextWindow:131072},{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B",contextWindow:131072}]},{id:"openrouter",label:"OpenRouter",group:"聚合平台",baseUrl:"https://openrouter.ai/api/v1",api:"openai-completions",models:[{id:"openrouter/auto",name:"Auto (自动选择)",contextWindow:2e6},{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",contextWindow:1e6},{id:"openai/gpt-4.1",name:"GPT-4.1",contextWindow:1e6},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",contextWindow:1048576},{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek V3.1",contextWindow:128e3},{id:"deepseek/deepseek-r1-0528",name:"DeepSeek R1",contextWindow:163840}]},{id:"together",label:"Together AI",group:"聚合平台",baseUrl:"https://api.together.xyz/v1",api:"openai-completions",models:[{id:"deepseek-ai/DeepSeek-V3.1",name:"DeepSeek V3.1",contextWindow:131072},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1",contextWindow:163840},{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5",contextWindow:262144},{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B Turbo",contextWindow:131072},{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",name:"Qwen 3 Coder 480B",contextWindow:131072}]},{id:"siliconflow",label:"SiliconFlow",group:"聚合平台",baseUrl:"https://api.siliconflow.cn/v1",api:"openai-completions",models:[{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3",contextWindow:128e3},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1",contextWindow:128e3},{id:"Qwen/Qwen3-235B-A22B",name:"Qwen3 235B (MoE)",contextWindow:131072},{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5",contextWindow:262144},{id:"Pro/deepseek-ai/DeepSeek-V3",name:"DeepSeek V3 (Pro)",contextWindow:128e3}]},{id:"perplexity",label:"Perplexity",group:"聚合平台",baseUrl:"https://api.perplexity.ai",api:"openai-completions",models:[{id:"sonar-pro",name:"Sonar Pro (联网)",contextWindow:2e5},{id:"sonar",name:"Sonar (联网)",contextWindow:127072},{id:"sonar-reasoning-pro",name:"Sonar Reasoning Pro (联网推理)",contextWindow:128e3},{id:"sonar-deep-research",name:"Sonar Deep Research (深度研究)",contextWindow:128e3}]},{id:"deepinfra",label:"DeepInfra",group:"聚合平台",baseUrl:"https://api.deepinfra.com/v1/openai",api:"openai-completions",models:[{id:"deepseek-ai/DeepSeek-V3-0324",name:"DeepSeek V3",contextWindow:131072},{id:"deepseek-ai/DeepSeek-V3.1",name:"DeepSeek V3.1",contextWindow:131072},{id:"deepseek-ai/DeepSeek-R1-0528-Turbo",name:"DeepSeek R1 Turbo",contextWindow:131072},{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B Turbo",contextWindow:131072},{id:"Qwen/Qwen3-235B-A22B-Instruct-2507",name:"Qwen 3 235B",contextWindow:131072},{id:"Qwen/Qwen2.5-Coder-32B-Instruct",name:"Qwen 2.5 Coder 32B",contextWindow:32768}]},{id:"nvidia",label:"NVIDIA NIM",group:"聚合平台",baseUrl:"https://integrate.api.nvidia.com/v1",api:"openai-completions",models:[{id:"meta/llama-3.3-70b-instruct",name:"Llama 3.3 70B",contextWindow:131072},{id:"deepseek-ai/deepseek-r1",name:"DeepSeek R1",contextWindow:131072}]},{id:"huggingface",label:"Hugging Face",group:"聚合平台",baseUrl:"https://router.huggingface.co/v1",api:"openai-completions",models:[{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B",contextWindow:131072},{id:"Qwen/Qwen2.5-Coder-32B-Instruct",name:"Qwen 2.5 Coder 32B",contextWindow:32768}]},{id:"novita",label:"Novita AI",group:"聚合平台",baseUrl:"https://api.novita.ai/v3/openai",api:"openai-completions",models:[{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek V3",contextWindow:131072},{id:"deepseek/deepseek-r1",name:"DeepSeek R1",contextWindow:131072},{id:"meta-llama/llama-3.3-70b-instruct",name:"Llama 3.3 70B",contextWindow:131072}]},{id:"infini",label:"Infini-AI",group:"聚合平台",baseUrl:"https://cloud.infini-ai.com/maas/v1",api:"openai-completions",models:[{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3",contextWindow:128e3},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1",contextWindow:128e3}]},{id:"venice",label:"Venice AI",group:"聚合平台",baseUrl:"https://api.venice.ai/api/v1",api:"openai-completions",models:[{id:"kimi-k2-5",name:"Kimi K2.5",contextWindow:262144}]},{id:"vercel-ai-gateway",label:"Vercel AI Gateway",group:"聚合平台",baseUrl:"https://ai-gateway.vercel.sh",api:"anthropic-messages",models:[{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",contextWindow:2e5}]},{id:"synthetic",label:"Synthetic",group:"聚合平台",baseUrl:"https://api.synthetic.new/anthropic",api:"anthropic-messages",models:[{id:"hf:MiniMaxAI/MiniMax-M2.7",name:"MiniMax M2.7",contextWindow:204800},{id:"hf:MiniMaxAI/MiniMax-M2.5",name:"MiniMax M2.5",contextWindow:204800}]},{id:"opencode",label:"OpenCode Zen",group:"聚合平台",baseUrl:"https://opencode.ai/zen/v1",api:"openai-completions",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",contextWindow:2e5}]},{id:"ollama",label:"Ollama (本地)",group:"本地部署",baseUrl:"http://127.0.0.1:11434",api:"ollama",local:!0,models:[]},{id:"vllm",label:"vLLM (本地)",group:"本地部署",baseUrl:"http://127.0.0.1:8000/v1",api:"openai-completions",local:!0,models:[]},{id:"sglang",label:"SGLang (本地)",group:"本地部署",baseUrl:"http://127.0.0.1:30000/v1",api:"openai-completions",local:!0,models:[]},{id:"custom",label:"Custom (OpenAI Compatible)",group:"本地部署",baseUrl:"",api:"openai-completions",local:!0,models:[]}],oe=[{id:"feishu",labelKey:"configForm.channel.feishu",fields:[],defaults:{connectionMode:"websocket"}},{id:"openclaw-weixin",labelKey:"configForm.channel.openclaw-weixin",fields:[],defaults:{}},{id:"telegram",labelKey:"configForm.channel.telegram",fields:[{key:"botToken",label:"Bot Token",type:"password",placeholder:"From @BotFather"}]},{id:"discord",labelKey:"configForm.channel.discord",fields:[{key:"token",label:"Bot Token",type:"password",placeholder:"From Discord Developer Portal"}]},{id:"slack",labelKey:"configForm.channel.slack",fields:[{key:"botToken",label:"Bot Token (xoxb-...)",type:"password",placeholder:"xoxb-..."},{key:"appToken",label:"App Token (xapp-...)",type:"password",placeholder:"xapp-..."}]},{id:"whatsapp",labelKey:"configForm.channel.whatsapp",fields:[],defaults:{}},{id:"msteams",labelKey:"configForm.channel.msteams",fields:[{key:"appId",label:"App ID",placeholder:"Azure App Registration ID"},{key:"appPassword",label:"App Password",type:"password",placeholder:"Azure App Secret"},{key:"tenantId",label:"Tenant ID",placeholder:"Azure AD Tenant ID"}]},{id:"signal",labelKey:"configForm.channel.signal",fields:[{key:"account",label:"Phone (E.164)",placeholder:"+8613800138000"}]},{id:"line",labelKey:"configForm.channel.line",fields:[{key:"channelAccessToken",label:"Channel Access Token",type:"password",placeholder:"From LINE Developers"},{key:"channelSecret",label:"Channel Secret",type:"password",placeholder:"LINE Channel Secret"}]},{id:"googlechat",labelKey:"configForm.channel.googlechat",fields:[{key:"serviceAccountFile",label:"Service Account JSON Path",placeholder:"/path/to/service-account.json"}]}];function te(o,l,t){const r=structuredClone(o),n=l.split(".");let a=r;for(let d=0;d<n.length-1;d++)a[n[d]]===void 0&&(a[n[d]]={}),a=a[n[d]];return a[n[n.length-1]]=t,r}const L="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200",q="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200 appearance-none";function ie({label:o,hint:l,children:t}){return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:o}),t,l&&e.jsx("p",{className:"text-xs text-muted mt-1 opacity-60",children:l})]})}function H({value:o,saved:l,onChange:t,placeholder:r,onPaste:n}){const{t:a}=U("instance"),[d,b]=i.useState(!1),u="••••••••••••••••••••••••••••••";return l&&!d&&!o?e.jsx("div",{className:"relative",children:e.jsx("input",{type:"password",value:u,readOnly:!0,onFocus:()=>b(!0),onPaste:p=>{var c;const m=((c=p.clipboardData)==null?void 0:c.getData("text"))??"";m&&(p.preventDefault(),b(!0),t(m),n==null||n(p))},className:`${L} cursor-text`,title:a("config.clickToEdit")})}):e.jsx(_,{value:o,onChange:t,onPaste:n,placeholder:r,type:"password",mono:!0})}function _({value:o,onChange:l,placeholder:t,type:r="text",mono:n,onPaste:a}){const{t:d}=U("common"),[b,u]=i.useState(!1),p=r==="password";return e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:p&&!b?"password":"text",value:o||"",onChange:m=>l(m.target.value),onPaste:a,placeholder:t,className:`${L} ${n?"font-mono text-[13px]":""} ${p?"pr-9":""}`}),p&&e.jsx("button",{type:"button",onClick:()=>u(!b),"aria-label":d("action.togglePassword"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted hover:text-foreground",children:b?e.jsx(Q,{className:"w-3.5 h-3.5"}):e.jsx(O,{className:"w-3.5 h-3.5"})})]})}function ae({value:o,onChange:l,children:t}){return e.jsx("select",{value:o||"",onChange:r=>l(r.target.value),className:q,children:t})}function se({checked:o,onChange:l,label:t}){return e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":o,onClick:()=>l(!o),className:`w-9 h-5 rounded-full relative transition-colors duration-200 ${o?"bg-[#0066FF]":"bg-[var(--input-bg)]"}`,children:e.jsx("div",{className:`w-3.5 h-3.5 bg-white rounded-full absolute top-[3px] transition-transform duration-200 ${o?"left-[18px]":"left-[3px]"}`})}),e.jsx("span",{className:"text-sm text-muted",children:t})]})}function le({title:o,defaultOpen:l=!0,id:t,children:r}){const[n,a]=i.useState(l);return e.jsxs("div",{id:t,className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden hover:border-[var(--border-hover)] transition-colors duration-200",children:[e.jsxs("button",{type:"button",onClick:()=>a(!n),className:"w-full px-4 py-3 flex items-center justify-between text-left hover:bg-[var(--card-hover)] transition-colors duration-150",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:o}),n?e.jsx(j,{className:"w-4 h-4 text-muted"}):e.jsx(E,{className:"w-4 h-4 text-muted"})]}),n&&e.jsx("div",{className:"px-4 pb-4 space-y-4 border-t border-[var(--border)] pt-4",children:r})]})}function z(o){switch(o){case"ok":return"valid";case"auth_failed":case"forbidden":return"error";case"unreachable":case"timeout":case"models_empty":case"unknown_error":return"warning";default:return"warning"}}function $(o){const[l,t]=i.useState("idle"),[r,n]=i.useState([]),[a,d]=i.useState(""),[b,u]=i.useState(null),p=i.useRef(null),m=i.useRef(o);m.current=o;const c=i.useCallback(W=>{if(p.current&&p.current.abort(),!W.trim()){t("idle"),n([]),d(""),u(null);return}const{baseUrl:M,api:N,authHeader:y,providerId:D}=m.current;if(!M){t("idle");return}const w=new AbortController;p.current=w,t("validating"),d(""),u(null);const f={baseUrl:M,apiKey:W.trim(),api:N,authHeader:y,providerId:D};A(f,w.signal).then(h=>{if(w.signal.aborted)return;const g=z(h.status);t(g),u(h.status),n(h.models||[]),d(h.message||"")}).catch(h=>{h.name==="AbortError"||w.signal.aborted||(t("warning"),u(null),d(h.message||"Validation failed"))})},[]),x=i.useCallback(()=>{p.current&&(p.current.abort(),p.current=null),t("idle"),n([]),d(""),u(null)},[]);return{state:l,models:r,message:a,rawStatus:b,validate:c,reset:x}}function X({state:o,rawStatus:l,message:t,modelCount:r,t:n}){if(o==="idle")return null;if(o==="validating")return e.jsxs("p",{className:"text-xs text-muted mt-1.5 flex items-center gap-1","aria-live":"polite",children:[e.jsx("span",{className:"inline-block w-3 h-3 border-2 border-muted border-t-transparent rounded-full animate-spin"}),n("llm.validating")]});if(o==="valid")return e.jsxs("p",{className:"text-xs text-green-500 mt-1.5","aria-live":"polite",children:["✅ ",n("llm.keyValid",{count:r})]});if(o==="error"){const d=n(l==="forbidden"?"llm.keyForbidden":"llm.keyAuthFailed");return e.jsxs("p",{className:"text-xs text-red-400 mt-1.5","aria-live":"polite",children:["❌ ",d]})}let a;switch(l){case"timeout":a=n("llm.keyTimeout");break;case"unreachable":a=n("llm.keyUnreachable");break;case"models_empty":a=n("llm.keyModelsEmpty");break;default:a=t||n("llm.keyWarning")}return e.jsxs("p",{className:"text-xs text-yellow-500 mt-1.5","aria-live":"polite",children:["⚠️ ",a]})}function de({value:o,saved:l,onChange:t,baseUrl:r,api:n,authHeader:a,providerId:d,placeholder:b,onModels:u,onStateChange:p,selectedModelId:m}){const{t:c}=U("common"),{state:x,models:W,message:M,rawStatus:N,validate:y,reset:D}=$({baseUrl:r,api:n,authHeader:a,providerId:d}),[w,f]=i.useState("idle"),[h,g]=i.useState(""),C=i.useRef(null),S=i.useRef(o);S.current=o;const v=i.useCallback(s=>{f("idle"),g(""),y(s)},[y]),T=i.useCallback(s=>{t(s),D(),f("idle"),g("")},[t,D]),B=i.useCallback(s=>{var F;const k=((F=s.clipboardData)==null?void 0:F.getData("text"))??"";k.trim()&&setTimeout(()=>v(k.trim()),0)},[v]),G=i.useCallback(()=>{const s=S.current;s.trim()&&x==="idle"&&v(s)},[x,v]),K=i.useCallback(()=>{const s=S.current;s.trim()&&v(s)},[v]),R=i.useCallback(()=>{if(!m||!S.current.trim())return;C.current&&C.current.abort();const s=new AbortController;C.current=s,f("testing"),g(""),A({baseUrl:r,apiKey:S.current.trim(),api:n,authHeader:a,providerId:d,mode:"completion",modelId:m},s.signal).then(k=>{s.signal.aborted||(k.status==="ok"?(f("ok"),g(c("llm.deepValidateOk"))):(f("error"),k.status==="quota_exceeded"?g(c("llm.deepQuotaExceeded")):k.status==="model_not_found"?g(c("llm.deepModelNotFound")):g(k.message||c("llm.keyWarning"))))}).catch(k=>{k.name==="AbortError"||s.signal.aborted||(f("error"),g(k.message||c("llm.keyWarning")))})},[r,n,a,d,m,c]);i.useEffect(()=>()=>{var s;(s=C.current)==null||s.abort()},[]);const V=i.useRef(u);V.current=u,i.useEffect(()=>{x==="valid"&&W.length>0&&V.current&&V.current(W)},[x,W]);const I=i.useRef(p);I.current=p,i.useEffect(()=>{var s;(s=I.current)==null||s.call(I,x)},[x]);const P=x==="valid";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"flex-1",onBlur:G,children:e.jsx(H,{value:o,saved:l,onChange:T,placeholder:b,onPaste:B})}),e.jsx("button",{type:"button",onClick:K,disabled:x==="validating"||!o.trim(),className:"shrink-0 px-3 py-2 text-xs font-medium rounded-md border border-[var(--border)] bg-[var(--input-bg)] text-foreground hover:bg-[var(--hover-bg)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:c(x==="validating"?"llm.validating":"llm.fetchModelsBtn")})]}),e.jsx(X,{state:x,rawStatus:N,message:M,modelCount:W.length,t:c}),P&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:R,disabled:w==="testing"||!m,className:"shrink-0 px-2.5 py-1 text-[11px] font-medium rounded border border-[var(--border)] bg-[var(--input-bg)] text-foreground hover:bg-[var(--hover-bg)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:c(w==="testing"?"llm.deepValidating":"llm.deepValidateBtn")}),w==="idle"&&!m&&e.jsx("span",{className:"text-[11px] text-muted",children:c("llm.deepSelectModel")}),w==="idle"&&m&&e.jsx("span",{className:"text-[11px] text-muted",children:c("llm.deepValidateHint")}),w==="ok"&&e.jsxs("span",{className:"text-[11px] text-green-500",children:["✅ ",h]}),w==="error"&&e.jsxs("span",{className:"text-[11px] text-red-400",children:["❌ ",h]})]})]})}export{de as A,oe as C,ie as F,_ as I,ne as P,ee as R,H as S,se as T,le as a,ae as b,te as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aF as W,a5 as e,L as K,j as $,m as A,i as L,a9 as I,$ as T,ah as E,au as M,ax as R,ai as U}from"./index-bnBu0nlQ.js";import{c as u,d as D}from"./vendor-react-ZC5T_huj.js";import{u as P}from"./usePolling-Bn93fe7M.js";import{u as _}from"./vendor-i18n-flxcMVeP.js";function G(t){if(!t)return"-";const o=Math.floor(t/86400),l=Math.floor(t%86400/3600),a=Math.floor(t%3600/60);return o>0?`${o}d ${l}h`:l>0?`${l}h ${a}m`:`${a}m`}function O({status:t}){const{t:o}=_(),a={running:{cls:"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",labelKey:"status.running"},pending:{cls:"bg-amber-500/10 text-amber-400 border border-amber-500/20",labelKey:"status.starting"},failed:{cls:"bg-red-500/10 text-red-400 border border-red-500/20",labelKey:"status.failed"},dead:{cls:"bg-red-500/10 text-red-400 border border-red-500/20",labelKey:"status.crashed"}}[t]||{cls:"bg-[var(--card)] text-muted border border-[var(--border)]",labelKey:"status.stopped"};return e.jsx("span",{className:`inline-flex items-center text-xs px-2 py-0.5 rounded-full font-medium ${a.cls}`,children:o(a.labelKey)})}const V=[{key:"localInference",labelKey:"capability.localInference",cls:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"},{key:"knowledgeBase",labelKey:"capability.knowledgeBase",cls:"bg-indigo-500/10 text-indigo-400 border-indigo-500/20"},{key:"files",labelKey:"capability.files",cls:"bg-amber-500/10 text-amber-400 border-amber-500/20"},{key:"search",labelKey:"capability.search",cls:"bg-sky-500/10 text-sky-400 border-sky-500/20"},{key:"browser",labelKey:"capability.browser",cls:"bg-violet-500/10 text-violet-400 border-violet-500/20"},{key:"aiWebUi",labelKey:"capability.aiWebUi",cls:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20"},{key:"webUi",labelKey:"capability.webUi",cls:"bg-slate-500/10 text-muted border-[var(--border)]"}];function q(t){const o=new Set((Array.isArray(t==null?void 0:t.provides)?t.provides:[]).map(r=>String((r==null?void 0:r.capability)??"").toLowerCase()).filter(Boolean));if(o.has("llm-agent"))return[];const l=r=>{for(const m of o)if(r(m))return!0;return!1},a=new Set;return l(r=>r==="llm-ollama"||r==="ollama-api")&&a.add("localInference"),l(r=>r.startsWith("knowledge-")||r.includes("anythingllm")||r.includes("weknora"))&&a.add("knowledgeBase"),l(r=>r.startsWith("files-")||r.includes("filebrowser"))&&a.add("files"),l(r=>r==="search"||r.startsWith("search-"))&&a.add("search"),l(r=>r==="browser"||r.startsWith("browser-")||r.startsWith("web-browserless")||r.startsWith("playwright"))&&a.add("browser"),l(r=>r.includes("openwebui"))&&a.add("aiWebUi"),!a.size&&l(r=>r.startsWith("web-")||r.endsWith("-web")||r.endsWith("-dashboard"))&&a.add("webUi"),V.filter(r=>a.has(r.key))}function Q(){const{t}=_(["dashboard","common"]),[o,l]=u.useState([]),[a,r]=u.useState(null),[m,v]=u.useState(""),[j,w]=u.useState(""),[g,N]=u.useState(!1),f=D(),{showToast:b}=W(),h=()=>{I().then(s=>{l(s),w("")}).catch(s=>w(s.message||t("common:error.loadFailed"))),T().then(r).catch(()=>{})};P(h,1e4);const F=async()=>{if(window.confirm(t("engine.restartConfirm"))){N(!0);try{await E(),b(t("engine.restarted"),"success"),setTimeout(h,2e3)}catch(s){b(s.message||t("engine.restartFailed"),"error")}finally{N(!1)}}},y=async(s,n,x)=>{s.stopPropagation(),v(`${x}-${n}`);try{let i=null;n==="start"&&(i=await M(x)),n==="stop"&&(i=await R(x)),n==="restart"&&(i=await U(x)),b(t(`common:action.${n}Done`),"success");const d=i==null?void 0:i.port_allocation;d&&typeof d.from=="number"&&typeof d.to=="number"&&d.from!==d.to&&b(t("common:toast.portReallocated",{defaultValue:"端口 {{from}} 被占用,已自动切换到 {{to}}",from:d.from,to:d.to}),"info"),setTimeout(h,1e3)}catch(i){b(i.message||t("common:error.operationFailed"),"error")}finally{v("")}},S=o.filter(s=>{var n;return((n=s.service)==null?void 0:n.status)==="running"}).length,p=!!a&&a.disk.percent>90,B=a?[{label:t("stats.runningInstances"),value:`${S} / ${o.length}`,sub:a.nomad_running?t("stats.engineRunning"):t("stats.engineStopped"),subColor:a.nomad_running?"text-emerald-400":"text-red-400",icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),iconColor:"text-[#0066FF]",glowColor:"rgba(0,102,255,0.12)",accent:"border-l-2 border-l-[#0066FF]"},{label:t("stats.cpu"),value:`${a.cpu_percent}%`,sub:a.temperature?`${a.temperature}°C`:null,icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),e.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),e.jsx("line",{x1:"9",y1:"2",x2:"9",y2:"4"}),e.jsx("line",{x1:"15",y1:"2",x2:"15",y2:"4"}),e.jsx("line",{x1:"9",y1:"20",x2:"9",y2:"22"}),e.jsx("line",{x1:"15",y1:"20",x2:"15",y2:"22"}),e.jsx("line",{x1:"20",y1:"9",x2:"22",y2:"9"}),e.jsx("line",{x1:"20",y1:"15",x2:"22",y2:"15"}),e.jsx("line",{x1:"2",y1:"9",x2:"4",y2:"9"}),e.jsx("line",{x1:"2",y1:"15",x2:"4",y2:"15"})]}),iconColor:"text-[#0066FF]",glowColor:"rgba(0,102,255,0.12)",accent:"border-l-2 border-l-[#0066FF]",warn:a.cpu_percent>90},{label:t("stats.memory"),value:`${a.memory.percent}%`,sub:`${a.memory.used_mb}MB / ${a.memory.total_mb}MB`,icon:e.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{d:"M6 19v-8m4 8v-4m4 4v-6m4 6v-2"})}),iconColor:"text-[#00D4AA]",glowColor:"rgba(0,212,170,0.12)",accent:"border-l-2 border-l-[#00D4AA]"},{label:t("stats.disk"),value:`${a.disk.percent}%`,sub:`${a.disk.used_gb}GB / ${a.disk.total_gb}GB`,icon:e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M3 5v14a9 3 0 0018 0V5"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"22"})]}),iconColor:p?"text-red-400":"text-[#0066FF]",glowColor:p?"rgba(239,68,68,0.12)":"rgba(0,102,255,0.12)",accent:p?"border-l-2 border-l-red-400":"border-l-2 border-l-[#0066FF]",warn:p}]:[];return e.jsxs("div",{className:"p-4 2xl:px-6 2xl:py-3 max-w-5xl xl:max-w-6xl 2xl:max-w-none mx-auto",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-semibold text-foreground",children:t("title")}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:t("subtitle")})]}),e.jsx(K,{})]}),a&&e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-4",children:B.map(s=>e.jsxs("div",{className:`bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 relative overflow-hidden hover:border-[var(--border-hover)] hover:bg-[var(--card-hover)] transition-all duration-200 ${s.accent}`,children:[e.jsx("div",{className:"absolute top-0 right-0 w-16 h-16 rounded-full opacity-60 pointer-events-none",style:{background:`radial-gradient(circle, ${s.glowColor} 0%, transparent 70%)`}}),e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-[11px] text-muted",children:s.label}),e.jsx("span",{className:`${s.iconColor} opacity-80`,children:s.icon})]}),e.jsx("div",{className:`text-lg font-semibold ${s.warn?"text-red-400":"text-foreground"}`,children:s.value}),s.sub&&e.jsx("div",{className:`text-[11px] mt-0.5 truncate ${s.subColor??"text-muted"}`,children:s.sub})]},s.label))}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2.5 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-foreground",children:t("instances.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>f("/instances/new"),className:"bg-[#0066FF] text-white px-3 py-1.5 rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all duration-200 shadow-[0_0_12px_rgba(0,102,255,0.3)]",children:t("instances.new")}),e.jsx("button",{onClick:()=>f("/instances/new?import=true"),className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted border border-[var(--border)] bg-[var(--card)] hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-200",children:t("instances.import")}),e.jsxs("button",{onClick:F,disabled:g,title:t("instances.restartEngineTitle"),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium text-red-400 border border-red-500/20 bg-red-500/5 hover:bg-red-500/15 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200",children:[e.jsx($,{className:`w-3 h-3 ${g?"animate-spin":""}`}),t(g?"instances.restarting":"instances.restartEngine")]})]})]}),j?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-sm text-red-400 mb-2",children:t("instances.loadError",{error:j})}),e.jsx("button",{onClick:h,className:"text-xs text-muted hover:text-foreground underline",children:t("common:action.retry")})]}):o.length===0?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("div",{className:"text-muted opacity-40 mb-3",children:e.jsxs("svg",{className:"w-8 h-8 mx-auto",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}),e.jsx("p",{className:"text-sm text-muted mb-1",children:t("instances.empty")}),e.jsx("p",{className:"text-xs text-muted opacity-60",children:t("instances.emptyHint")})]}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-xs text-muted border-b border-[var(--border)]",children:[e.jsx("th",{className:"text-left font-medium px-4 py-2",children:t("table.name")}),e.jsx("th",{className:"text-left font-medium px-4 py-2",children:t("table.status")}),e.jsx("th",{className:"text-left font-medium px-4 py-2 hidden sm:table-cell",children:t("table.uptime")}),e.jsx("th",{className:"text-left font-medium px-4 py-2 hidden md:table-cell",children:t("table.memory")}),e.jsx("th",{className:"text-left font-medium px-4 py-2 hidden lg:table-cell",children:t("table.localCapability")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:t("table.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-[var(--border)]",children:o.map(s=>{var d,k,C;const n=((d=s.service)==null?void 0:d.status)||"stopped",x=n==="running",i=q(s);return e.jsxs("tr",{className:"hover:bg-[var(--card-hover)] cursor-pointer transition-colors duration-150",onClick:()=>f(`/instances/${s.id}`),children:[e.jsxs("td",{className:"px-4 py-2.5",children:[e.jsx("div",{className:"font-medium text-foreground",children:s.name}),e.jsx("div",{className:"text-xs text-muted font-mono",children:s.id})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(O,{status:n}),((k=s.auto_backup)==null?void 0:k.enabled)&&e.jsx("span",{className:`text-xs leading-none ${s.auto_backup.last_backup_ok===!1?"text-red-400":"text-green-400"}`,title:s.auto_backup.last_backup_ok===!1?"Backup failed":"Backup OK",children:s.auto_backup.last_backup_ok===!1?"⚠":"●"})]})}),e.jsx("td",{className:"px-4 py-2.5 text-muted hidden sm:table-cell font-mono text-xs",children:x?G(s.service.uptime):"-"}),e.jsx("td",{className:"px-4 py-2.5 text-muted hidden md:table-cell font-mono text-xs",children:(C=s.service)!=null&&C.memory_mb?`${s.service.memory_mb} MB`:"-"}),e.jsx("td",{className:"px-4 py-2.5 hidden lg:table-cell",children:i.length?e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(c=>e.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium ${c.cls}`,children:t(c.labelKey)},c.key))}):e.jsx("span",{className:"text-muted text-xs",children:"-"})}),e.jsx("td",{className:"px-4 py-2.5 text-right",children:e.jsx("div",{className:"inline-flex items-center gap-1",children:x||n==="pending"?e.jsxs(e.Fragment,{children:[e.jsx("button",{title:t("common:action.restart"),onClick:c=>y(c,"restart",s.id),disabled:!!m,className:"p-1.5 rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] disabled:opacity-30 transition-colors duration-150",children:e.jsx($,{className:"w-3.5 h-3.5"})}),e.jsx("button",{title:t("common:action.stop"),onClick:c=>y(c,"stop",s.id),disabled:!!m,className:"p-1.5 rounded-md text-muted hover:text-red-400 hover:bg-red-500/10 disabled:opacity-30 transition-colors duration-150",children:e.jsx(A,{className:"w-3.5 h-3.5"})})]}):e.jsx("button",{title:t("common:action.start"),onClick:c=>y(c,"start",s.id),disabled:!!m,className:"p-1.5 rounded-md text-muted hover:text-emerald-400 hover:bg-emerald-500/10 disabled:opacity-30 transition-colors duration-150",children:e.jsx(L,{className:"w-3.5 h-3.5"})})})})]},s.id)})})]})]})]})}export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a5 as r,p as J}from"./index-bnBu0nlQ.js";import{c as a}from"./vendor-react-ZC5T_huj.js";import"./vendor-i18n-flxcMVeP.js";const h="hermes-chat:",I="hermes-chat-epoch:",Y=500,u=10,L=10;function q(s,l){if(!l)return null;try{const t=localStorage.getItem(I+s),c=localStorage.getItem(h+s)!=null;(t!==null&&t!==l||t===null&&c)&&localStorage.removeItem(h+s),t!==l&&localStorage.setItem(I+s,l)}catch{}return l}function P(s,l){q(s,l);try{const t=localStorage.getItem(h+s);if(!t)return[];const c=JSON.parse(t);return Array.isArray(c)?c.filter(n=>n&&(n.role==="user"||n.role==="assistant"||n.role==="system")).map(n=>({role:n.role,content:String(n.content??""),error:!!n.error})):[]}catch{return[]}}function X({instanceId:s,instanceEpoch:l=null}){const[t,c]=a.useState(()=>P(s,l)),[n,m]=a.useState(()=>Math.min(u,t.length||u)),[v,S]=a.useState(""),[d,N]=a.useState(!1),[g,w]=a.useState(!1),x=a.useRef(null),M=a.useRef(t.length),f=a.useRef(null),F=t.slice(-n),j=n<t.length;a.useEffect(()=>{try{const e=t.filter(i=>!i.pending).slice(-Y);e.length===0?localStorage.removeItem(h+s):localStorage.setItem(h+s,JSON.stringify(e))}catch{}},[s,t]),a.useEffect(()=>{const e=P(s,l);c(e),m(Math.min(u,e.length||u))},[s,l]),a.useEffect(()=>{const e=x.current;if(e){if(f.current){const i=f.current.prevScrollHeight;e.scrollTop=e.scrollHeight-i,f.current=null;return}t.length>=M.current&&(e.scrollTop=e.scrollHeight),M.current=t.length}},[t,n]);const C=()=>{if(!j||g)return;w(!0);const e=x.current;e&&(f.current={prevScrollHeight:e.scrollHeight}),m(i=>Math.min(i+L,t.length)),requestAnimationFrame(()=>w(!1))},T=()=>{const e=x.current;!e||!j||g||e.scrollTop<40&&C()},E=async()=>{var H,R,k,A;const e=v.trim();if(!e||d)return;S(""),N(!0);const i={role:"user",content:e},K={role:"assistant",content:"",pending:!0},_=[...t,i,K];c(_);const $=_.slice(0,-1).slice(-20).map(o=>({role:o.role,content:o.content}));try{const o=await J(s,{model:"hermes-agent",messages:$,max_tokens:512}),p=((k=(R=(H=o==null?void 0:o.choices)==null?void 0:H[0])==null?void 0:R.message)==null?void 0:k.content)??((A=o==null?void 0:o.error)==null?void 0:A.message)??"(empty response)";c(b=>b.map((y,B)=>B===b.length-1?{role:"assistant",content:String(p)}:y))}catch(o){c(p=>p.map((b,y)=>y===p.length-1?{role:"assistant",content:(o==null?void 0:o.message)||"(request failed)",error:!0}:b))}finally{N(!1)}},O=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),E())};return r.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-[var(--border)] bg-[var(--card)] shadow-[0_18px_48px_rgba(15,23,42,0.06)] flex flex-col",style:{height:"calc(100vh - 160px)",minHeight:"500px"},children:[r.jsxs("div",{className:"px-5 py-3 border-b border-[var(--border)] flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500 shadow-[0_0_6px_rgba(16,185,129,0.7)]"}),r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"}),r.jsx("span",{className:"text-[10px] text-muted font-mono",children:"inline → /v1/chat/completions"})]}),t.length>0&&r.jsx("button",{onClick:()=>{c([]),m(u)},className:"text-xs text-muted hover:text-foreground transition-colors",disabled:d,children:"清空对话"})]}),r.jsxs("div",{ref:x,onScroll:T,className:"flex-1 overflow-y-auto p-5 space-y-3",children:[j&&r.jsx("div",{className:"flex justify-center py-1",children:r.jsx("button",{onClick:C,disabled:g,className:"text-xs text-muted hover:text-foreground transition-colors",children:g?"加载中...":`向上滚动或点击加载更早的 ${Math.min(L,t.length-n)} 条 (共 ${t.length} 条)`})}),t.length===0?r.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center",children:[r.jsx("div",{className:"text-4xl mb-3 opacity-40",children:"⚕"}),r.jsx("div",{className:"text-sm text-foreground/70 font-medium mb-1",children:"和 Hermes agent 开始对话"}),r.jsx("div",{className:"text-xs text-muted max-w-md",children:"消息会走完整的 agent loop(skills + tools + memory), 经 JishuShell LLM 代理转发到上游模型。首次请求因冷启动约 20-30 秒。"})]}):F.map((e,i)=>r.jsx("div",{className:`flex ${e.role==="user"?"justify-end":"justify-start"}`,children:r.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 text-sm whitespace-pre-wrap break-words ${e.role==="user"?"bg-[#0066FF] text-white":e.error?"bg-red-500/10 border border-red-500/20 text-red-400":"bg-[var(--input-bg)] border border-[var(--border)] text-foreground"}`,children:e.pending?r.jsxs("span",{className:"inline-flex items-center gap-2 text-muted",children:[r.jsx("span",{className:"w-3 h-3 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin"}),"agent 正在思考..."]}):e.content})},t.length-F.length+i))]}),r.jsx("div",{className:"p-4 border-t border-[var(--border)]",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("textarea",{value:v,onChange:e=>S(e.target.value),onKeyDown:O,placeholder:"输入消息 (Enter 发送,Shift+Enter 换行)",rows:2,disabled:d,className:"flex-1 bg-[var(--input-bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 resize-none"}),r.jsx("button",{onClick:E,disabled:!v.trim()||d,className:"self-end px-4 py-2 bg-[#0066FF] text-white rounded-lg text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:d?r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx("span",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"发送中"]}):"发送"})]})})]})}export{X as HermesChatPanel};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{N as ve,a5 as s,af as fe,J as ge}from"./index-bnBu0nlQ.js";import{c as u,L as oe}from"./vendor-react-ZC5T_huj.js";import{P as b,a as U,F as f,b as H,A as be,I as F,S as ye}from"./ApiKeyField-CvyAOcJS.js";import{F as je,W as Ne}from"./WeixinLoginPanel-D89kdhP4.js";import{u as Se}from"./vendor-i18n-flxcMVeP.js";const Ae=new Set(["feishu","weixin"]),K={telegram:{label:"Telegram",fields:[{key:"token",envKey:"TELEGRAM_BOT_TOKEN",label:"Bot Token",secret:!0,hint:"从 @BotFather 获取"},{key:"allowed",envKey:"TELEGRAM_ALLOWED_USERS",label:"Allowed Users",hint:"逗号分隔 user id,留空=所有人"}]},discord:{label:"Discord",fields:[{key:"token",envKey:"DISCORD_BOT_TOKEN",label:"Bot Token",secret:!0,hint:"从 Discord Developer Portal"}]},slack:{label:"Slack",fields:[{key:"bot",envKey:"SLACK_BOT_TOKEN",label:"Bot Token (xoxb-…)",secret:!0,placeholder:"xoxb-..."},{key:"app",envKey:"SLACK_APP_TOKEN",label:"App Token (xapp-…)",secret:!0,placeholder:"xapp-..."}]},whatsapp:{label:"WhatsApp",fields:[{key:"token",envKey:"WHATSAPP_TOKEN",label:"Access Token",secret:!0}]},signal:{label:"Signal",fields:[{key:"account",envKey:"SIGNAL_ACCOUNT",label:"Phone (E.164)",placeholder:"+8613800138000"}]},email:{label:"Email (SMTP)",fields:[{key:"host",envKey:"SMTP_HOST",label:"SMTP Host",placeholder:"smtp.gmail.com"},{key:"port",envKey:"SMTP_PORT",label:"SMTP Port",placeholder:"587"},{key:"user",envKey:"SMTP_USER",label:"SMTP User"},{key:"pass",envKey:"SMTP_PASSWORD",label:"SMTP Password",secret:!0}]}};function Fe(l){const x=new Map;for(const g of l.split(`
|
|
2
|
+
`)){const h=g.trim();if(!h||h.startsWith("#"))continue;const t=h.indexOf("=");if(t<0)continue;const c=h.slice(0,t).trim();let r=h.slice(t+1).trim();(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),x.set(c,r)}return x}function te(l,x){const g=l.split(`
|
|
3
|
+
`),h=new Set,t=[];for(const c of g){const r=c.trim();if(!r||r.startsWith("#")){t.push(c);continue}const y=r.indexOf("=");if(y<0){t.push(c);continue}const S=r.slice(0,y).trim();if(S in x){h.add(S);const C=x[S];if(C==="")continue;t.push(`${S}=${C}`)}else t.push(c)}for(const[c,r]of Object.entries(x))!h.has(c)&&r!==""&&t.push(`${c}=${r}`);return t.join(`
|
|
4
|
+
`)}function Pe({config:l,onChange:x,instanceId:g,capabilities:h}){var X,Z,ee,se;const{t}=Se(["instance","common"]),c=String((l==null?void 0:l.yaml)||""),r=String((l==null?void 0:l.env)||""),y=u.useMemo(()=>Fe(r),[r]),a=(((l==null?void 0:l["x-jishushell"])||{}).proxy||{}).upstream||{},m=a.providerId||"",P=b.find(e=>e.id===m),E=a.models||[],M=P?P.models.map(e=>({id:e.id,name:e.name,contextWindow:e.contextWindow})):E.map(e=>({id:e.id,name:e.name||e.id,contextWindow:e.contextWindow||0})),v=a.selectedModelId||((X=M[0])==null?void 0:X.id)||"",w=E.find(e=>e.id===v)||M.find(e=>e.id===v)||{id:"",name:"",contextWindow:0},[N,ne]=u.useState(null),[T,re]=u.useState(!1),[I,le]=u.useState(!(a.hasApiKey&&m)),[R,D]=u.useState([]),[ae,B]=u.useState([]),[J,V]=u.useState(!1);u.useEffect(()=>{ve().then(ne).catch(()=>{})},[]);const k=e=>{var n;const o=JSON.parse(JSON.stringify(l));o["x-jishushell"]||(o["x-jishushell"]={}),(n=o["x-jishushell"]).proxy||(n.proxy={}),o["x-jishushell"].proxy.upstream={...o["x-jishushell"].proxy.upstream||{},...e},x(o)},O=(e,o)=>k({[e]:o}),ie=e=>{var d,i;const o=b.find(p=>p.id===e);if(!o){k({providerId:""});return}if(a.apiKey&&!window.confirm(t("configForm.switchProviderConfirm",{defaultValue:"切换 provider 会清空当前 API key,确定继续?"})))return;const n=JSON.parse(JSON.stringify(l));n["x-jishushell"]||(n["x-jishushell"]={}),(d=n["x-jishushell"]).proxy||(d.proxy={}),n["x-jishushell"].proxy.upstream={providerId:o.id,baseUrl:o.baseUrl,api:o.api,authHeader:o.authHeader===!0,headers:o.headers||{},models:o.models.map(p=>({id:p.id,name:p.name,contextWindow:p.contextWindow})),selectedModelId:((i=o.models[0])==null?void 0:i.id)||"",apiKey:"",hasApiKey:!1,clearApiKey:!1},x(n)},W=e=>O("selectedModelId",e),_=e=>{var p;const o=[...E],n=o.findIndex(j=>j.id===v),d={...w,...e};n>=0?o[n]=d:o.push(d);const i=JSON.parse(JSON.stringify(l));i["x-jishushell"]||(i["x-jishushell"]={}),(p=i["x-jishushell"]).proxy||(p.proxy={}),i["x-jishushell"].proxy.upstream={...i["x-jishushell"].proxy.upstream||{},models:o,selectedModelId:typeof e.id=="string"&&e.id?e.id:v},x(i)},de=async e=>{if(!m)return;const o=b.find(j=>j.id===m);if(!o)return;const d=["ollama","vllm","sglang"].includes(m)&&a.baseUrl?String(a.baseUrl):o.baseUrl,i=o.authHeader?"x-api-key":"Authorization",p=a.apiKey||"";V(!0);try{const{models:j}=await fe(d,p,i,o.id,o.api);B(j),j.length&&!v&&W(j[0].id)}catch{}finally{V(!1)}},A=Array.isArray(h==null?void 0:h.messagingPlatforms)?h.messagingPlatforms:[],L=u.useMemo(()=>A.filter(e=>!Ae.has(e)),[A]),$=u.useMemo(()=>{const e=[];for(const o of L){const n=K[o];n&&n.fields.some(d=>(y.get(d.envKey)||"").trim()!=="")&&e.push(o)}return e},[L,y]),G=u.useMemo(()=>Array.from(new Set([...$,...R])),[$,R]),z=L.filter(e=>!G.includes(e)&&K[e]),Y=y.get("FEISHU_APP_ID")||"",ce=u.useMemo(()=>{const e=c.match(/platforms:\s*[\s\S]*?feishu:\s*[\s\S]*?domain_name:\s*["']?(\w+)["']?/);return(e==null?void 0:e[1])==="lark"?"lark":"feishu"},[c]),q=()=>{g&&ge(g).then(e=>{e&&x(e)}).catch(()=>{})},Q=(e,o)=>{x({...l,format:"yaml+env",yaml:c,env:te(r,{[e]:o})})},me=e=>{D(o=>o.includes(e)?o:[...o,e])},xe=e=>{const o=K[e];if(!o)return;const n={};o.fields.forEach(d=>{n[d.envKey]=""}),x({...l,format:"yaml+env",yaml:c,env:te(r,n)}),D(d=>d.filter(i=>i!==e))},he=e=>x({...l,format:"yaml+env",yaml:e,env:r}),ue=e=>x({...l,format:"yaml+env",yaml:c,env:e}),pe=[...new Set(b.map(e=>e.group))];return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(U,{title:t("configForm.modelConfig"),children:[s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 text-sm text-muted",children:[s.jsx("div",{className:"font-medium text-foreground mb-1",children:t("configForm.proxyChain")}),s.jsx("p",{children:t("configForm.proxyChainDesc")}),s.jsxs("div",{className:"mt-2 text-xs text-muted opacity-60 space-y-1",children:[s.jsxs("div",{children:["面板全局 provider:"," ",N!=null&&N.configured?s.jsxs("span",{className:"font-mono",children:[N.providerId,N.selectedModelId?` · ${N.selectedModelId}`:""]}):s.jsx(oe,{to:"/settings",className:"text-amber-400 underline hover:text-amber-300",children:"未配置"})," ",s.jsx(oe,{to:"/settings",className:"text-[#0066FF] hover:text-[#0066FF]/80",children:"(修改)"})]}),s.jsx("div",{className:"opacity-70",children:"本实例 API key 留空 → 自动回退全局 key (src/services/llm-proxy/index.ts:137)"})]})]}),!I&&s.jsx("button",{type:"button",onClick:()=>le(!0),className:"text-xs text-[#0066FF] hover:text-[#0066FF]/80 transition-colors",children:t("configForm.editModelConfig")}),I&&s.jsx(f,{label:t("configForm.upstreamProvider"),hint:t("configForm.upstreamProviderHint"),children:s.jsxs(H,{value:m,onChange:ie,children:[s.jsx("option",{value:"",children:t("configForm.selectProvider")}),!P&&m&&s.jsxs("option",{value:m,children:[m," ",t("configForm.custom")]}),pe.map(e=>s.jsx("optgroup",{label:t(`configForm.providerGroup.${e}`,{defaultValue:e}),children:b.filter(o=>o.group===e).map(o=>s.jsx("option",{value:o.id,children:t(`configForm.providerLabel.${o.id}`,{defaultValue:o.label})},o.id))},e))]})}),I&&!["ollama","vllm","sglang"].includes(m)&&m&&s.jsxs(s.Fragment,{children:[s.jsxs(f,{label:t("configForm.upstreamApiKey"),hint:a.hasApiKey&&!a.clearApiKey?t("configForm.apiKeyHintSaved"):t("configForm.apiKeyHintNew"),children:[s.jsx(be,{value:a.apiKey||"",saved:a.hasApiKey&&!a.clearApiKey,onChange:e=>k({apiKey:e,clearApiKey:!1}),baseUrl:a.baseUrl||((Z=b.find(e=>e.id===m))==null?void 0:Z.baseUrl)||"",api:((ee=b.find(e=>e.id===m))==null?void 0:ee.api)||"",authHeader:(se=b.find(e=>e.id===m))!=null&&se.authHeader?"x-api-key":void 0,providerId:m,placeholder:t("configForm.enterApiKey"),onModels:e=>{B(e),e.length>0&&!v&&W(e[0].id)},selectedModelId:v}),a.hasApiKey&&s.jsx("button",{type:"button",onClick:()=>k({apiKey:"",clearApiKey:!a.clearApiKey}),className:"text-xs text-muted hover:text-foreground transition-colors mt-2",children:a.clearApiKey?t("configForm.restoreApiKey"):t("configForm.clearApiKey")})]}),s.jsx(f,{label:t("configForm.selectedModel"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsxs(H,{value:v,onChange:W,children:[s.jsx("option",{value:"",children:t("configForm.selectModel")}),M.map(e=>s.jsxs("option",{value:e.id,children:[e.name||e.id,e.contextWindow?` (${Math.round(e.contextWindow/1e3)}K)`:""]},e.id)),ae.filter(e=>!M.some(o=>o.id===e.id)).map(e=>s.jsx("option",{value:e.id,children:e.name||e.id},e.id))]})}),s.jsx("button",{type:"button",onClick:()=>{de()},disabled:J||!m,className:"px-3 py-2 border border-[var(--border)] text-muted rounded-md text-xs hover:bg-[var(--card-hover)] hover:text-foreground disabled:opacity-40 transition-colors",children:J?t("common:label.loading",{defaultValue:"加载中"}):t("configForm.fetchModels",{defaultValue:"拉取模型"})})]})}),s.jsx("button",{type:"button",onClick:()=>re(!T),className:"text-xs text-muted hover:text-foreground transition-colors",children:t(T?"configForm.collapseAdvanced":"configForm.advancedOptions")}),T&&s.jsxs("div",{className:"space-y-4 border-t border-[var(--border)] pt-4",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsx(f,{label:t("configForm.upstreamBaseUrl"),children:s.jsx(F,{value:a.baseUrl||"",onChange:e=>O("baseUrl",e),placeholder:t("configForm.baseUrlPlaceholder"),mono:!0})}),s.jsx(f,{label:t("configForm.upstreamApiProtocol"),children:s.jsxs(H,{value:a.api||"openai-completions",onChange:e=>O("api",e),children:[s.jsx("option",{value:"openai-completions",children:"OpenAI Compatible"}),s.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),s.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"}),s.jsx("option",{value:"google-generative-ai",children:"Google Generative AI"}),s.jsx("option",{value:"ollama",children:"Ollama"})]})})]}),v&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsx(f,{label:t("configForm.modelId"),children:s.jsx(F,{value:w.id||"",onChange:e=>_({id:e}),placeholder:"model-id",mono:!0})}),s.jsx(f,{label:t("configForm.modelName"),children:s.jsx(F,{value:w.name||"",onChange:e=>_({name:e}),placeholder:"Model Name"})}),s.jsx(f,{label:t("configForm.contextWindow"),children:s.jsx(F,{value:String(w.contextWindow||""),onChange:e=>_({contextWindow:parseInt(e,10)||0}),placeholder:"200000",mono:!0})})]}),s.jsx("div",{className:"text-xs text-muted bg-[var(--card)] border border-[var(--border)] rounded-md p-3",children:t("configForm.proxyNote")})]})]})]}),A.length>0&&s.jsxs(U,{title:t("configForm.imChannelConfig"),children:[s.jsxs("p",{className:"text-xs text-muted",children:["Hermes 通过 ",s.jsx("code",{className:"font-mono text-[11px]",children:".env"})," 环境变量读取消息平台凭证。 保存后重启实例生效。"]}),A.includes("feishu")&&s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:t("configForm.channel.feishu",{defaultValue:"飞书 / Lark"})}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:"feishu"})]}),s.jsx(je,{instanceId:g,channelKey:"feishu",existingAppId:Y||void 0,existingDomain:Y?ce:void 0,onConfigured:q})]}),A.includes("weixin")&&s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:t("configForm.channel.weixin",{defaultValue:"个人微信"})}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:"weixin"})]}),s.jsx(Ne,{instanceId:g,onConfigured:q})]}),s.jsx("div",{className:"space-y-3",children:G.map(e=>{const o=K[e];return o?s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:o.label}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:e})]}),s.jsx("button",{onClick:()=>xe(e),className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:t("configForm.remove")})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:o.fields.map(n=>{const d=y.get(n.envKey)||"";return s.jsx(f,{label:n.label,hint:n.hint||`.env: ${n.envKey}`,children:n.secret?s.jsx(ye,{value:d,saved:!!d,onChange:i=>Q(n.envKey,i),placeholder:n.placeholder}):s.jsx(F,{value:d,onChange:i=>Q(n.envKey,i),placeholder:n.placeholder,mono:!0})},n.key)})})]},e):null})}),z.length>0&&s.jsxs("div",{className:"pt-2",children:[s.jsx("p",{className:"text-xs text-muted mb-2",children:t("configForm.addImChannel")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:z.map(e=>{var o;return s.jsxs("button",{onClick:()=>me(e),className:"px-3 py-1.5 text-xs border border-dashed rounded-md transition-colors duration-150 border-[var(--border)] text-muted hover:border-[var(--border-hover)] hover:text-foreground",children:["+ ",((o=K[e])==null?void 0:o.label)||e]},e)})})]})]}),s.jsxs(U,{title:"高级 (原始 YAML + .env)",defaultOpen:!1,children:[s.jsx("p",{className:"text-xs text-muted",children:"直接编辑 YAML / .env。上方 Channels 字段与此处同步 — 任一侧修改都会反映到另一侧。"}),s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[s.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2",children:s.jsx("span",{className:"text-xs font-medium text-muted",children:"config.yaml"})}),s.jsx("textarea",{value:c,onChange:e=>he(e.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[240px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]}),s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[s.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2",children:s.jsx("span",{className:"text-xs font-medium text-muted",children:".env"})}),s.jsx("textarea",{value:r,onChange:e=>ue(e.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[220px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]})]})]})}export{Pe as HermesConfigForm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a5 as e,L as j,T as v,g as w,f as N,s as y,ap as F}from"./index-bnBu0nlQ.js";import{c as r}from"./vendor-react-ZC5T_huj.js";import{u as S}from"./vendor-i18n-flxcMVeP.js";const x="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200";function C({onDone:b}){const{t}=S("auth"),[s,p]=r.useState(""),[o,h]=r.useState(""),[n,f]=r.useState(!1),[l,d]=r.useState(""),[c,m]=r.useState(!1),u=s.length>=8&&s===o,g=async a=>{if(a.preventDefault(),!!u){d(""),m(!0);try{const i=await y(s);F(i.token),b()}catch(i){d(i.message||t("init.failed"))}finally{m(!1)}}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background relative overflow-hidden",children:[e.jsx("div",{className:"grid-bg absolute inset-0 pointer-events-none"}),e.jsx("div",{className:"absolute top-1/3 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[500px] h-[300px] rounded-full bg-[#0066FF]/[0.07] blur-[90px] pointer-events-none"}),e.jsx("div",{className:"absolute left-4 bottom-4 z-20",children:e.jsx(j,{className:"bg-card/80 backdrop-blur-sm"})}),e.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(v,{className:"w-40 h-40 mx-auto mb-4 object-contain"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:t("init.title")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-3 py-2.5",children:l}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:n?"text":"password",value:s,onChange:a=>p(a.target.value),placeholder:t("init.passwordPlaceholder"),className:`${x} pr-10`,autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>f(!n),"aria-label":t("common:action.togglePassword"),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors duration-200",children:n?e.jsx(w,{}):e.jsx(N,{})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.confirm")}),e.jsx("input",{type:n?"text":"password",value:o,onChange:a=>h(a.target.value),placeholder:t("init.confirmPlaceholder"),className:x}),s&&o&&s!==o&&e.jsx("p",{className:"text-red-400 text-xs mt-1.5",children:t("init.mismatch")})]}),e.jsx("button",{type:"submit",disabled:c||!u,className:"w-full bg-[#0066FF] text-white rounded-md py-2.5 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200 shadow-[0_0_20px_rgba(0,102,255,0.3)] hover:shadow-[0_0_28px_rgba(0,102,255,0.45)]",children:c?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),t("init.loading")]}):t("init.submit")})]})]})]})}export{C as default};
|