ai-agent-router 0.1.21 → 0.2.1
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +14 -0
- package/.next/build-manifest.json +2 -2
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/routes-manifest.json +84 -0
- package/.next/server/app/_global-error/page.js +1 -1
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/gateway/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/gateway/models/route.js.nft.json +1 -1
- package/.next/server/app/api/gateway/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/claude/apply/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/claude/available-models/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/claude/save/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/claude/status/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/claude/test/route.js +1 -1
- package/.next/server/app/api/ide/claude/test/route.js.nft.json +1 -1
- package/.next/server/app/api/ide/openclaw/apply/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/apply/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/apply/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/apply/route.js +7 -0
- package/.next/server/app/api/ide/openclaw/apply/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/apply/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/apply/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/available-models/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/available-models/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/available-models/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/available-models/route.js +7 -0
- package/.next/server/app/api/ide/openclaw/available-models/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/available-models/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/available-models/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/preview/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/preview/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/preview/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/preview/route.js +7 -0
- package/.next/server/app/api/ide/openclaw/preview/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/preview/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/preview/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/restore/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/restore/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/restore/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/restore/route.js +6 -0
- package/.next/server/app/api/ide/openclaw/restore/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/restore/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/restore/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/save/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/save/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/save/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/save/route.js +7 -0
- package/.next/server/app/api/ide/openclaw/save/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/save/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/save/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/status/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/status/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/status/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/status/route.js +7 -0
- package/.next/server/app/api/ide/openclaw/status/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/status/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/status/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/openclaw/test/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/openclaw/test/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/openclaw/test/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/openclaw/test/route.js +6 -0
- package/.next/server/app/api/ide/openclaw/test/route.js.map +5 -0
- package/.next/server/app/api/ide/openclaw/test/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/openclaw/test/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/apply/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/apply/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/apply/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/apply/route.js +7 -0
- package/.next/server/app/api/ide/opencode/apply/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/apply/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/apply/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/available-models/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/available-models/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/available-models/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/available-models/route.js +7 -0
- package/.next/server/app/api/ide/opencode/available-models/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/available-models/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/available-models/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/preview/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/preview/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/preview/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/preview/route.js +7 -0
- package/.next/server/app/api/ide/opencode/preview/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/preview/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/preview/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/restore/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/restore/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/restore/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/restore/route.js +6 -0
- package/.next/server/app/api/ide/opencode/restore/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/restore/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/restore/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/save/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/save/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/save/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/save/route.js +7 -0
- package/.next/server/app/api/ide/opencode/save/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/save/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/save/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/status/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/status/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/status/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/status/route.js +7 -0
- package/.next/server/app/api/ide/opencode/status/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/status/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/status/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/ide/opencode/test/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/ide/opencode/test/route/build-manifest.json +11 -0
- package/.next/server/app/api/ide/opencode/test/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/ide/opencode/test/route.js +6 -0
- package/.next/server/app/api/ide/opencode/test/route.js.map +5 -0
- package/.next/server/app/api/ide/opencode/test/route.js.nft.json +1 -0
- package/.next/server/app/api/ide/opencode/test/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/logs/route.js.nft.json +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/.next/server/app/api/providers/test/route.js.nft.json +1 -1
- package/.next/server/app/api/service/force-stop/route.js.nft.json +1 -1
- package/.next/server/app/api/service/start/route.js.nft.json +1 -1
- package/.next/server/app/api/service/status/route.js.nft.json +1 -1
- package/.next/server/app/api/service/stop/route.js.nft.json +1 -1
- package/.next/server/app/ide/page.js +1 -1
- package/.next/server/app/ide/page.js.nft.json +1 -1
- package/.next/server/app/ide/page_client-reference-manifest.js +1 -1
- package/.next/server/app/ide.html +1 -1
- package/.next/server/app/ide.rsc +3 -3
- package/.next/server/app/ide.segments/_full.segment.rsc +3 -3
- package/.next/server/app/ide.segments/_head.segment.rsc +1 -1
- package/.next/server/app/ide.segments/_index.segment.rsc +2 -2
- package/.next/server/app/ide.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/ide.segments/ide/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/ide.segments/ide.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/logs/page.js +1 -1
- package/.next/server/app/logs/page.js.nft.json +1 -1
- package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/logs.html +1 -1
- package/.next/server/app/logs.rsc +3 -3
- package/.next/server/app/logs.segments/_full.segment.rsc +3 -3
- package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
- package/.next/server/app/models/page.js +1 -1
- package/.next/server/app/models/page.js.nft.json +1 -1
- package/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/server/app/models.html +1 -1
- package/.next/server/app/models.rsc +2 -2
- package/.next/server/app/models.segments/_full.segment.rsc +2 -2
- package/.next/server/app/models.segments/_head.segment.rsc +1 -1
- package/.next/server/app/models.segments/_index.segment.rsc +2 -2
- package/.next/server/app/models.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/models.segments/models/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/models.segments/models.segment.rsc +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/providers/page.js +1 -1
- package/.next/server/app/providers/page.js.nft.json +1 -1
- package/.next/server/app/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/providers.html +1 -1
- package/.next/server/app/providers.rsc +2 -2
- package/.next/server/app/providers.segments/_full.segment.rsc +2 -2
- package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/providers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/providers.segments/providers.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +14 -0
- package/.next/server/chunks/[root-of-the-server]__001d5756._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__001d5756._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__05f8578b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__05f8578b._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__1480f018._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1480f018._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__1909f3aa._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1909f3aa._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__1d4b7fc5._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1d4b7fc5._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__372ef2bf._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__372ef2bf._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__3aaf963c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__3aaf963c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__43810962._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__43810962._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__6ce199d2._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__6ce199d2._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__760eaa16._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__760eaa16._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__772134c6._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__772134c6._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__7b77f523._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__7b77f523._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__7c298a19._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__7c298a19._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__85540228._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__85540228._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__97622908._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__97622908._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__a02e6618._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a02e6618._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__af5b556a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__af5b556a._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js +18 -18
- package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__cafe113e._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__cafe113e._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__ccfc7f1d._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__ccfc7f1d._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__f8949f88._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__f8949f88._.js.map +1 -1
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js.map +1 -0
- package/.next/server/chunks/ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js +3 -0
- package/.next/server/chunks/ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js.map +1 -0
- package/.next/server/chunks/ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js +3 -0
- package/.next/server/chunks/ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js.map +1 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__bec95712._.js → [root-of-the-server]__81937253._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__bec95712._.js.map → [root-of-the-server]__81937253._.js.map} +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__71c85955._.js → [root-of-the-server]__976ad963._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__71c85955._.js.map → [root-of-the-server]__976ad963._.js.map} +1 -1
- package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js +1 -1
- package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js.map +1 -1
- package/.next/server/chunks/ssr/src_app_logs_page_tsx_7b7b7b83._.js +1 -1
- package/.next/server/chunks/ssr/src_app_logs_page_tsx_7b7b7b83._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/static/chunks/0f120c117962200b.css +1 -0
- package/.next/static/chunks/64f547b3bcd3aef4.js +1 -0
- package/.next/static/chunks/{81c904164fe81379.js → 7c8b7cbb3339f139.js} +1 -1
- package/.next/static/chunks/8ed839b2e4948968.js +1 -0
- package/.next/types/routes.d.ts +15 -1
- package/.next/types/validator.ts +126 -0
- package/README.md +100 -111
- package/dist/.next/dev/types/validator.js +56 -0
- package/dist/.next/types/validator.js +56 -0
- package/dist/src/app/api/gateway/[...path]/route.js +1 -1
- package/dist/src/app/api/gateway/route.js +1 -1
- package/dist/src/app/api/ide/claude/apply/route.js +42 -31
- package/dist/src/app/api/ide/claude/status/route.js +6 -1
- package/dist/src/app/api/ide/openclaw/apply/route.js +92 -0
- package/dist/src/app/api/ide/openclaw/available-models/route.js +46 -0
- package/dist/src/app/api/ide/openclaw/build-config.js +101 -0
- package/dist/src/app/api/ide/openclaw/preview/route.js +49 -0
- package/dist/src/app/api/ide/openclaw/restore/route.js +24 -0
- package/dist/src/app/api/ide/openclaw/save/route.js +54 -0
- package/dist/src/app/api/ide/openclaw/status/route.js +139 -0
- package/dist/src/app/api/ide/openclaw/test/route.js +158 -0
- package/dist/src/app/api/ide/opencode/apply/route.js +89 -0
- package/dist/src/app/api/ide/opencode/available-models/route.js +46 -0
- package/dist/src/app/api/ide/opencode/build-config.js +54 -0
- package/dist/src/app/api/ide/opencode/preview/route.js +36 -0
- package/dist/src/app/api/ide/opencode/restore/route.js +40 -0
- package/dist/src/app/api/ide/opencode/save/route.js +123 -0
- package/dist/src/app/api/ide/opencode/status/route.js +106 -0
- package/dist/src/app/api/ide/opencode/test/route.js +136 -0
- package/dist/src/app/api/logs/route.js +2 -2
- package/dist/src/app/api/models/route.js +5 -5
- package/dist/src/app/api/providers/route.js +4 -4
- package/dist/src/app/api/providers/test/route.js +1 -1
- package/dist/src/app/api/service/start/route.js +1 -1
- package/dist/src/app/api/service/status/route.js +1 -1
- package/dist/src/app/api/service/stop/route.js +1 -1
- package/dist/src/app/ide/page.js +591 -81
- package/dist/src/app/logs/page.js +15 -1
- package/dist/src/cli/index.js +218 -20
- package/dist/src/db/database.js +56 -5
- package/dist/src/db/queries.js +6 -6
- package/dist/src/server/logger.js +22 -4
- package/package.json +2 -1
- package/src/app/api/gateway/[...path]/route.ts +1 -1
- package/src/app/api/gateway/route.ts +1 -1
- package/src/app/api/ide/claude/apply/route.ts +46 -31
- package/src/app/api/ide/claude/status/route.ts +12 -2
- package/src/app/api/ide/openclaw/apply/route.ts +103 -0
- package/src/app/api/ide/openclaw/available-models/route.ts +59 -0
- package/src/app/api/ide/openclaw/build-config.ts +152 -0
- package/src/app/api/ide/openclaw/preview/route.ts +57 -0
- package/src/app/api/ide/openclaw/restore/route.ts +27 -0
- package/src/app/api/ide/openclaw/save/route.ts +67 -0
- package/src/app/api/ide/openclaw/status/route.ts +178 -0
- package/src/app/api/ide/openclaw/test/route.ts +194 -0
- package/src/app/api/ide/opencode/apply/route.ts +92 -0
- package/src/app/api/ide/opencode/available-models/route.ts +59 -0
- package/src/app/api/ide/opencode/build-config.ts +69 -0
- package/src/app/api/ide/opencode/preview/route.ts +40 -0
- package/src/app/api/ide/opencode/restore/route.ts +52 -0
- package/src/app/api/ide/opencode/save/route.ts +131 -0
- package/src/app/api/ide/opencode/status/route.ts +128 -0
- package/src/app/api/ide/opencode/test/route.ts +145 -0
- package/src/app/api/logs/route.ts +2 -2
- package/src/app/api/models/route.ts +5 -5
- package/src/app/api/providers/route.ts +4 -4
- package/src/app/api/providers/test/route.ts +1 -1
- package/src/app/api/service/start/route.ts +1 -1
- package/src/app/api/service/status/route.ts +1 -1
- package/src/app/api/service/stop/route.ts +1 -1
- package/src/app/globals.css +17 -0
- package/src/app/ide/page.tsx +1535 -132
- package/src/app/logs/page.tsx +17 -5
- package/src/cli/index.ts +228 -25
- package/src/db/database.ts +60 -8
- package/src/db/queries.ts +6 -6
- package/src/server/logger.ts +19 -4
- package/.next/static/chunks/6418ca50028376b7.css +0 -1
- package/.next/static/chunks/9ec3b97741b6575e.js +0 -1
- /package/.next/static/{PkfqdzwOZgX-UhSNUuhdp → dYin74gcpdlg8TGoGv-_d}/_buildManifest.js +0 -0
- /package/.next/static/{PkfqdzwOZgX-UhSNUuhdp → dYin74gcpdlg8TGoGv-_d}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{PkfqdzwOZgX-UhSNUuhdp → dYin74gcpdlg8TGoGv-_d}/_ssgManifest.js +0 -0
package/dist/src/app/ide/page.js
CHANGED
|
@@ -18,6 +18,7 @@ function IDEConfigPage() {
|
|
|
18
18
|
const [reasoningModel, setReasoningModel] = (0, react_1.useState)('GLM-4.7');
|
|
19
19
|
const [enabled, setEnabled] = (0, react_1.useState)(false);
|
|
20
20
|
const [showPreview, setShowPreview] = (0, react_1.useState)(false);
|
|
21
|
+
const [claudeConfigSubTab, setClaudeConfigSubTab] = (0, react_1.useState)('preview');
|
|
21
22
|
const [applying, setApplying] = (0, react_1.useState)(false);
|
|
22
23
|
const [restoring, setRestoring] = (0, react_1.useState)(false);
|
|
23
24
|
const [testing, setTesting] = (0, react_1.useState)(false);
|
|
@@ -26,9 +27,50 @@ function IDEConfigPage() {
|
|
|
26
27
|
const [models, setModels] = (0, react_1.useState)({});
|
|
27
28
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
28
29
|
const [testResult, setTestResult] = (0, react_1.useState)(null);
|
|
30
|
+
// OpenCode
|
|
31
|
+
const [opencodeDefaultModel, setOpencodeDefaultModel] = (0, react_1.useState)('GLM-4.7');
|
|
32
|
+
const [opencodeStatus, setOpencodeStatus] = (0, react_1.useState)(null);
|
|
33
|
+
const [opencodeApplying, setOpencodeApplying] = (0, react_1.useState)(false);
|
|
34
|
+
const [opencodeRestoring, setOpencodeRestoring] = (0, react_1.useState)(false);
|
|
35
|
+
const [opencodeTesting, setOpencodeTesting] = (0, react_1.useState)(false);
|
|
36
|
+
const [opencodeSaving, setOpencodeSaving] = (0, react_1.useState)(false);
|
|
37
|
+
const [opencodeTestResult, setOpencodeTestResult] = (0, react_1.useState)(null);
|
|
38
|
+
const [opencodeModels, setOpencodeModels] = (0, react_1.useState)({});
|
|
39
|
+
const [opencodePreviewConfig, setOpencodePreviewConfig] = (0, react_1.useState)(null);
|
|
40
|
+
const [opencodePreviewText, setOpencodePreviewText] = (0, react_1.useState)('');
|
|
41
|
+
const [opencodePreviewLoading, setOpencodePreviewLoading] = (0, react_1.useState)(false);
|
|
42
|
+
const [opencodeConfigSubTab, setOpencodeConfigSubTab] = (0, react_1.useState)('current');
|
|
43
|
+
// OpenClaw
|
|
44
|
+
const [openclawDefaultModel, setOpenclawDefaultModel] = (0, react_1.useState)('GLM-4.7');
|
|
45
|
+
const [openclawDefaultFallbacks, setOpenclawDefaultFallbacks] = (0, react_1.useState)([]);
|
|
46
|
+
const [openclawImageModel, setOpenclawImageModel] = (0, react_1.useState)('');
|
|
47
|
+
const [openclawImageFallbacks, setOpenclawImageFallbacks] = (0, react_1.useState)([]);
|
|
48
|
+
const [openclawStatus, setOpenclawStatus] = (0, react_1.useState)(null);
|
|
49
|
+
const [openclawApplying, setOpenclawApplying] = (0, react_1.useState)(false);
|
|
50
|
+
const [openclawRestoring, setOpenclawRestoring] = (0, react_1.useState)(false);
|
|
51
|
+
const [openclawTesting, setOpenclawTesting] = (0, react_1.useState)(false);
|
|
52
|
+
const [openclawSaving, setOpenclawSaving] = (0, react_1.useState)(false);
|
|
53
|
+
const [openclawTestResult, setOpenclawTestResult] = (0, react_1.useState)(null);
|
|
54
|
+
const [openclawModels, setOpenclawModels] = (0, react_1.useState)({});
|
|
55
|
+
const [openclawPreviewConfig, setOpenclawPreviewConfig] = (0, react_1.useState)(null);
|
|
56
|
+
const [openclawPreviewText, setOpenclawPreviewText] = (0, react_1.useState)('');
|
|
57
|
+
const [openclawPreviewLoading, setOpenclawPreviewLoading] = (0, react_1.useState)(false);
|
|
58
|
+
const [openClawDropdown, setOpenClawDropdown] = (0, react_1.useState)(null);
|
|
59
|
+
const [openClawSearch, setOpenClawSearch] = (0, react_1.useState)('');
|
|
60
|
+
const [openclawConfigSubTab, setOpenclawConfigSubTab] = (0, react_1.useState)('preview');
|
|
61
|
+
const openClawDropdownRef = (0, react_1.useRef)(null);
|
|
29
62
|
const { showToast } = (0, ToastProvider_1.useToast)();
|
|
63
|
+
const openclawModelsFlat = (0, react_1.useMemo)(() => Object.entries(openclawModels).flatMap(([provider, arr]) => arr.map((m) => ({ ...m, provider }))), [openclawModels]);
|
|
64
|
+
const openclawModelsFiltered = (0, react_1.useMemo)(() => {
|
|
65
|
+
const q = openClawSearch.trim().toLowerCase();
|
|
66
|
+
if (!q)
|
|
67
|
+
return openclawModelsFlat;
|
|
68
|
+
return openclawModelsFlat.filter((m) => m.name.toLowerCase().includes(q) || m.model_id.toLowerCase().includes(q));
|
|
69
|
+
}, [openclawModelsFlat, openClawSearch]);
|
|
30
70
|
// Abort controller for cancelling test
|
|
31
71
|
const abortControllerRef = (0, react_1.useRef)(null);
|
|
72
|
+
const opencodeAbortRef = (0, react_1.useRef)(null);
|
|
73
|
+
const openclawAbortRef = (0, react_1.useRef)(null);
|
|
32
74
|
const loadStatus = async () => {
|
|
33
75
|
try {
|
|
34
76
|
const res = await fetch('/api/ide/claude/status');
|
|
@@ -65,10 +107,163 @@ function IDEConfigPage() {
|
|
|
65
107
|
console.error('Failed to load models:', error);
|
|
66
108
|
}
|
|
67
109
|
};
|
|
110
|
+
const loadOpenCodeStatus = async () => {
|
|
111
|
+
try {
|
|
112
|
+
const res = await fetch('/api/ide/opencode/status');
|
|
113
|
+
const data = await res.json();
|
|
114
|
+
setOpencodeStatus(data);
|
|
115
|
+
const toUse = (data.matchCurrentGateway === false && data.tempDefaultModel)
|
|
116
|
+
? data.tempDefaultModel
|
|
117
|
+
: data.defaultModel;
|
|
118
|
+
if (toUse)
|
|
119
|
+
setOpencodeDefaultModel(toUse);
|
|
120
|
+
else if (data.defaultModel)
|
|
121
|
+
setOpencodeDefaultModel(data.defaultModel);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
console.error('Failed to load OpenCode status:', error);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const loadOpenCodeModels = async () => {
|
|
128
|
+
try {
|
|
129
|
+
const res = await fetch('/api/ide/opencode/available-models');
|
|
130
|
+
const data = await res.json();
|
|
131
|
+
setOpencodeModels(data.models || {});
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error('Failed to load OpenCode models:', error);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const loadOpenClawStatus = async () => {
|
|
138
|
+
try {
|
|
139
|
+
const res = await fetch('/api/ide/openclaw/status');
|
|
140
|
+
const data = await res.json();
|
|
141
|
+
setOpenclawStatus(data);
|
|
142
|
+
// Determine which values to use (temp or applied)
|
|
143
|
+
const useTemp = data.matchCurrentGateway === false && data.tempDefaultModel;
|
|
144
|
+
if (useTemp) {
|
|
145
|
+
setOpenclawDefaultModel(data.tempDefaultModel || 'GLM-4.7');
|
|
146
|
+
setOpenclawDefaultFallbacks(data.tempDefaultFallbacks || []);
|
|
147
|
+
setOpenclawImageModel(data.tempImageModel || '');
|
|
148
|
+
setOpenclawImageFallbacks(data.tempImageFallbacks || []);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
setOpenclawDefaultModel(data.defaultModel || 'GLM-4.7');
|
|
152
|
+
setOpenclawDefaultFallbacks(data.defaultFallbacks || []);
|
|
153
|
+
setOpenclawImageModel(data.imageModel || '');
|
|
154
|
+
setOpenclawImageFallbacks(data.imageFallbacks || []);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.error('Failed to load OpenClaw status:', error);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const loadOpenClawModels = async () => {
|
|
162
|
+
try {
|
|
163
|
+
const res = await fetch('/api/ide/openclaw/available-models');
|
|
164
|
+
const data = await res.json();
|
|
165
|
+
setOpenclawModels(data.models || {});
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.error('Failed to load OpenClaw models:', error);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
68
171
|
(0, react_1.useEffect)(() => {
|
|
69
172
|
loadStatus();
|
|
70
173
|
loadModels();
|
|
174
|
+
loadOpenCodeStatus();
|
|
175
|
+
loadOpenCodeModels();
|
|
176
|
+
loadOpenClawStatus();
|
|
177
|
+
loadOpenClawModels();
|
|
71
178
|
}, []);
|
|
179
|
+
// OpenCode Preview
|
|
180
|
+
(0, react_1.useEffect)(() => {
|
|
181
|
+
if (activeTab !== 'opencode' || !opencodeDefaultModel) {
|
|
182
|
+
setOpencodePreviewConfig(null);
|
|
183
|
+
setOpencodePreviewText('');
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
let cancelled = false;
|
|
187
|
+
setOpencodePreviewLoading(true);
|
|
188
|
+
setOpencodePreviewConfig(null);
|
|
189
|
+
setOpencodePreviewText('');
|
|
190
|
+
fetch(`/api/ide/opencode/preview?default_model=${encodeURIComponent(opencodeDefaultModel)}`)
|
|
191
|
+
.then((res) => res.json())
|
|
192
|
+
.then((data) => {
|
|
193
|
+
if (!cancelled && data.config) {
|
|
194
|
+
setOpencodePreviewConfig(data.config);
|
|
195
|
+
setOpencodePreviewText(JSON.stringify(data.config, null, 2));
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
.catch(() => {
|
|
199
|
+
if (!cancelled)
|
|
200
|
+
setOpencodePreviewConfig(null);
|
|
201
|
+
if (!cancelled)
|
|
202
|
+
setOpencodePreviewText('');
|
|
203
|
+
})
|
|
204
|
+
.finally(() => {
|
|
205
|
+
if (!cancelled)
|
|
206
|
+
setOpencodePreviewLoading(false);
|
|
207
|
+
});
|
|
208
|
+
return () => {
|
|
209
|
+
cancelled = true;
|
|
210
|
+
};
|
|
211
|
+
}, [activeTab, opencodeDefaultModel]);
|
|
212
|
+
// OpenClaw Preview
|
|
213
|
+
(0, react_1.useEffect)(() => {
|
|
214
|
+
if (activeTab !== 'openclaw' || !openclawDefaultModel) {
|
|
215
|
+
setOpenclawPreviewConfig(null);
|
|
216
|
+
setOpenclawPreviewText('');
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
let cancelled = false;
|
|
220
|
+
setOpenclawPreviewLoading(true);
|
|
221
|
+
setOpenclawPreviewConfig(null);
|
|
222
|
+
setOpenclawPreviewText('');
|
|
223
|
+
const params = new URLSearchParams({
|
|
224
|
+
default_model: openclawDefaultModel,
|
|
225
|
+
default_fallbacks: openclawDefaultFallbacks.join(','),
|
|
226
|
+
});
|
|
227
|
+
if (openclawImageModel) {
|
|
228
|
+
params.set('image_model', openclawImageModel);
|
|
229
|
+
if (openclawImageFallbacks.length > 0) {
|
|
230
|
+
params.set('image_fallbacks', openclawImageFallbacks.join(','));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
fetch(`/api/ide/openclaw/preview?${params.toString()}`)
|
|
234
|
+
.then((res) => res.json())
|
|
235
|
+
.then((data) => {
|
|
236
|
+
if (!cancelled && data.config) {
|
|
237
|
+
setOpenclawPreviewConfig(data.config);
|
|
238
|
+
setOpenclawPreviewText(JSON.stringify(data.config, null, 2));
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
.catch(() => {
|
|
242
|
+
if (!cancelled)
|
|
243
|
+
setOpenclawPreviewConfig(null);
|
|
244
|
+
if (!cancelled)
|
|
245
|
+
setOpenclawPreviewText('');
|
|
246
|
+
})
|
|
247
|
+
.finally(() => {
|
|
248
|
+
if (!cancelled)
|
|
249
|
+
setOpenclawPreviewLoading(false);
|
|
250
|
+
});
|
|
251
|
+
return () => {
|
|
252
|
+
cancelled = true;
|
|
253
|
+
};
|
|
254
|
+
}, [activeTab, openclawDefaultModel, openclawDefaultFallbacks, openclawImageModel, openclawImageFallbacks]);
|
|
255
|
+
(0, react_1.useEffect)(() => {
|
|
256
|
+
if (openClawDropdown == null)
|
|
257
|
+
return;
|
|
258
|
+
const onDocClick = (e) => {
|
|
259
|
+
if (openClawDropdownRef.current && !openClawDropdownRef.current.contains(e.target)) {
|
|
260
|
+
setOpenClawDropdown(null);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
document.addEventListener('mousedown', onDocClick);
|
|
264
|
+
return () => document.removeEventListener('mousedown', onDocClick);
|
|
265
|
+
}, [openClawDropdown]);
|
|
266
|
+
// Claude Handlers
|
|
72
267
|
const handleApply = async () => {
|
|
73
268
|
setApplying(true);
|
|
74
269
|
try {
|
|
@@ -109,6 +304,7 @@ function IDEConfigPage() {
|
|
|
109
304
|
const data = await res.json();
|
|
110
305
|
if (data.success) {
|
|
111
306
|
showToast('配置已还原', 'success');
|
|
307
|
+
setClaudeConfigSubTab('current');
|
|
112
308
|
await loadStatus();
|
|
113
309
|
}
|
|
114
310
|
else {
|
|
@@ -200,89 +396,403 @@ function IDEConfigPage() {
|
|
|
200
396
|
setSaving(false);
|
|
201
397
|
}
|
|
202
398
|
};
|
|
399
|
+
// OpenCode Handlers
|
|
400
|
+
const opencodeEnabled = opencodeStatus?.applied && opencodeStatus?.routerProvider === 'aar';
|
|
401
|
+
const handleOpenCodeApply = async () => {
|
|
402
|
+
setOpencodeApplying(true);
|
|
403
|
+
try {
|
|
404
|
+
const res = await fetch('/api/ide/opencode/apply', {
|
|
405
|
+
method: 'POST',
|
|
406
|
+
headers: { 'Content-Type': 'application/json' },
|
|
407
|
+
body: JSON.stringify({
|
|
408
|
+
default_model: opencodeDefaultModel,
|
|
409
|
+
...(opencodePreviewText.trim() ? { config: opencodePreviewText } : {}),
|
|
410
|
+
}),
|
|
411
|
+
});
|
|
412
|
+
const data = await res.json();
|
|
413
|
+
if (data.success) {
|
|
414
|
+
showToast(data.message || 'OpenCode 配置应用成功', 'success');
|
|
415
|
+
await loadOpenCodeStatus();
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
showToast('应用失败: ' + (data.error || '未知错误'), 'error');
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
console.error('Failed to apply OpenCode config:', error);
|
|
423
|
+
showToast('应用失败: 网络错误', 'error');
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
setOpencodeApplying(false);
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
const handleOpenCodeRestore = async () => {
|
|
430
|
+
setOpencodeRestoring(true);
|
|
431
|
+
try {
|
|
432
|
+
const res = await fetch('/api/ide/opencode/restore', { method: 'POST' });
|
|
433
|
+
const data = await res.json();
|
|
434
|
+
if (data.success) {
|
|
435
|
+
showToast('OpenCode 配置已还原', 'success');
|
|
436
|
+
setOpencodeConfigSubTab('current');
|
|
437
|
+
await loadOpenCodeStatus();
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
showToast('还原失败: ' + (data.error || '未知错误'), 'error');
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
console.error('Failed to restore OpenCode config:', error);
|
|
445
|
+
showToast('还原失败: 网络错误', 'error');
|
|
446
|
+
}
|
|
447
|
+
finally {
|
|
448
|
+
setOpencodeRestoring(false);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const handleOpenCodeTest = async () => {
|
|
452
|
+
if (opencodeAbortRef.current) {
|
|
453
|
+
opencodeAbortRef.current.abort();
|
|
454
|
+
opencodeAbortRef.current = null;
|
|
455
|
+
}
|
|
456
|
+
opencodeAbortRef.current = new AbortController();
|
|
457
|
+
setOpencodeTesting(true);
|
|
458
|
+
setOpencodeTestResult(null);
|
|
459
|
+
try {
|
|
460
|
+
const res = await fetch('/api/ide/opencode/test', { signal: opencodeAbortRef.current.signal });
|
|
461
|
+
const data = await res.json();
|
|
462
|
+
setOpencodeTestResult(data);
|
|
463
|
+
if (data.success)
|
|
464
|
+
showToast('OpenCode 配置测试通过', 'success');
|
|
465
|
+
else
|
|
466
|
+
showToast('配置验证失败: ' + (data.error || data.suggestion || '请检查配置'), 'error');
|
|
467
|
+
}
|
|
468
|
+
catch (err) {
|
|
469
|
+
if (err.name === 'AbortError')
|
|
470
|
+
showToast('测试已取消', 'info');
|
|
471
|
+
else {
|
|
472
|
+
showToast('测试失败: 网络错误', 'error');
|
|
473
|
+
setOpencodeTestResult({ error: 'Network error' });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
finally {
|
|
477
|
+
if (opencodeAbortRef.current?.signal.aborted === false)
|
|
478
|
+
opencodeAbortRef.current = null;
|
|
479
|
+
setOpencodeTesting(false);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
const handleOpenCodeSave = async () => {
|
|
483
|
+
setOpencodeSaving(true);
|
|
484
|
+
try {
|
|
485
|
+
const res = await fetch('/api/ide/opencode/save', {
|
|
486
|
+
method: 'POST',
|
|
487
|
+
headers: { 'Content-Type': 'application/json' },
|
|
488
|
+
body: JSON.stringify({
|
|
489
|
+
default_model: opencodeDefaultModel,
|
|
490
|
+
...(opencodePreviewText.trim() ? { config: opencodePreviewText } : {}),
|
|
491
|
+
}),
|
|
492
|
+
});
|
|
493
|
+
const data = await res.json();
|
|
494
|
+
if (data.success) {
|
|
495
|
+
showToast(data.saveType === 'temp' ? '配置已保存(临时)' : '配置已更新到 OpenCode', 'success');
|
|
496
|
+
await loadOpenCodeStatus();
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
showToast('保存失败: ' + (data.error || '未知错误'), 'error');
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
console.error('Failed to save OpenCode config:', error);
|
|
504
|
+
showToast('保存失败: 网络错误', 'error');
|
|
505
|
+
}
|
|
506
|
+
finally {
|
|
507
|
+
setOpencodeSaving(false);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
const handleOpenCodeCancelTest = () => {
|
|
511
|
+
if (opencodeAbortRef.current) {
|
|
512
|
+
opencodeAbortRef.current.abort();
|
|
513
|
+
opencodeAbortRef.current = null;
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
// OpenClaw Handlers
|
|
517
|
+
const openclawEnabled = openclawStatus?.applied && openclawStatus?.routerProvider === 'aar';
|
|
518
|
+
const handleOpenClawApply = async () => {
|
|
519
|
+
setOpenclawApplying(true);
|
|
520
|
+
try {
|
|
521
|
+
const res = await fetch('/api/ide/openclaw/apply', {
|
|
522
|
+
method: 'POST',
|
|
523
|
+
headers: { 'Content-Type': 'application/json' },
|
|
524
|
+
body: JSON.stringify({
|
|
525
|
+
default_model: openclawDefaultModel,
|
|
526
|
+
default_fallbacks: openclawDefaultFallbacks,
|
|
527
|
+
image_model: openclawImageModel || undefined,
|
|
528
|
+
image_fallbacks: openclawImageFallbacks,
|
|
529
|
+
...(openclawPreviewText.trim() ? { config: openclawPreviewText } : {}),
|
|
530
|
+
}),
|
|
531
|
+
});
|
|
532
|
+
const data = await res.json();
|
|
533
|
+
if (data.success) {
|
|
534
|
+
showToast(data.message || 'OpenClaw 配置应用成功', 'success');
|
|
535
|
+
await loadOpenClawStatus();
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
showToast('应用失败: ' + (data.error || '未知错误'), 'error');
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
catch (error) {
|
|
542
|
+
console.error('Failed to apply OpenClaw config:', error);
|
|
543
|
+
showToast('应用失败: 网络错误', 'error');
|
|
544
|
+
}
|
|
545
|
+
finally {
|
|
546
|
+
setOpenclawApplying(false);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const handleOpenClawRestore = async () => {
|
|
550
|
+
setOpenclawRestoring(true);
|
|
551
|
+
try {
|
|
552
|
+
const res = await fetch('/api/ide/openclaw/restore', { method: 'POST' });
|
|
553
|
+
const data = await res.json();
|
|
554
|
+
if (data.success) {
|
|
555
|
+
showToast('OpenClaw 配置已还原', 'success');
|
|
556
|
+
setOpenclawConfigSubTab('current');
|
|
557
|
+
await loadOpenClawStatus();
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
showToast('还原失败: ' + (data.error || '未知错误'), 'error');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
catch (error) {
|
|
564
|
+
console.error('Failed to restore OpenClaw config:', error);
|
|
565
|
+
showToast('还原失败: 网络错误', 'error');
|
|
566
|
+
}
|
|
567
|
+
finally {
|
|
568
|
+
setOpenclawRestoring(false);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const handleOpenClawTest = async () => {
|
|
572
|
+
if (openclawAbortRef.current) {
|
|
573
|
+
openclawAbortRef.current.abort();
|
|
574
|
+
openclawAbortRef.current = null;
|
|
575
|
+
}
|
|
576
|
+
openclawAbortRef.current = new AbortController();
|
|
577
|
+
setOpenclawTesting(true);
|
|
578
|
+
setOpenclawTestResult(null);
|
|
579
|
+
try {
|
|
580
|
+
const res = await fetch('/api/ide/openclaw/test', { signal: openclawAbortRef.current.signal });
|
|
581
|
+
const data = await res.json();
|
|
582
|
+
setOpenclawTestResult(data);
|
|
583
|
+
if (data.success)
|
|
584
|
+
showToast('OpenClaw 配置测试通过', 'success');
|
|
585
|
+
else
|
|
586
|
+
showToast('配置验证失败: ' + (data.error || data.suggestion || '请检查配置'), 'error');
|
|
587
|
+
}
|
|
588
|
+
catch (err) {
|
|
589
|
+
if (err.name === 'AbortError')
|
|
590
|
+
showToast('测试已取消', 'info');
|
|
591
|
+
else {
|
|
592
|
+
showToast('测试失败: 网络错误', 'error');
|
|
593
|
+
setOpenclawTestResult({ error: 'Network error' });
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
finally {
|
|
597
|
+
if (openclawAbortRef.current?.signal.aborted === false)
|
|
598
|
+
openclawAbortRef.current = null;
|
|
599
|
+
setOpenclawTesting(false);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
const handleOpenClawSave = async () => {
|
|
603
|
+
setOpenclawSaving(true);
|
|
604
|
+
try {
|
|
605
|
+
const res = await fetch('/api/ide/openclaw/save', {
|
|
606
|
+
method: 'POST',
|
|
607
|
+
headers: { 'Content-Type': 'application/json' },
|
|
608
|
+
body: JSON.stringify({
|
|
609
|
+
default_model: openclawDefaultModel,
|
|
610
|
+
default_fallbacks: openclawDefaultFallbacks,
|
|
611
|
+
image_model: openclawImageModel || undefined,
|
|
612
|
+
image_fallbacks: openclawImageFallbacks,
|
|
613
|
+
...(openclawPreviewText.trim() ? { config: openclawPreviewText } : {}),
|
|
614
|
+
}),
|
|
615
|
+
});
|
|
616
|
+
const data = await res.json();
|
|
617
|
+
if (data.success) {
|
|
618
|
+
showToast(data.saveType === 'temp' ? '配置已保存(临时)' : '配置已更新到 OpenClaw', 'success');
|
|
619
|
+
await loadOpenClawStatus();
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
showToast('保存失败: ' + (data.error || '未知错误'), 'error');
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
catch (error) {
|
|
626
|
+
console.error('Failed to save OpenClaw config:', error);
|
|
627
|
+
showToast('保存失败: 网络错误', 'error');
|
|
628
|
+
}
|
|
629
|
+
finally {
|
|
630
|
+
setOpenclawSaving(false);
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
const handleOpenClawCancelTest = () => {
|
|
634
|
+
if (openclawAbortRef.current) {
|
|
635
|
+
openclawAbortRef.current.abort();
|
|
636
|
+
openclawAbortRef.current = null;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
203
639
|
if (loading) {
|
|
204
640
|
return ((0, jsx_runtime_1.jsx)("div", { className: "min-h-screen flex items-center justify-center bg-slate-50/80", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-8 h-8 border-2 border-slate-200 border-t-slate-900 rounded-full animate-spin" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xs font-medium text-slate-500", children: "\u52A0\u8F7D\u4E2D..." })] }) }));
|
|
205
641
|
}
|
|
206
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "min-h-screen bg-slate-50/80", children: [(0, jsx_runtime_1.jsx)(Nav_1.default, {}), (0, jsx_runtime_1.jsxs)("main", { className: "max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-12", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-10", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-semibold text-slate-900 tracking-tight", children: "IDE \u914D\u7F6E" }), (0, jsx_runtime_1.jsx)("span", { className: "px-2.5 py-0.5 text-xs font-medium text-slate-600 bg-slate-100/80 rounded-full border border-slate-200/50", children: "v1.0" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-slate-500", children: "\u914D\u7F6E Claude Code \u548C
|
|
642
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "min-h-screen bg-slate-50/80", children: [(0, jsx_runtime_1.jsx)(Nav_1.default, {}), (0, jsx_runtime_1.jsxs)("main", { className: "max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-12", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-10", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-semibold text-slate-900 tracking-tight", children: "IDE \u914D\u7F6E" }), (0, jsx_runtime_1.jsx)("span", { className: "px-2.5 py-0.5 text-xs font-medium text-slate-600 bg-slate-100/80 rounded-full border border-slate-200/50", children: "v1.0" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-slate-500", children: "\u914D\u7F6E Claude Code\u3001OpenCode \u548C OpenClaw \u7684\u6A21\u578B\u4EE3\u7406\u8BBE\u7F6E" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-white/60 backdrop-blur-md rounded-xl border border-slate-200/50 shadow-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b border-slate-200/50 bg-white/40", children: (0, jsx_runtime_1.jsxs)("nav", { className: "flex gap-1 px-5", "aria-label": "Tabs", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('claude'), className: `relative px-4 py-3.5 text-sm font-medium transition-all duration-200 ${activeTab === 'claude'
|
|
643
|
+
? 'text-slate-900'
|
|
644
|
+
: 'text-slate-400 hover:text-slate-600'}`, children: ["Claude Code", activeTab === 'claude' && ((0, jsx_runtime_1.jsx)("span", { className: "absolute bottom-0 left-4 right-4 h-[2px] bg-slate-900 rounded-full" }))] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('opencode'), className: `relative px-4 py-3.5 text-sm font-medium transition-all duration-200 ${activeTab === 'opencode'
|
|
645
|
+
? 'text-slate-900'
|
|
646
|
+
: 'text-slate-400 hover:text-slate-600'}`, children: ["OpenCode", activeTab === 'opencode' && ((0, jsx_runtime_1.jsx)("span", { className: "absolute bottom-0 left-4 right-4 h-[2px] bg-slate-900 rounded-full" }))] }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => setActiveTab('openclaw'), className: `relative px-4 py-3.5 text-sm font-medium transition-all duration-200 ${activeTab === 'openclaw'
|
|
207
647
|
? 'text-slate-900'
|
|
208
|
-
: 'text-slate-400 hover:text-slate-600'}`, children: ["
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
648
|
+
: 'text-slate-400 hover:text-slate-600'}`, children: ["OpenClaw", activeTab === 'openclaw' && ((0, jsx_runtime_1.jsx)("span", { className: "absolute bottom-0 left-4 right-4 h-[2px] bg-slate-900 rounded-full" }))] }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setActiveTab('cursor'), disabled: true, className: "relative px-4 py-3.5 text-sm font-medium text-slate-300 disabled:cursor-not-allowed", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: ["Cursor", (0, jsx_runtime_1.jsx)("span", { className: "px-2 py-0.5 text-[10px] font-medium text-slate-400 bg-slate-100/60 rounded-full border border-slate-200/50", children: "\u5373\u5C06\u63A8\u51FA" })] }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "p-5 sm:p-6", children: [activeTab === 'claude' && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [status && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3 px-4 bg-white/60 rounded-lg border border-slate-200/50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-6 h-6 rounded-full flex items-center justify-center ${status.applied
|
|
649
|
+
? 'bg-emerald-100 text-emerald-600'
|
|
650
|
+
: 'bg-slate-100 text-slate-400'}`, children: status.applied ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-slate-700", children: status.applied ? '已配置' : '未配置' }), status.applied && status.routerProvider === 'aar' && status.matchCurrentGateway !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: `inline-flex items-center px-2 py-0.5 text-[10px] font-medium rounded-full border ${status.matchCurrentGateway
|
|
651
|
+
? 'bg-emerald-50/80 text-emerald-700 border-emerald-200/60'
|
|
652
|
+
: 'bg-amber-50/80 text-amber-700 border-amber-200/60'}`, children: status.matchCurrentGateway ? '匹配配置' : '不匹配' }))] })] }), status.lastUpdated && ((0, jsx_runtime_1.jsx)("div", { className: "text-[11px] text-slate-400 font-mono", children: new Date(status.lastUpdated).toLocaleString('zh-CN', {
|
|
653
|
+
month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'
|
|
654
|
+
}) }))] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-[11px] font-medium text-slate-400 mb-5", children: "\u6A21\u578B\u6620\u5C04" }), (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
655
|
+
{
|
|
656
|
+
key: 'haiku',
|
|
657
|
+
label: 'Haiku',
|
|
658
|
+
icon: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M13 10V3L4 14h7v7l9-11h-7z" }) })),
|
|
659
|
+
description: '快速响应',
|
|
660
|
+
value: haikuModel,
|
|
661
|
+
onChange: setHaikuModel,
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
key: 'sonnet',
|
|
665
|
+
label: 'Sonnet',
|
|
666
|
+
icon: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" }) })),
|
|
667
|
+
description: '平衡性能',
|
|
668
|
+
value: sonnetModel,
|
|
669
|
+
onChange: setSonnetModel,
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
key: 'opus',
|
|
673
|
+
label: 'Opus',
|
|
674
|
+
icon: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9.663 17h4.673M12 3v1m6.364 5.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" }) })),
|
|
675
|
+
description: '深度思考',
|
|
676
|
+
value: opusModel,
|
|
677
|
+
onChange: setOpusModel,
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
key: 'default',
|
|
681
|
+
label: '默认',
|
|
682
|
+
icon: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" }) })),
|
|
683
|
+
description: '主要模型',
|
|
684
|
+
value: defaultModel,
|
|
685
|
+
onChange: setDefaultModel,
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
key: 'reasoning',
|
|
689
|
+
label: '推理',
|
|
690
|
+
icon: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 14.9a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 1.414l-5-5A2 2 0 009 10.172V5L8 4z" }) })),
|
|
691
|
+
description: '复杂推理',
|
|
692
|
+
value: reasoningModel,
|
|
693
|
+
onChange: setReasoningModel,
|
|
694
|
+
},
|
|
695
|
+
].map((config) => ((0, jsx_runtime_1.jsx)("div", { className: "group relative bg-gradient-to-br from-white/50 to-transparent hover:from-slate-50/60 rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: (0, jsx_runtime_1.jsxs)("label", { htmlFor: config.key, className: "cursor-pointer", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5 relative group/tip", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-slate-100/80 text-slate-600 flex items-center justify-center", children: config.icon }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2.5", children: (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: config.label }) }), (0, jsx_runtime_1.jsx)("div", { className: "absolute left-9 top-0 mt-8 w-28 rounded-lg bg-slate-900/95 backdrop-blur-md px-3 py-2 text-[10px] text-slate-200 shadow-xl opacity-0 invisible group-hover/tip:opacity-100 group-hover/tip:visible transition-all duration-200 z-10", children: config.description })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("select", { id: config.key, value: config.value, onChange: (e) => config.onChange(e.target.value), className: "w-full appearance-none rounded-lg border border-slate-200/80 bg-white/90 backdrop-blur-sm px-3 py-2 pr-7 text-[11px] font-medium text-slate-700 shadow-sm transition-all duration-200 hover:border-slate-300/80 hover:bg-white focus:border-slate-400/80 focus:ring-2 focus:ring-slate-200/50 focus:outline-none cursor-pointer", children: Object.entries(models).map(([provider, providerModels]) => ((0, jsx_runtime_1.jsx)("optgroup", { label: provider, children: providerModels.map((model) => ((0, jsx_runtime_1.jsx)("option", { value: model.model_id, children: model.name }, model.id))) }, provider))) }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-slate-500 mt-2.5 group-hover:text-slate-600 transition-colors", children: config.description })] }) }, config.key))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: `grid gap-3 pt-1 ${status?.backupExists ? 'grid-cols-3' : 'grid-cols-2'}`, children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleApply, disabled: applying, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-900 bg-slate-900 text-white hover:bg-slate-800 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", children: applying ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u5E94\u7528\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), enabled ? '更新配置' : '应用配置'] })) }), status?.backupExists && ((0, jsx_runtime_1.jsx)("button", { onClick: handleRestore, disabled: restoring, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:border-slate-300 hover:bg-slate-50 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", children: restoring ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u8FD8\u539F\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), "\u8FD8\u539F\u914D\u7F6E"] })) })), testing ? ((0, jsx_runtime_1.jsxs)("button", { onClick: handleCancelTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-amber-200/80 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u53D6\u6D88\u6D4B\u8BD5"] })) : ((0, jsx_runtime_1.jsxs)("button", { onClick: handleTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:bg-slate-50 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }), "\u6D4B\u8BD5\u914D\u7F6E"] }))] }), testResult && ((0, jsx_runtime_1.jsx)("div", { className: `rounded-lg border px-4 py-3 ${testResult.success
|
|
696
|
+
? 'bg-emerald-50/60 border-emerald-200/60'
|
|
697
|
+
: 'bg-rose-50/60 border-rose-200/60'}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${testResult.success ? 'bg-emerald-500' : 'bg-rose-500'}`, children: testResult.success ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs font-medium mb-1", children: testResult.success ? '配置验证成功' : '配置验证失败' }), (0, jsx_runtime_1.jsx)("p", { className: `text-[11px] ${testResult.success ? 'text-emerald-700/80' : 'text-rose-700/80'}`, children: testResult.success ? 'Claude Code 可以正常工作' : '请检查配置' }), testResult.checks && ((0, jsx_runtime_1.jsx)("div", { className: "mt-3 pt-3 border-t border-white/40", children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-3 gap-2", children: Object.entries(testResult.checks).map(([key, value]) => {
|
|
698
|
+
const labels = {
|
|
699
|
+
hasBaseUrl: '网关',
|
|
700
|
+
hasApiKey: 'API Key',
|
|
701
|
+
hasHaikuModel: 'Haiku',
|
|
702
|
+
hasSonnetModel: 'Sonnet',
|
|
703
|
+
hasOpusModel: 'Opus',
|
|
704
|
+
hasDefaultModel: '默认模型',
|
|
705
|
+
hasReasoningModel: '推理模型',
|
|
706
|
+
isFromAar: '来源'
|
|
707
|
+
};
|
|
708
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [value ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-emerald-500 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-rose-500 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] text-slate-600", children: labels[key] || key })] }, key));
|
|
709
|
+
}) }) })), testResult.claudeTest && ((0, jsx_runtime_1.jsx)("div", { className: "mt-3 pt-3 border-t border-white/40", children: testResult.claudeTest.success ? ((0, jsx_runtime_1.jsxs)("p", { className: "text-[10px] text-emerald-700", children: [testResult.claudeTest.message, testResult.claudeTest.output && ((0, jsx_runtime_1.jsxs)("span", { className: "text-[10px] text-slate-500 ml-1.5", children: ["\u8F93\u51FA: ", testResult.claudeTest.output] }))] })) : ((0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-rose-700 font-mono bg-rose-100/50 px-2 py-1 rounded inline-block", children: testResult.claudeTest.error })) })), testResult.configSummary && ((0, jsx_runtime_1.jsxs)("details", { className: "mt-3 group", children: [(0, jsx_runtime_1.jsxs)("summary", { className: "cursor-pointer text-[10px] text-slate-500 hover:text-slate-700 list-none flex items-center gap-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 transition-transform group-open:rotate-90", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }), "\u914D\u7F6E\u8BE6\u60C5"] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 space-y-1.5 text-[10px]", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1 border-b border-slate-200/40", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "\u7F51\u5173" }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-slate-700", children: testResult.configSummary.baseUrl })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1 border-b border-slate-200/40", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "API Key" }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-slate-700", children: testResult.configSummary.apiKey })] }), testResult.configSummary.routerProvider && ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1 border-b border-slate-200/40", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "\u6765\u6E90" }), (0, jsx_runtime_1.jsx)("span", { className: "text-slate-700", children: testResult.configSummary.routerProvider === 'aar' ? '当前工具' : testResult.configSummary.routerProvider })] })), testResult.configSummary.haikuModel !== 'not set' && ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1 border-b border-slate-200/40", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "Haiku" }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-slate-700", children: testResult.configSummary.haikuModel })] })), testResult.configSummary.sonnetModel !== 'not set' && ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1 border-b border-slate-200/40", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "Sonnet" }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-slate-700", children: testResult.configSummary.sonnetModel })] })), testResult.configSummary.opusModel !== 'not set' && ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between py-1", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-500", children: "Opus" }), (0, jsx_runtime_1.jsx)("span", { className: "font-mono text-slate-700", children: testResult.configSummary.opusModel })] }))] })] }))] })] }) })), (0, jsx_runtime_1.jsxs)("details", { className: "group", open: true, children: [(0, jsx_runtime_1.jsxs)("summary", { className: "cursor-pointer text-[11px] text-slate-500 hover:text-slate-700 list-none flex items-center gap-1.5 py-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 transition-transform group-open:rotate-90", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex border border-slate-200 rounded-t-lg overflow-hidden bg-slate-100/90", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setClaudeConfigSubTab('preview'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${claudeConfigSubTab === 'preview'
|
|
710
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
711
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u9884\u89C8" }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setClaudeConfigSubTab('current'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${claudeConfigSubTab === 'current'
|
|
712
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
713
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u751F\u6548\u4E2D" })] }), (0, jsx_runtime_1.jsx)("div", { className: "relative overflow-hidden rounded-b-lg bg-slate-950 border border-slate-200 border-t-0", children: claudeConfigSubTab === 'preview' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "settings.json\uFF08\u4EC5\u5F53\u524D\u7F51\u5173\u76F8\u5173\uFF0C\u5E94\u7528\u65F6\u4F1A\u5408\u5E76\u8FDB\u73B0\u6709\u914D\u7F6E\uFF09" })] }), (0, jsx_runtime_1.jsx)("pre", { className: "w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono overflow-auto bg-slate-950 max-h-96 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", children: JSON.stringify({
|
|
714
|
+
router_provider: 'aar',
|
|
715
|
+
env: {
|
|
716
|
+
ANTHROPIC_AUTH_TOKEN: status?.currentGatewayApiKey ?? 'your-gateway-api-key',
|
|
717
|
+
ANTHROPIC_BASE_URL: status?.currentGatewayAddress ?? 'http://localhost:1357',
|
|
718
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: haikuModel,
|
|
719
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: sonnetModel,
|
|
720
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: opusModel,
|
|
721
|
+
ANTHROPIC_MODEL: defaultModel,
|
|
722
|
+
ANTHROPIC_REASONING_MODEL: reasoningModel,
|
|
723
|
+
API_TIMEOUT_MS: '3000000',
|
|
724
|
+
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1,
|
|
725
|
+
hasCompletedOnboarding: true,
|
|
726
|
+
},
|
|
727
|
+
}, null, 2) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "settings.json\uFF08\u5F53\u524D\u78C1\u76D8\u5185\u5BB9\uFF0C\u8FD8\u539F\u540E\u5373\u66F4\u65B0\uFF09" })] }), status?.config != null ? ((0, jsx_runtime_1.jsx)("pre", { className: "w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono overflow-auto bg-slate-950 max-h-96 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", children: JSON.stringify(status.config, null, 2) })) : ((0, jsx_runtime_1.jsx)("div", { className: "p-3.5 text-[10px] text-slate-500 font-mono", children: "\u6682\u65E0\u914D\u7F6E\u6587\u4EF6" }))] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "rounded-lg border border-slate-200/50 bg-slate-50/60 px-4 py-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2.5", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4 text-slate-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-xs font-semibold text-slate-700", children: "\u4F7F\u7528\u8BF4\u660E" })] }), (0, jsx_runtime_1.jsxs)("ul", { className: "space-y-1.5 text-[10px] text-slate-600", children: [(0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "1." }), (0, jsx_runtime_1.jsx)("span", { children: "\u300C\u751F\u6548\u4E2D\u300D\u4E3A\u5F53\u524D\u78C1\u76D8\u4E0A\u7684 settings.json\uFF1B\u300C\u9884\u89C8\u300D\u4E3A\u5E94\u7528\u540E\u5C06\u5199\u5165\u7684\u5185\u5BB9" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "2." }), (0, jsx_runtime_1.jsx)("span", { children: "\u4E3A\u6BCF\u4E2A\u6A21\u578B\u7C7B\u522B\u9009\u62E9\u8DEF\u7531\u6A21\u578B\u540E\uFF0C\u5728\u300C\u9884\u89C8\u300D\u4E2D\u67E5\u770B\uFF0C\u70B9\u51FB\u300C\u5E94\u7528\u914D\u7F6E\u300D\u6216\u300C\u66F4\u65B0\u914D\u7F6E\u300D\u5199\u5165" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "3." }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E\u6587\u4EF6\u4F4D\u4E8E ~/.claude/settings.json" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "4." }), (0, jsx_runtime_1.jsx)("span", { children: "\u82E5\u5DF2\u5E94\u7528\u8FC7 AAR\uFF0C\u4F1A\u663E\u793A\u300C\u66F4\u65B0\u914D\u7F6E\u300D\uFF1B\u6709\u5907\u4EFD\u65F6\u300C\u8FD8\u539F\u914D\u7F6E\u300D\u53EF\u6062\u590D\uFF0C\u8FD8\u539F\u540E\u8BF7\u5728\u300C\u751F\u6548\u4E2D\u300D\u67E5\u770B" })] })] })] })] })), activeTab === 'opencode' && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [opencodeStatus && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3 px-4 bg-white/60 rounded-lg border border-slate-200/50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-6 h-6 rounded-full flex items-center justify-center ${opencodeStatus.applied
|
|
728
|
+
? 'bg-emerald-100 text-emerald-600'
|
|
729
|
+
: 'bg-slate-100 text-slate-400'}`, children: opencodeStatus.applied ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-slate-700", children: opencodeStatus.applied ? '已配置' : '未配置' }), opencodeStatus.applied && opencodeStatus.matchCurrentGateway !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: `inline-flex items-center px-2 py-0.5 text-[10px] font-medium rounded-full border ${opencodeStatus.matchCurrentGateway
|
|
730
|
+
? 'bg-emerald-50/80 text-emerald-700 border-emerald-200/60'
|
|
731
|
+
: 'bg-amber-50/80 text-amber-700 border-amber-200/60'}`, children: opencodeStatus.matchCurrentGateway ? '匹配当前网关' : '不匹配' }))] })] }), opencodeStatus.lastUpdated && ((0, jsx_runtime_1.jsx)("div", { className: "text-[11px] text-slate-400 font-mono", children: new Date(opencodeStatus.lastUpdated).toLocaleString('zh-CN', {
|
|
732
|
+
month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'
|
|
733
|
+
}) }))] })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-[11px] font-medium text-slate-400 mb-5", children: "\u9ED8\u8BA4\u6A21\u578B" }), (0, jsx_runtime_1.jsx)("div", { className: "group relative bg-gradient-to-br from-white/50 to-transparent hover:from-slate-50/60 rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: (0, jsx_runtime_1.jsxs)("label", { htmlFor: "opencode-default-model", className: "cursor-pointer", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-slate-100/80 text-slate-600 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" }) }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: "OpenCode \u4F7F\u7528\u7684\u9ED8\u8BA4\u6A21\u578B" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("select", { id: "opencode-default-model", value: opencodeDefaultModel, onChange: (e) => setOpencodeDefaultModel(e.target.value), className: "w-full appearance-none rounded-lg border border-slate-200/80 bg-white/90 backdrop-blur-sm px-3 py-2 pr-7 text-[11px] font-medium text-slate-700 shadow-sm transition-all duration-200 hover:border-slate-300/80 hover:bg-white focus:border-slate-400/80 focus:ring-2 focus:ring-slate-200/50 focus:outline-none cursor-pointer", children: Object.entries(opencodeModels).map(([provider, providerModels]) => ((0, jsx_runtime_1.jsx)("optgroup", { label: provider, children: providerModels.map((model) => ((0, jsx_runtime_1.jsx)("option", { value: model.model_id, children: model.name }, model.id))) }, provider))) }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) })] })] }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: `grid gap-3 pt-1 ${opencodeEnabled ? 'grid-cols-3' : 'grid-cols-2'}`, children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleOpenCodeApply, disabled: opencodeApplying, className: `w-full px-4 py-2.5 text-xs font-medium rounded-lg border transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 ${opencodeEnabled
|
|
734
|
+
? 'bg-white border-slate-200/80 text-slate-700 hover:border-slate-300 hover:bg-slate-50'
|
|
735
|
+
: 'bg-slate-900 border-slate-900 text-white hover:bg-slate-800'}`, children: opencodeApplying ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u5E94\u7528\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), opencodeEnabled ? '更新配置' : '应用配置'] })) }), opencodeEnabled && ((0, jsx_runtime_1.jsx)("button", { onClick: handleOpenCodeRestore, disabled: opencodeRestoring, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:border-slate-300 hover:bg-slate-50 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", children: opencodeRestoring ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u8FD8\u539F\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), "\u8FD8\u539F\u914D\u7F6E"] })) })), opencodeTesting ? ((0, jsx_runtime_1.jsxs)("button", { onClick: handleOpenCodeCancelTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-amber-200/80 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u53D6\u6D88\u6D4B\u8BD5"] })) : ((0, jsx_runtime_1.jsxs)("button", { onClick: handleOpenCodeTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:bg-slate-50 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }), "\u6D4B\u8BD5\u914D\u7F6E"] }))] }), opencodeTestResult && ((0, jsx_runtime_1.jsx)("div", { className: `rounded-lg border px-4 py-3 ${opencodeTestResult.success
|
|
736
|
+
? 'bg-emerald-50/60 border-emerald-200/60'
|
|
737
|
+
: 'bg-rose-50/60 border-rose-200/60'}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${opencodeTestResult.success ? 'bg-emerald-500' : 'bg-rose-500'}`, children: opencodeTestResult.success ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs font-medium mb-1", children: opencodeTestResult.success ? '配置验证成功' : '配置验证失败' }), (0, jsx_runtime_1.jsx)("p", { className: `text-[11px] ${opencodeTestResult.success ? 'text-emerald-700/80' : 'text-rose-700/80'}`, children: opencodeTestResult.success
|
|
738
|
+
? (opencodeTestResult.opencodeTest?.message || 'OpenCode 可以正常工作')
|
|
739
|
+
: (opencodeTestResult.opencodeTest?.error || opencodeTestResult.error || opencodeTestResult.suggestion || '请检查配置') }), opencodeTestResult.checks && ((0, jsx_runtime_1.jsx)("div", { className: "mt-3 pt-3 border-t border-white/40", children: (0, jsx_runtime_1.jsx)("div", { className: "grid grid-cols-3 gap-2", children: Object.entries(opencodeTestResult.checks).map(([key, value]) => {
|
|
740
|
+
const labels = {
|
|
741
|
+
hasBaseUrl: '网关',
|
|
742
|
+
hasApiKey: 'API Key',
|
|
743
|
+
hasDefaultModel: '默认模型',
|
|
744
|
+
hasModels: '模型列表',
|
|
745
|
+
};
|
|
746
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5", children: [value ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-emerald-500 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-rose-500 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] text-slate-600", children: labels[key] || key })] }, key));
|
|
747
|
+
}) }) }))] })] }) })), (0, jsx_runtime_1.jsxs)("details", { className: "group", open: true, children: [(0, jsx_runtime_1.jsxs)("summary", { className: "cursor-pointer text-[11px] text-slate-500 hover:text-slate-700 list-none flex items-center gap-1.5 py-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 transition-transform group-open:rotate-90", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex border border-slate-200 rounded-t-lg overflow-hidden bg-slate-100/90", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpencodeConfigSubTab('preview'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${opencodeConfigSubTab === 'preview'
|
|
748
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
749
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u9884\u89C8" }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpencodeConfigSubTab('current'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${opencodeConfigSubTab === 'current'
|
|
750
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
751
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u751F\u6548\u4E2D" })] }), (0, jsx_runtime_1.jsx)("div", { className: "relative overflow-hidden rounded-b-lg bg-slate-950 border border-slate-200 border-t-0", children: opencodeConfigSubTab === 'current' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "opencode.json\uFF08\u5F53\u524D\u78C1\u76D8\u5185\u5BB9\uFF0C\u8FD8\u539F\u540E\u5373\u66F4\u65B0\uFF09" })] }), opencodeStatus?.config != null ? ((0, jsx_runtime_1.jsx)("pre", { className: "w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono overflow-auto max-h-96 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", children: JSON.stringify(opencodeStatus.config, null, 2) })) : ((0, jsx_runtime_1.jsx)("div", { className: "p-3.5 text-[10px] text-slate-500 font-mono", children: "\u6682\u65E0\u914D\u7F6E\u6587\u4EF6" }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "opencode.json\uFF08\u5E94\u7528\u540E\u5C06\u5199\u5165\u7684\u5408\u5E76\u7ED3\u679C\uFF09" })] }), opencodePreviewLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "p-3.5 text-[10px] text-slate-400 font-mono", children: "\u52A0\u8F7D\u4E2D..." })) : ((0, jsx_runtime_1.jsx)("textarea", { className: "opencode-preview-textarea w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono bg-slate-950 border-0 focus:ring-0 focus:ring-offset-0 focus:outline-none resize-y max-h-96 overflow-y-auto placeholder:text-slate-500\n [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", placeholder: "\u6682\u65E0\u9884\u89C8", spellCheck: false, value: opencodePreviewText, onChange: (e) => setOpencodePreviewText(e.target.value) }))] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "rounded-lg border border-slate-200/50 bg-slate-50/60 px-4 py-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2.5", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4 text-slate-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-xs font-semibold text-slate-700", children: "\u4F7F\u7528\u8BF4\u660E" })] }), (0, jsx_runtime_1.jsxs)("ul", { className: "space-y-1.5 text-[10px] text-slate-600", children: [(0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "1." }), (0, jsx_runtime_1.jsx)("span", { children: "\u300C\u751F\u6548\u4E2D\u300D\u4E3A\u5F53\u524D\u78C1\u76D8\u4E0A\u7684 opencode.json\uFF1B\u300C\u9884\u89C8\u300D\u4E3A\u70B9\u51FB\u5E94\u7528\u540E\u5C06\u5199\u5165\u7684\u5408\u5E76\u7ED3\u679C\uFF08\u542B AAR \u7F51\u5173\uFF09" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "2." }), (0, jsx_runtime_1.jsx)("span", { children: "\u9009\u62E9\u9ED8\u8BA4\u6A21\u578B\u540E\uFF0C\u5728\u300C\u9884\u89C8\u300D\u4E2D\u67E5\u770B\u5408\u5E76\u7ED3\u679C\uFF0C\u70B9\u51FB\u300C\u5E94\u7528\u914D\u7F6E\u300D\u5199\u5165" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "3." }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E\u6587\u4EF6\u4F4D\u4E8E ~/.config/opencode/opencode.json\uFF08\u6216 Windows %APPDATA%/opencode\uFF09" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "4." }), (0, jsx_runtime_1.jsx)("span", { children: "\u300C\u8FD8\u539F\u914D\u7F6E\u300D\u6062\u590D\u4E3A\u5E94\u7528\u524D\u7684\u5907\u4EFD\uFF1B\u8FD8\u539F\u540E\u8BF7\u5728\u300C\u751F\u6548\u4E2D\u300D\u67E5\u770B\u5F53\u524D\u5185\u5BB9" })] })] })] })] })), activeTab === 'openclaw' && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [openclawStatus && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between py-3 px-4 bg-white/60 rounded-lg border border-slate-200/50", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-6 h-6 rounded-full flex items-center justify-center ${openclawStatus.applied
|
|
752
|
+
? 'bg-emerald-100 text-emerald-600'
|
|
753
|
+
: 'bg-slate-100 text-slate-400'}`, children: openclawStatus.applied ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium text-slate-700", children: openclawStatus.applied ? '已配置' : '未配置' }), openclawStatus.applied && openclawStatus.matchCurrentGateway !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: `inline-flex items-center px-2 py-0.5 text-[10px] font-medium rounded-full border ${openclawStatus.matchCurrentGateway
|
|
754
|
+
? 'bg-emerald-50/80 text-emerald-700 border-emerald-200/60'
|
|
755
|
+
: 'bg-amber-50/80 text-amber-700 border-amber-200/60'}`, children: openclawStatus.matchCurrentGateway ? '匹配当前网关' : '不匹配' }))] })] }), openclawStatus.lastUpdated && ((0, jsx_runtime_1.jsx)("div", { className: "text-[11px] text-slate-400 font-mono", children: new Date(openclawStatus.lastUpdated).toLocaleString('zh-CN', {
|
|
756
|
+
month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit'
|
|
757
|
+
}) }))] })), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-4", ref: openClawDropdownRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "bg-gradient-to-br from-white/50 to-transparent rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-indigo-100/80 text-indigo-600 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" }) }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: "\u9ED8\u8BA4\u6A21\u578B" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => { setOpenClawSearch(''); setOpenClawDropdown(openClawDropdown === 'default' ? null : 'default'); }, className: "w-full text-left appearance-none rounded-lg border border-slate-200/80 bg-white/90 px-3 py-2 pr-8 text-[11px] font-medium text-slate-700 shadow-sm focus:border-indigo-400 focus:ring-2 focus:ring-indigo-200/50 focus:outline-none cursor-pointer flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "truncate", children: openclawModelsFlat.find((m) => m.model_id === openclawDefaultModel)?.name || openclawDefaultModel || '选择模型' }), (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-slate-400 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }), openClawDropdown === 'default' && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute z-20 mt-1 w-full rounded-lg border border-slate-200 bg-white shadow-lg py-1 max-h-56 overflow-hidden flex flex-col", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "\u641C\u7D22\u6A21\u578B...", value: openClawSearch, onChange: (e) => setOpenClawSearch(e.target.value), onKeyDown: (e) => e.stopPropagation(), className: "mx-2 mb-1 px-2 py-1.5 text-[11px] border border-slate-200 rounded-md focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 focus:outline-none" }), (0, jsx_runtime_1.jsx)("ul", { className: "overflow-y-auto overscroll-contain max-h-44", children: openclawModelsFiltered.map((model) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => {
|
|
758
|
+
setOpenclawDefaultModel(model.model_id);
|
|
759
|
+
setOpenClawDropdown(null);
|
|
760
|
+
setOpenClawSearch('');
|
|
761
|
+
}, className: `w-full text-left px-3 py-2 text-[11px] hover:bg-indigo-50 ${model.model_id === openclawDefaultModel ? 'bg-indigo-100 text-indigo-700 font-medium' : 'text-slate-700'}`, children: [model.name, (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-400 ml-1", children: ["(", model.provider, ")"] })] }) }, model.id))) })] }))] }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-slate-500 mt-2", children: "\u4E3B\u8981\u4F7F\u7528\u7684\u6A21\u578B" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-gradient-to-br from-white/50 to-transparent rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-amber-100/80 text-amber-600 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: "\u9ED8\u8BA4 Fallback" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "min-h-[38px] rounded-lg border border-slate-200/80 bg-white/90 px-3 py-2 flex flex-wrap gap-1.5 items-center", children: openclawDefaultFallbacks.length === 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "text-[11px] text-slate-400", children: "\u4ECE\u4E0B\u65B9\u641C\u7D22\u5E76\u6DFB\u52A0\u5907\u7528\u6A21\u578B" })) : (openclawDefaultFallbacks.map((modelId) => {
|
|
762
|
+
const m = openclawModelsFlat.find((x) => x.model_id === modelId);
|
|
763
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-amber-100 text-amber-800 text-[10px] font-medium", children: [m?.name || modelId, (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpenclawDefaultFallbacks((prev) => prev.filter((id) => id !== modelId)), className: "hover:bg-amber-200 rounded p-0.5", "aria-label": "\u79FB\u9664", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }, modelId));
|
|
764
|
+
})) }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => { setOpenClawSearch(''); setOpenClawDropdown(openClawDropdown === 'defaultFallbacks' ? null : 'defaultFallbacks'); }, className: "mt-1.5 w-full text-left px-3 py-1.5 text-[11px] text-slate-500 border border-dashed border-slate-200 rounded-md hover:border-amber-300 hover:text-amber-700 hover:bg-amber-50/50", children: "+ \u641C\u7D22\u5E76\u6DFB\u52A0 Fallback \u6A21\u578B" }), openClawDropdown === 'defaultFallbacks' && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute z-20 mt-1 w-full rounded-lg border border-slate-200 bg-white shadow-lg py-1 max-h-56 overflow-hidden flex flex-col", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "\u641C\u7D22\u6A21\u578B...", value: openClawSearch, onChange: (e) => setOpenClawSearch(e.target.value), onKeyDown: (e) => e.stopPropagation(), className: "mx-2 mb-1 px-2 py-1.5 text-[11px] border border-slate-200 rounded-md focus:ring-2 focus:ring-amber-200 focus:border-amber-400 focus:outline-none" }), (0, jsx_runtime_1.jsxs)("ul", { className: "overflow-y-auto overscroll-contain max-h-44", children: [openclawModelsFiltered
|
|
765
|
+
.filter((m) => !openclawDefaultFallbacks.includes(m.model_id))
|
|
766
|
+
.map((model) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => {
|
|
767
|
+
setOpenclawDefaultFallbacks((prev) => (prev.includes(model.model_id) ? prev : [...prev, model.model_id]));
|
|
768
|
+
setOpenClawSearch('');
|
|
769
|
+
}, className: "w-full text-left px-3 py-2 text-[11px] text-slate-700 hover:bg-amber-50", children: [model.name, (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-400 ml-1", children: ["(", model.provider, ")"] })] }) }, model.id))), openclawModelsFiltered.filter((m) => !openclawDefaultFallbacks.includes(m.model_id)).length === 0 && ((0, jsx_runtime_1.jsx)("li", { className: "px-3 py-2 text-[11px] text-slate-400", children: "\u65E0\u66F4\u591A\u53EF\u9009\u6216\u5DF2\u5168\u90E8\u6DFB\u52A0" }))] })] }))] }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-slate-500 mt-2", children: "\u9ED8\u8BA4\u6A21\u578B\u7684\u5907\u7528\u6A21\u578B\uFF0C\u53EF\u591A\u9009\uFF0C\u4E0D\u53EF\u91CD\u590D" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-gradient-to-br from-white/50 to-transparent rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-rose-100/80 text-rose-600 flex items-center justify-center", children: (0, jsx_runtime_1.jsxs)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }), (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" })] }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: "\u89C6\u89C9\u6A21\u578B" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => { setOpenClawSearch(''); setOpenClawDropdown(openClawDropdown === 'image' ? null : 'image'); }, className: "w-full text-left appearance-none rounded-lg border border-slate-200/80 bg-white/90 px-3 py-2 pr-8 text-[11px] font-medium text-slate-700 shadow-sm focus:border-rose-400 focus:ring-2 focus:ring-rose-200/50 focus:outline-none cursor-pointer flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("span", { className: "truncate", children: openclawImageModel
|
|
770
|
+
? (openclawModelsFlat.find((m) => m.model_id === openclawImageModel)?.name || openclawImageModel)
|
|
771
|
+
: '未设置' }), (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-slate-400 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }), openClawDropdown === 'image' && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute z-20 mt-1 w-full rounded-lg border border-slate-200 bg-white shadow-lg py-1 max-h-56 overflow-hidden flex flex-col", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "\u641C\u7D22\u6A21\u578B...", value: openClawSearch, onChange: (e) => setOpenClawSearch(e.target.value), onKeyDown: (e) => e.stopPropagation(), className: "mx-2 mb-1 px-2 py-1.5 text-[11px] border border-slate-200 rounded-md focus:ring-2 focus:ring-rose-200 focus:border-rose-400 focus:outline-none" }), (0, jsx_runtime_1.jsxs)("ul", { className: "overflow-y-auto overscroll-contain max-h-44", children: [(0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => {
|
|
772
|
+
setOpenclawImageModel('');
|
|
773
|
+
setOpenClawDropdown(null);
|
|
774
|
+
setOpenClawSearch('');
|
|
775
|
+
}, className: `w-full text-left px-3 py-2 text-[11px] hover:bg-rose-50 ${!openclawImageModel ? 'bg-rose-100 text-rose-700 font-medium' : 'text-slate-500'}`, children: "\u672A\u8BBE\u7F6E" }) }), openclawModelsFiltered.map((model) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => {
|
|
776
|
+
setOpenclawImageModel(model.model_id);
|
|
777
|
+
setOpenClawDropdown(null);
|
|
778
|
+
setOpenClawSearch('');
|
|
779
|
+
}, className: `w-full text-left px-3 py-2 text-[11px] hover:bg-rose-50 ${model.model_id === openclawImageModel ? 'bg-rose-100 text-rose-700 font-medium' : 'text-slate-700'}`, children: [model.name, (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-400 ml-1", children: ["(", model.provider, ")"] })] }) }, model.id)))] })] }))] }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-slate-500 mt-2", children: "\u7528\u4E8E\u56FE\u50CF\u7406\u89E3\uFF08\u53EF\u9009\uFF09" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "bg-gradient-to-br from-white/50 to-transparent rounded-xl border border-slate-200/50 p-4 transition-all duration-300 hover:border-slate-300/60 hover:shadow-sm", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2.5 mb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-7 h-7 rounded-lg bg-emerald-100/80 text-emerald-600 flex items-center justify-center", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[11px] font-medium text-slate-700", children: "\u89C6\u89C9 Fallback" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "min-h-[38px] rounded-lg border border-slate-200/80 bg-white/90 px-3 py-2 flex flex-wrap gap-1.5 items-center", children: openclawImageFallbacks.length === 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "text-[11px] text-slate-400", children: "\u4ECE\u4E0B\u65B9\u641C\u7D22\u5E76\u6DFB\u52A0\u5907\u7528\u6A21\u578B" })) : (openclawImageFallbacks.map((modelId) => {
|
|
780
|
+
const m = openclawModelsFlat.find((x) => x.model_id === modelId);
|
|
781
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-emerald-100 text-emerald-800 text-[10px] font-medium", children: [m?.name || modelId, (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpenclawImageFallbacks((prev) => prev.filter((id) => id !== modelId)), className: "hover:bg-emerald-200 rounded p-0.5", "aria-label": "\u79FB\u9664", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }, modelId));
|
|
782
|
+
})) }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => { setOpenClawSearch(''); setOpenClawDropdown(openClawDropdown === 'imageFallbacks' ? null : 'imageFallbacks'); }, className: "mt-1.5 w-full text-left px-3 py-1.5 text-[11px] text-slate-500 border border-dashed border-slate-200 rounded-md hover:border-emerald-300 hover:text-emerald-700 hover:bg-emerald-50/50", children: "+ \u641C\u7D22\u5E76\u6DFB\u52A0 Fallback \u6A21\u578B" }), openClawDropdown === 'imageFallbacks' && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute z-20 mt-1 w-full rounded-lg border border-slate-200 bg-white shadow-lg py-1 max-h-56 overflow-hidden flex flex-col", children: [(0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: "\u641C\u7D22\u6A21\u578B...", value: openClawSearch, onChange: (e) => setOpenClawSearch(e.target.value), onKeyDown: (e) => e.stopPropagation(), className: "mx-2 mb-1 px-2 py-1.5 text-[11px] border border-slate-200 rounded-md focus:ring-2 focus:ring-emerald-200 focus:border-emerald-400 focus:outline-none" }), (0, jsx_runtime_1.jsxs)("ul", { className: "overflow-y-auto overscroll-contain max-h-44", children: [openclawModelsFiltered
|
|
783
|
+
.filter((m) => !openclawImageFallbacks.includes(m.model_id))
|
|
784
|
+
.map((model) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => {
|
|
785
|
+
setOpenclawImageFallbacks((prev) => (prev.includes(model.model_id) ? prev : [...prev, model.model_id]));
|
|
786
|
+
setOpenClawSearch('');
|
|
787
|
+
}, className: "w-full text-left px-3 py-2 text-[11px] text-slate-700 hover:bg-emerald-50", children: [model.name, (0, jsx_runtime_1.jsxs)("span", { className: "text-slate-400 ml-1", children: ["(", model.provider, ")"] })] }) }, model.id))), openclawModelsFiltered.filter((m) => !openclawImageFallbacks.includes(m.model_id)).length === 0 && ((0, jsx_runtime_1.jsx)("li", { className: "px-3 py-2 text-[11px] text-slate-400", children: "\u65E0\u66F4\u591A\u53EF\u9009\u6216\u5DF2\u5168\u90E8\u6DFB\u52A0" }))] })] }))] }), (0, jsx_runtime_1.jsx)("p", { className: "text-[10px] text-slate-500 mt-2", children: "\u89C6\u89C9\u6A21\u578B\u7684\u5907\u7528\u6A21\u578B\uFF0C\u53EF\u591A\u9009\uFF0C\u4E0D\u53EF\u91CD\u590D" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: `grid gap-3 pt-1 ${openclawEnabled ? 'grid-cols-3' : 'grid-cols-2'}`, children: [(0, jsx_runtime_1.jsx)("button", { onClick: handleOpenClawApply, disabled: openclawApplying, className: `w-full px-4 py-2.5 text-xs font-medium rounded-lg border transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 ${openclawEnabled
|
|
788
|
+
? 'bg-white border-slate-200/80 text-slate-700 hover:border-slate-300 hover:bg-slate-50'
|
|
789
|
+
: 'bg-slate-900 border-slate-900 text-white hover:bg-slate-800'}`, children: openclawApplying ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u5E94\u7528\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), openclawEnabled ? '更新配置' : '应用配置'] })) }), openclawEnabled && ((0, jsx_runtime_1.jsx)("button", { onClick: handleOpenClawRestore, disabled: openclawRestoring, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:border-slate-300 hover:bg-slate-50 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2", children: openclawRestoring ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u8FD8\u539F\u4E2D"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), "\u8FD8\u539F\u914D\u7F6E"] })) })), openclawTesting ? ((0, jsx_runtime_1.jsxs)("button", { onClick: handleOpenClawCancelTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-amber-200/80 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin w-3.5 h-3.5", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "\u53D6\u6D88\u6D4B\u8BD5"] })) : ((0, jsx_runtime_1.jsxs)("button", { onClick: handleOpenClawTest, className: "w-full px-4 py-2.5 text-xs font-medium rounded-lg border border-slate-200/80 bg-white text-slate-700 hover:bg-slate-50 transition-all duration-200 flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }), "\u6D4B\u8BD5\u914D\u7F6E"] }))] }), openclawTestResult && ((0, jsx_runtime_1.jsx)("div", { className: `rounded-lg border px-4 py-3 ${openclawTestResult.success
|
|
790
|
+
? 'bg-emerald-50/60 border-emerald-200/60'
|
|
791
|
+
: 'bg-rose-50/60 border-rose-200/60'}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start gap-3", children: [(0, jsx_runtime_1.jsx)("div", { className: `w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${openclawTestResult.success ? 'bg-emerald-500' : 'bg-rose-500'}`, children: openclawTestResult.success ? ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })) : ((0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs font-medium mb-1", children: openclawTestResult.success ? '配置验证成功' : '配置验证失败' }), (0, jsx_runtime_1.jsx)("p", { className: `text-[11px] ${openclawTestResult.success ? 'text-emerald-700/80' : 'text-rose-700/80'}`, children: openclawTestResult.success
|
|
792
|
+
? (openclawTestResult.openclawTest?.message || 'OpenClaw 可以正常工作')
|
|
793
|
+
: (openclawTestResult.openclawTest?.error || openclawTestResult.error || openclawTestResult.suggestion || '请检查配置') }), openclawTestResult.openclawTest?.stdout && ((0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-[10px] text-slate-500 font-mono bg-white/50 p-2 rounded", children: openclawTestResult.openclawTest.stdout }))] })] }) })), (0, jsx_runtime_1.jsxs)("details", { className: "group", open: true, children: [(0, jsx_runtime_1.jsxs)("summary", { className: "cursor-pointer text-[11px] text-slate-500 hover:text-slate-700 list-none flex items-center gap-1.5 py-1", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3 transition-transform group-open:rotate-90", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex border border-slate-200 rounded-t-lg overflow-hidden bg-slate-100/90", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpenclawConfigSubTab('preview'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${openclawConfigSubTab === 'preview'
|
|
794
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
795
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u9884\u89C8" }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setOpenclawConfigSubTab('current'), className: `flex-1 px-4 py-2.5 text-[11px] transition-all ${openclawConfigSubTab === 'current'
|
|
796
|
+
? 'bg-white text-slate-800 font-semibold shadow-sm'
|
|
797
|
+
: 'text-slate-500 font-medium hover:bg-slate-200/80 hover:text-slate-600'}`, children: "\u751F\u6548\u4E2D" })] }), (0, jsx_runtime_1.jsx)("div", { className: "relative overflow-hidden rounded-b-lg bg-slate-950 border border-slate-200 border-t-0", children: openclawConfigSubTab === 'preview' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "openclaw.json\uFF08\u5E94\u7528\u540E\u5C06\u5199\u5165\u7684\u5408\u5E76\u7ED3\u679C\uFF09" })] }), openclawPreviewLoading ? ((0, jsx_runtime_1.jsx)("div", { className: "p-3.5 text-[10px] text-slate-400 font-mono", children: "\u52A0\u8F7D\u4E2D..." })) : ((0, jsx_runtime_1.jsx)("textarea", { className: "openclaw-preview-textarea w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono bg-slate-950 border-0 focus:ring-0 focus:ring-offset-0 focus:outline-none resize-y max-h-96 overflow-y-auto placeholder:text-slate-500\n [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", placeholder: "\u6682\u65E0\u9884\u89C8", spellCheck: false, value: openclawPreviewText, onChange: (e) => setOpenclawPreviewText(e.target.value) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-1.5 px-3 py-2 bg-slate-900 border-b border-slate-800", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" }), (0, jsx_runtime_1.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-slate-600" })] }), (0, jsx_runtime_1.jsx)("span", { className: "text-[10px] font-medium text-slate-400 ml-2", children: "openclaw.json\uFF08\u5F53\u524D\u78C1\u76D8\u5185\u5BB9\uFF0C\u8FD8\u539F\u540E\u5373\u66F4\u65B0\uFF09" })] }), openclawStatus?.config != null ? ((0, jsx_runtime_1.jsx)("pre", { className: "w-full min-h-[12rem] p-3.5 text-[10px] text-slate-300 font-mono overflow-auto max-h-96 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-slate-900 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full", children: JSON.stringify(openclawStatus.config, null, 2) })) : ((0, jsx_runtime_1.jsx)("div", { className: "p-3.5 text-[10px] text-slate-500 font-mono", children: "\u6682\u65E0\u914D\u7F6E\u6587\u4EF6" }))] })) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "rounded-lg border border-slate-200/50 bg-slate-50/60 px-4 py-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 mb-2.5", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4 text-slate-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-xs font-semibold text-slate-700", children: "\u4F7F\u7528\u8BF4\u660E" })] }), (0, jsx_runtime_1.jsxs)("ul", { className: "space-y-1.5 text-[10px] text-slate-600", children: [(0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "1." }), (0, jsx_runtime_1.jsx)("span", { children: "\u300C\u751F\u6548\u4E2D\u300D\u4E3A\u5F53\u524D\u78C1\u76D8\u4E0A\u7684 openclaw.json\uFF1B\u300C\u9884\u89C8\u300D\u4E3A\u5E94\u7528\u540E\u5C06\u5199\u5165\u7684\u5408\u5E76\u7ED3\u679C\uFF08\u542B AAR \u7F51\u5173\uFF09" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "2." }), (0, jsx_runtime_1.jsx)("span", { children: "\u9009\u62E9\u9ED8\u8BA4\u6A21\u578B\u7B49\u540E\uFF0C\u5728\u300C\u9884\u89C8\u300D\u4E2D\u67E5\u770B\u5408\u5E76\u7ED3\u679C\uFF0C\u70B9\u51FB\u300C\u5E94\u7528\u914D\u7F6E\u300D\u5199\u5165" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "3." }), (0, jsx_runtime_1.jsx)("span", { children: "\u914D\u7F6E\u6587\u4EF6\u4F4D\u4E8E ~/.openclaw/openclaw.json" })] }), (0, jsx_runtime_1.jsxs)("li", { className: "flex gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-slate-400", children: "4." }), (0, jsx_runtime_1.jsx)("span", { children: "\u300C\u8FD8\u539F\u914D\u7F6E\u300D\u6062\u590D\u4E3A\u5E94\u7528\u524D\u7684\u5907\u4EFD\uFF1B\u8FD8\u539F\u540E\u8BF7\u5728\u300C\u751F\u6548\u4E2D\u300D\u67E5\u770B\u5F53\u524D\u5185\u5BB9" })] })] })] })] })), activeTab === 'cursor' && ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mb-4", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-8 h-8 text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" }) }) }), (0, jsx_runtime_1.jsx)("h3", { className: "text-sm font-medium text-slate-900 mb-1", children: "Cursor \u652F\u6301\u5373\u5C06\u63A8\u51FA" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-slate-500 max-w-xs", children: "\u6211\u4EEC\u5C06\u5F88\u5FEB\u6DFB\u52A0\u5BF9 Cursor \u7F16\u8F91\u5668\u7684\u652F\u6301\uFF0C\u656C\u8BF7\u671F\u5F85\u3002" })] }))] })] })] })] }));
|
|
288
798
|
}
|