@tonyclaw/agent-inspector 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/cli.js +1611 -0
- package/.output/nitro.json +17 -0
- package/.output/public/assets/CompareDrawer-CU5ZrWcL.js +1 -0
- package/.output/public/assets/ProxyViewerContainer-pEBqVp1d.js +101 -0
- package/.output/public/assets/ReplayDialog-F58yNg5j.js +1 -0
- package/.output/public/assets/RequestAnatomy-C9lT0qE_.js +1 -0
- package/.output/public/assets/ResponseView-DHJq6bnz.js +1 -0
- package/.output/public/assets/StreamingChunkSequence-BTgfpFUT.js +1 -0
- package/.output/public/assets/_sessionId-DsNRbnNm.js +1 -0
- package/.output/public/assets/alibaba-TTwafVwX.svg +1 -0
- package/.output/public/assets/index-CpWG2hFn.css +1 -0
- package/.output/public/assets/index-DmBV8Gve.js +1 -0
- package/.output/public/assets/json-viewer-CZVYLR8j.js +14 -0
- package/.output/public/assets/main-DHs7FBK3.js +18 -0
- package/.output/public/assets/minimax-BPMzvuL-.jpeg +0 -0
- package/.output/public/assets/qwen-CONDcHqt.png +0 -0
- package/.output/public/assets/zhipuai-BPNAnxo-.svg +219 -0
- package/.output/server/_chunks/ssr-renderer.mjs +22 -0
- package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
- package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +2 -0
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
- package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +34 -0
- package/.output/server/_libs/ajv-formats.mjs +330 -0
- package/.output/server/_libs/ajv.mjs +11444 -0
- package/.output/server/_libs/aria-hidden.mjs +122 -0
- package/.output/server/_libs/atomically.mjs +152 -0
- package/.output/server/_libs/bail.mjs +8 -0
- package/.output/server/_libs/cfworker__json-schema.mjs +1 -0
- package/.output/server/_libs/character-entities.mjs +2130 -0
- package/.output/server/_libs/class-variance-authority.mjs +44 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/comma-separated-tokens.mjs +10 -0
- package/.output/server/_libs/conf.mjs +635 -0
- package/.output/server/_libs/cookie-es.mjs +58 -0
- package/.output/server/_libs/core-util-is.mjs +75 -0
- package/.output/server/_libs/croner.mjs +1 -0
- package/.output/server/_libs/crossws.mjs +1 -0
- package/.output/server/_libs/debounce-fn.mjs +69 -0
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +8 -0
- package/.output/server/_libs/dequal.mjs +27 -0
- package/.output/server/_libs/detect-node-es.mjs +1 -0
- package/.output/server/_libs/devlop.mjs +8 -0
- package/.output/server/_libs/diff.mjs +320 -0
- package/.output/server/_libs/dot-prop.mjs +265 -0
- package/.output/server/_libs/env-paths.mjs +57 -0
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +11 -0
- package/.output/server/_libs/extend.mjs +97 -0
- package/.output/server/_libs/fast-deep-equal.mjs +38 -0
- package/.output/server/_libs/fast-uri.mjs +812 -0
- package/.output/server/_libs/floating-ui__core.mjs +725 -0
- package/.output/server/_libs/floating-ui__dom.mjs +622 -0
- package/.output/server/_libs/floating-ui__react-dom.mjs +292 -0
- package/.output/server/_libs/floating-ui__utils.mjs +320 -0
- package/.output/server/_libs/get-nonce.mjs +9 -0
- package/.output/server/_libs/h3-v2.mjs +276 -0
- package/.output/server/_libs/h3.mjs +408 -0
- package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
- package/.output/server/_libs/hast-util-whitespace.mjs +10 -0
- package/.output/server/_libs/hookable.mjs +1 -0
- package/.output/server/_libs/html-url-attributes.mjs +26 -0
- package/.output/server/_libs/immediate.mjs +74 -0
- package/.output/server/_libs/inherits.mjs +50 -0
- package/.output/server/_libs/inline-style-parser.mjs +142 -0
- package/.output/server/_libs/is-plain-obj.mjs +10 -0
- package/.output/server/_libs/isarray.mjs +14 -0
- package/.output/server/_libs/isbot.mjs +20 -0
- package/.output/server/_libs/json-schema-traverse.mjs +180 -0
- package/.output/server/_libs/jszip.mjs +3051 -0
- package/.output/server/_libs/lie.mjs +273 -0
- package/.output/server/_libs/lucide-react.mjs +492 -0
- package/.output/server/_libs/mdast-util-from-markdown.mjs +717 -0
- package/.output/server/_libs/mdast-util-to-hast.mjs +710 -0
- package/.output/server/_libs/mdast-util-to-string.mjs +38 -0
- package/.output/server/_libs/micromark-core-commonmark.mjs +2259 -0
- package/.output/server/_libs/micromark-factory-destination.mjs +94 -0
- package/.output/server/_libs/micromark-factory-label.mjs +63 -0
- package/.output/server/_libs/micromark-factory-space.mjs +24 -0
- package/.output/server/_libs/micromark-factory-title.mjs +65 -0
- package/.output/server/_libs/micromark-factory-whitespace.mjs +22 -0
- package/.output/server/_libs/micromark-util-character.mjs +44 -0
- package/.output/server/_libs/micromark-util-chunked.mjs +36 -0
- package/.output/server/_libs/micromark-util-classify-character+[...].mjs +12 -0
- package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
- package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
- package/.output/server/_libs/micromark-util-decode-string.mjs +21 -0
- package/.output/server/_libs/micromark-util-encode.mjs +1 -0
- package/.output/server/_libs/micromark-util-html-tag-name.mjs +69 -0
- package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
- package/.output/server/_libs/micromark-util-resolve-all.mjs +15 -0
- package/.output/server/_libs/micromark-util-sanitize-uri.mjs +41 -0
- package/.output/server/_libs/micromark-util-subtokenize.mjs +346 -0
- package/.output/server/_libs/micromark.mjs +906 -0
- package/.output/server/_libs/mimic-function.mjs +47 -0
- package/.output/server/_libs/modelcontextprotocol__server.mjs +9738 -0
- package/.output/server/_libs/ocache.mjs +1 -0
- package/.output/server/_libs/ohash.mjs +1 -0
- package/.output/server/_libs/pako.mjs +4223 -0
- package/.output/server/_libs/process-nextick-args.mjs +48 -0
- package/.output/server/_libs/property-information.mjs +1209 -0
- package/.output/server/_libs/radix-ui.mjs +1 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-accordion.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-avatar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-checkbox.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-collapsible.mjs +144 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +69 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
- package/.output/server/_libs/radix-ui__react-context-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-dialog.mjs +325 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
- package/.output/server/_libs/radix-ui__react-form.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-hover-card.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menubar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popover.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popper.mjs +286 -0
- package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
- package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
- package/.output/server/_libs/radix-ui__react-primitive.mjs +42 -0
- package/.output/server/_libs/radix-ui__react-progress.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-radio-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-roving-focus.mjs +224 -0
- package/.output/server/_libs/radix-ui__react-scroll-area.mjs +721 -0
- package/.output/server/_libs/radix-ui__react-select.mjs +1163 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +28 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-slot.mjs +99 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tabs.mjs +189 -0
- package/.output/server/_libs/radix-ui__react-toast.mjs +2 -0
- package/.output/server/_libs/radix-ui__react-toggle-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toggle.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toolbar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +495 -0
- package/.output/server/_libs/radix-ui__react-use-previous.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-use-size.mjs +39 -0
- package/.output/server/_libs/react-dom.mjs +10781 -0
- package/.output/server/_libs/react-markdown.mjs +147 -0
- package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/.output/server/_libs/react-remove-scroll.mjs +328 -0
- package/.output/server/_libs/react-style-singleton.mjs +69 -0
- package/.output/server/_libs/react.mjs +515 -0
- package/.output/server/_libs/readable-stream.mjs +1518 -0
- package/.output/server/_libs/remark-parse.mjs +19 -0
- package/.output/server/_libs/remark-rehype.mjs +21 -0
- package/.output/server/_libs/rou3.mjs +14 -0
- package/.output/server/_libs/safe-buffer.mjs +64 -0
- package/.output/server/_libs/semver.mjs +1938 -0
- package/.output/server/_libs/seroval-plugins.mjs +58 -0
- package/.output/server/_libs/seroval.mjs +1765 -0
- package/.output/server/_libs/setimmediate.mjs +152 -0
- package/.output/server/_libs/space-separated-tokens.mjs +6 -0
- package/.output/server/_libs/srvx.mjs +1029 -0
- package/.output/server/_libs/stubborn-fs.mjs +91 -0
- package/.output/server/_libs/stubborn-utils.mjs +66 -0
- package/.output/server/_libs/style-to-js.mjs +72 -0
- package/.output/server/_libs/style-to-object.mjs +38 -0
- package/.output/server/_libs/swr.mjs +939 -0
- package/.output/server/_libs/tailwind-merge.mjs +3010 -0
- package/.output/server/_libs/tanstack__history.mjs +217 -0
- package/.output/server/_libs/tanstack__react-router.mjs +1480 -0
- package/.output/server/_libs/tanstack__react-store.mjs +1 -0
- package/.output/server/_libs/tanstack__react-virtual.mjs +44 -0
- package/.output/server/_libs/tanstack__router-core.mjs +4827 -0
- package/.output/server/_libs/tanstack__store.mjs +1 -0
- package/.output/server/_libs/tanstack__virtual-core.mjs +1225 -0
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/trim-lines.mjs +41 -0
- package/.output/server/_libs/trough.mjs +85 -0
- package/.output/server/_libs/tslib.mjs +1 -0
- package/.output/server/_libs/ufo.mjs +54 -0
- package/.output/server/_libs/uint8array-extras.mjs +69 -0
- package/.output/server/_libs/ungap__structured-clone.mjs +212 -0
- package/.output/server/_libs/unified.mjs +661 -0
- package/.output/server/_libs/unist-util-is.mjs +100 -0
- package/.output/server/_libs/unist-util-position.mjs +27 -0
- package/.output/server/_libs/unist-util-stringify-position.mjs +27 -0
- package/.output/server/_libs/unist-util-visit-parents.mjs +82 -0
- package/.output/server/_libs/unist-util-visit.mjs +24 -0
- package/.output/server/_libs/unstorage.mjs +1 -0
- package/.output/server/_libs/use-callback-ref.mjs +66 -0
- package/.output/server/_libs/use-sidecar.mjs +106 -0
- package/.output/server/_libs/use-sync-external-store.mjs +64 -0
- package/.output/server/_libs/util-deprecate.mjs +12 -0
- package/.output/server/_libs/vfile-message.mjs +138 -0
- package/.output/server/_libs/vfile.mjs +467 -0
- package/.output/server/_libs/when-exit.mjs +53 -0
- package/.output/server/_libs/zod.mjs +4524 -0
- package/.output/server/_sessionId-wMLPvC5g.mjs +123 -0
- package/.output/server/_ssr/CompareDrawer-BU4V0uVf.mjs +1041 -0
- package/.output/server/_ssr/ProxyViewerContainer-BnRwFEnn.mjs +5972 -0
- package/.output/server/_ssr/ReplayDialog-C7dn9pd_.mjs +322 -0
- package/.output/server/_ssr/RequestAnatomy-C1rWpe9-.mjs +353 -0
- package/.output/server/_ssr/ResponseView-hGpPaYsf.mjs +602 -0
- package/.output/server/_ssr/StreamingChunkSequence-BRWI1r_G.mjs +302 -0
- package/.output/server/_ssr/index-BKURLVPz.mjs +118 -0
- package/.output/server/_ssr/index.mjs +1184 -0
- package/.output/server/_ssr/json-viewer-BBd2DtQP.mjs +515 -0
- package/.output/server/_ssr/router-BcZ0D6AB.mjs +6317 -0
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-1y8ZVxRI.mjs +4 -0
- package/.output/server/index.mjs +436 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/package.json +110 -0
- package/src/assets/favicon.svg +31 -0
- package/src/assets/logos/alibaba.svg +1 -0
- package/src/assets/logos/anthropic.svg +1 -0
- package/src/assets/logos/claude-code.svg +4 -0
- package/src/assets/logos/deepseek.svg +1 -0
- package/src/assets/logos/mcp.png +0 -0
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +1 -0
- package/src/assets/logos/opencode.svg +4 -0
- package/src/assets/logos/qwen.png +0 -0
- package/src/assets/logos/zhipuai.svg +219 -0
- package/src/cli/detect-tools.ts +147 -0
- package/src/cli/doctor.ts +521 -0
- package/src/cli/onboard.ts +224 -0
- package/src/cli/templates/command-onboard.ts +17 -0
- package/src/cli/templates/skill-onboard.ts +547 -0
- package/src/cli.ts +345 -0
- package/src/components/OnboardingBanner.tsx +67 -0
- package/src/components/ProxyViewer.tsx +545 -0
- package/src/components/ProxyViewerContainer.tsx +363 -0
- package/src/components/providers/ImportWizardDialog.tsx +349 -0
- package/src/components/providers/ProviderCard.tsx +474 -0
- package/src/components/providers/ProviderForm.tsx +494 -0
- package/src/components/providers/ProviderLogo.tsx +117 -0
- package/src/components/providers/ProvidersPanel.tsx +619 -0
- package/src/components/providers/SettingsDialog.tsx +202 -0
- package/src/components/proxy-viewer/CompareDrawer.tsx +893 -0
- package/src/components/proxy-viewer/ConversationGroup.tsx +107 -0
- package/src/components/proxy-viewer/ConversationHeader.tsx +300 -0
- package/src/components/proxy-viewer/LogEntry.tsx +543 -0
- package/src/components/proxy-viewer/LogEntryHeader.tsx +501 -0
- package/src/components/proxy-viewer/ReplayDialog.tsx +218 -0
- package/src/components/proxy-viewer/ResponseView.tsx +171 -0
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +188 -0
- package/src/components/proxy-viewer/ThreadConnector.tsx +136 -0
- package/src/components/proxy-viewer/TurnGroup.tsx +337 -0
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +98 -0
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +196 -0
- package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +53 -0
- package/src/components/proxy-viewer/anatomy/types.ts +39 -0
- package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +114 -0
- package/src/components/proxy-viewer/cacheTrend.ts +50 -0
- package/src/components/proxy-viewer/diff/DiffView.tsx +321 -0
- package/src/components/proxy-viewer/diff/computeDiff.ts +178 -0
- package/src/components/proxy-viewer/diff/index.ts +3 -0
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +157 -0
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +66 -0
- package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +21 -0
- package/src/components/proxy-viewer/formats/index.tsx +33 -0
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +170 -0
- package/src/components/proxy-viewer/index.ts +9 -0
- package/src/components/proxy-viewer/lazy.ts +37 -0
- package/src/components/proxy-viewer/log-formats/anthropic.ts +194 -0
- package/src/components/proxy-viewer/log-formats/index.ts +23 -0
- package/src/components/proxy-viewer/log-formats/openai.ts +167 -0
- package/src/components/proxy-viewer/log-formats/types.ts +40 -0
- package/src/components/proxy-viewer/log-formats/unknown.ts +18 -0
- package/src/components/proxy-viewer/logEntryVisibility.ts +39 -0
- package/src/components/proxy-viewer/requestDiff.ts +277 -0
- package/src/components/proxy-viewer/useCopyFeedback.ts +36 -0
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +190 -0
- package/src/components/proxy-viewer/viewerState.ts +66 -0
- package/src/components/ui/badge.tsx +47 -0
- package/src/components/ui/button.tsx +47 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/confirm-dialog.tsx +51 -0
- package/src/components/ui/crab-logo.tsx +95 -0
- package/src/components/ui/crab-variants.tsx +467 -0
- package/src/components/ui/dialog.tsx +129 -0
- package/src/components/ui/json-expansion-button.tsx +56 -0
- package/src/components/ui/json-viewer-bulk.ts +97 -0
- package/src/components/ui/json-viewer.tsx +494 -0
- package/src/components/ui/mcp-logo.tsx +20 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +178 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/tabs.tsx +88 -0
- package/src/components/ui/tooltip.tsx +51 -0
- package/src/index.css +11 -0
- package/src/knowledge/candidateStore.ts +63 -0
- package/src/knowledge/distiller.ts +98 -0
- package/src/knowledge/openclawClient.ts +118 -0
- package/src/knowledge/redactor.ts +80 -0
- package/src/knowledge/types.ts +84 -0
- package/src/lib/apiClient.ts +49 -0
- package/src/lib/export-logs.ts +51 -0
- package/src/lib/mask.ts +4 -0
- package/src/lib/objectUtils.ts +22 -0
- package/src/lib/providerContract.ts +26 -0
- package/src/lib/providerTestContract.ts +107 -0
- package/src/lib/runtimeConfig.ts +25 -0
- package/src/lib/serverPort.ts +41 -0
- package/src/lib/sessionUrl.ts +44 -0
- package/src/lib/stopReason.ts +58 -0
- package/src/lib/useOnboarding.ts +80 -0
- package/src/lib/useProviders.ts +30 -0
- package/src/lib/useStripConfig.ts +108 -0
- package/src/lib/utils.ts +21 -0
- package/src/mcp/loopback.ts +76 -0
- package/src/mcp/previewExtractor.ts +166 -0
- package/src/mcp/server.ts +396 -0
- package/src/mcp/toolHandlers.ts +341 -0
- package/src/proxy/chunkStorage.ts +112 -0
- package/src/proxy/claudeCodeStrip.ts +99 -0
- package/src/proxy/config.ts +172 -0
- package/src/proxy/constants.ts +47 -0
- package/src/proxy/dataDir.ts +86 -0
- package/src/proxy/formats/anthropic/anthropicProvider.ts +75 -0
- package/src/proxy/formats/anthropic/handler.ts +71 -0
- package/src/proxy/formats/anthropic/index.ts +14 -0
- package/src/proxy/formats/anthropic/register.ts +4 -0
- package/src/proxy/formats/anthropic/schemas.ts +237 -0
- package/src/proxy/formats/anthropic/stream.ts +205 -0
- package/src/proxy/formats/handler.ts +46 -0
- package/src/proxy/formats/index.ts +12 -0
- package/src/proxy/formats/jsonSchema.ts +36 -0
- package/src/proxy/formats/openai/alibabaProvider.ts +38 -0
- package/src/proxy/formats/openai/handler.ts +96 -0
- package/src/proxy/formats/openai/index.ts +25 -0
- package/src/proxy/formats/openai/provider.ts +50 -0
- package/src/proxy/formats/openai/register.ts +4 -0
- package/src/proxy/formats/openai/schemas.ts +187 -0
- package/src/proxy/formats/openai/stream.ts +206 -0
- package/src/proxy/formats/protocol.ts +50 -0
- package/src/proxy/formats/providerRegistry.ts +51 -0
- package/src/proxy/formats/providers/index.ts +3 -0
- package/src/proxy/formats/registry.ts +66 -0
- package/src/proxy/handler.ts +334 -0
- package/src/proxy/logFinalizer.ts +305 -0
- package/src/proxy/logFinalizer.worker.ts +24 -0
- package/src/proxy/logIndex.ts +268 -0
- package/src/proxy/logger.ts +179 -0
- package/src/proxy/openaiOrphanToolStrip.ts +142 -0
- package/src/proxy/providerImporters.ts +491 -0
- package/src/proxy/providers.ts +613 -0
- package/src/proxy/schemas.ts +209 -0
- package/src/proxy/sessionProcess.ts +140 -0
- package/src/proxy/sessionRuntime.ts +85 -0
- package/src/proxy/sessionSupervisor.ts +283 -0
- package/src/proxy/sessionWorkerEntry.ts +26 -0
- package/src/proxy/socketTracker.ts +255 -0
- package/src/proxy/store.ts +412 -0
- package/src/proxy/upstream.ts +90 -0
- package/src/router.tsx +16 -0
- package/src/routes/__root.tsx +45 -0
- package/src/routes/api/config.paths.ts +14 -0
- package/src/routes/api/config.ts +53 -0
- package/src/routes/api/health.ts +15 -0
- package/src/routes/api/knowledge.candidates.$candidateId.promote.ts +32 -0
- package/src/routes/api/knowledge.candidates.ts +10 -0
- package/src/routes/api/knowledge.project-context.ts +18 -0
- package/src/routes/api/knowledge.search.ts +31 -0
- package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +16 -0
- package/src/routes/api/logs.$id.chunks.ts +36 -0
- package/src/routes/api/logs.$id.replay.ts +191 -0
- package/src/routes/api/logs.$id.ts +22 -0
- package/src/routes/api/logs.stream.ts +74 -0
- package/src/routes/api/logs.ts +59 -0
- package/src/routes/api/mcp.ts +25 -0
- package/src/routes/api/models.ts +10 -0
- package/src/routes/api/providers.$providerId.test.log.ts +293 -0
- package/src/routes/api/providers.$providerId.ts +50 -0
- package/src/routes/api/providers.export.ts +26 -0
- package/src/routes/api/providers.import.ts +47 -0
- package/src/routes/api/providers.scan.ts +23 -0
- package/src/routes/api/providers.ts +45 -0
- package/src/routes/api/sessions.ts +17 -0
- package/src/routes/index.tsx +6 -0
- package/src/routes/proxy/$.ts +15 -0
- package/src/routes/session/$sessionId.tsx +23 -0
- package/styles/globals.css +188 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { type JSX, type ReactNode, useCallback, useRef, useState } from "react";
|
|
2
|
+
import { Button } from "../ui/button";
|
|
3
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "../ui/tooltip";
|
|
4
|
+
import {
|
|
5
|
+
Eye,
|
|
6
|
+
EyeOff,
|
|
7
|
+
Pencil,
|
|
8
|
+
Trash2,
|
|
9
|
+
RotateCw,
|
|
10
|
+
CheckCircle,
|
|
11
|
+
Minus,
|
|
12
|
+
ExternalLink,
|
|
13
|
+
AlertCircle,
|
|
14
|
+
Wifi,
|
|
15
|
+
WifiOff,
|
|
16
|
+
Lock,
|
|
17
|
+
Gauge,
|
|
18
|
+
Server,
|
|
19
|
+
HelpCircle,
|
|
20
|
+
Clock,
|
|
21
|
+
Copy,
|
|
22
|
+
Check,
|
|
23
|
+
} from "lucide-react";
|
|
24
|
+
import type { ProviderConfig } from "../../proxy/providers";
|
|
25
|
+
import { maskApiKey } from "../../lib/mask";
|
|
26
|
+
import type {
|
|
27
|
+
ProviderTestErrorType as ErrorType,
|
|
28
|
+
ProviderTestResult as TestResult,
|
|
29
|
+
ProviderTestResults as TestResults,
|
|
30
|
+
ProviderTestState,
|
|
31
|
+
} from "../../lib/providerTestContract";
|
|
32
|
+
|
|
33
|
+
// Known provider documentation links (fallback when apiDocsUrl is not configured)
|
|
34
|
+
const KNOWN_PROVIDER_DOCS: Record<string, string> = {
|
|
35
|
+
deepseek: "https://api-docs.deepseek.com/zh-cn/",
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type ProviderCardProps = {
|
|
39
|
+
provider: ProviderConfig;
|
|
40
|
+
testResults?: TestResults;
|
|
41
|
+
isTesting?: boolean;
|
|
42
|
+
testingTimeLeft?: number;
|
|
43
|
+
isHighlighted?: boolean;
|
|
44
|
+
onEdit: (provider: ProviderConfig) => void;
|
|
45
|
+
onDelete: (providerId: string) => void;
|
|
46
|
+
onTest?: (providerId: string) => void;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function hasSuccessField(result: ProviderTestState): result is TestResult {
|
|
50
|
+
return Object.prototype.hasOwnProperty.call(result, "success");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Using Object.prototype.hasOwnProperty.call to avoid 'in' operator
|
|
54
|
+
function isNotConfiguredState(result: ProviderTestState): result is { notConfigured: true } {
|
|
55
|
+
return Object.prototype.hasOwnProperty.call(result, "notConfigured");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getErrorIcon(type: ErrorType): JSX.Element {
|
|
59
|
+
const iconProps = { className: "size-3", strokeWidth: 2 };
|
|
60
|
+
switch (type) {
|
|
61
|
+
case "timeout":
|
|
62
|
+
return <Clock {...iconProps} />;
|
|
63
|
+
case "network_unreachable":
|
|
64
|
+
return <WifiOff {...iconProps} />;
|
|
65
|
+
case "connection_refused":
|
|
66
|
+
return <Wifi {...iconProps} />;
|
|
67
|
+
case "auth_failed":
|
|
68
|
+
return <Lock {...iconProps} />;
|
|
69
|
+
case "rate_limited":
|
|
70
|
+
return <Gauge {...iconProps} />;
|
|
71
|
+
case "server_error":
|
|
72
|
+
return <Server {...iconProps} />;
|
|
73
|
+
case "invalid_response":
|
|
74
|
+
return <HelpCircle {...iconProps} />;
|
|
75
|
+
case "unknown":
|
|
76
|
+
return <AlertCircle {...iconProps} />;
|
|
77
|
+
default:
|
|
78
|
+
return <AlertCircle {...iconProps} />;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function TestStatus({ result }: { result: ProviderTestState }): JSX.Element {
|
|
83
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
84
|
+
|
|
85
|
+
if (!hasSuccessField(result)) {
|
|
86
|
+
// Not TestResult - check if NotConfigured or Testing
|
|
87
|
+
if (isNotConfiguredState(result)) {
|
|
88
|
+
return (
|
|
89
|
+
<div className="flex items-center gap-1 text-xs text-muted-foreground shrink-0">
|
|
90
|
+
<Minus className="size-3" />
|
|
91
|
+
<span>Not configured</span>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
// Must be Testing state
|
|
96
|
+
return (
|
|
97
|
+
<div className="flex items-center gap-1 text-xs text-muted-foreground shrink-0">
|
|
98
|
+
<RotateCw className="size-3 animate-spin" />
|
|
99
|
+
<span>Testing...</span>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (result.success) {
|
|
104
|
+
const tokenParts: ReactNode[] = [];
|
|
105
|
+
if (result.inputTokens !== undefined) {
|
|
106
|
+
tokenParts.push(<span key="in">{result.inputTokens} in</span>);
|
|
107
|
+
}
|
|
108
|
+
if (result.outputTokens !== undefined) {
|
|
109
|
+
tokenParts.push(<span key="out">{result.outputTokens} out</span>);
|
|
110
|
+
}
|
|
111
|
+
if (result.cacheCreationInputTokens !== undefined && result.cacheCreationInputTokens > 0) {
|
|
112
|
+
tokenParts.push(
|
|
113
|
+
<TooltipProvider key="cache-create">
|
|
114
|
+
<Tooltip>
|
|
115
|
+
<TooltipTrigger asChild>
|
|
116
|
+
<span className="font-mono tabular-nums text-emerald-400">
|
|
117
|
+
+{result.cacheCreationInputTokens} cache
|
|
118
|
+
</span>
|
|
119
|
+
</TooltipTrigger>
|
|
120
|
+
<TooltipContent>Tokens cached for reuse, reducing future API cost</TooltipContent>
|
|
121
|
+
</Tooltip>
|
|
122
|
+
</TooltipProvider>,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (result.cacheReadInputTokens !== undefined && result.cacheReadInputTokens > 0) {
|
|
126
|
+
tokenParts.push(
|
|
127
|
+
<TooltipProvider key="cache-read">
|
|
128
|
+
<Tooltip>
|
|
129
|
+
<TooltipTrigger asChild>
|
|
130
|
+
<span className="font-mono tabular-nums text-purple-400">
|
|
131
|
+
~{result.cacheReadInputTokens} cached
|
|
132
|
+
</span>
|
|
133
|
+
</TooltipTrigger>
|
|
134
|
+
<TooltipContent>Tokens served from cache, reducing API cost</TooltipContent>
|
|
135
|
+
</Tooltip>
|
|
136
|
+
</TooltipProvider>,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
const displayTokens: ReactNode[] = [];
|
|
140
|
+
for (let i = 0; i < tokenParts.length; i++) {
|
|
141
|
+
if (i > 0) displayTokens.push(", ");
|
|
142
|
+
displayTokens.push(tokenParts[i]);
|
|
143
|
+
}
|
|
144
|
+
return (
|
|
145
|
+
<TooltipProvider>
|
|
146
|
+
<Tooltip>
|
|
147
|
+
<TooltipTrigger asChild>
|
|
148
|
+
<div className="flex items-center gap-1 text-xs text-green-600 shrink-0">
|
|
149
|
+
<CheckCircle className="size-3" />
|
|
150
|
+
<span>Connected</span>
|
|
151
|
+
{tokenParts.length > 0 && (
|
|
152
|
+
<span className="text-muted-foreground">({displayTokens})</span>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
</TooltipTrigger>
|
|
156
|
+
<TooltipContent>Connection test passed</TooltipContent>
|
|
157
|
+
</Tooltip>
|
|
158
|
+
</TooltipProvider>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const error = result.error;
|
|
163
|
+
const errorMessage = error?.message ?? "Connection failed";
|
|
164
|
+
const errorHint = error?.hint;
|
|
165
|
+
const errorDetails = error?.details;
|
|
166
|
+
const errorType = error?.type ?? "unknown";
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div className="flex flex-col gap-1 shrink-0">
|
|
170
|
+
<div className="flex items-center gap-1 text-xs text-red-600 max-w-[200px]">
|
|
171
|
+
{getErrorIcon(errorType)}
|
|
172
|
+
<TooltipProvider>
|
|
173
|
+
<Tooltip>
|
|
174
|
+
<TooltipTrigger asChild>
|
|
175
|
+
<span className="truncate">{errorMessage}</span>
|
|
176
|
+
</TooltipTrigger>
|
|
177
|
+
<TooltipContent>Connection test failed</TooltipContent>
|
|
178
|
+
</Tooltip>
|
|
179
|
+
</TooltipProvider>
|
|
180
|
+
{errorDetails !== undefined && (
|
|
181
|
+
<TooltipProvider>
|
|
182
|
+
<Tooltip>
|
|
183
|
+
<TooltipTrigger asChild>
|
|
184
|
+
<button
|
|
185
|
+
type="button"
|
|
186
|
+
onClick={() => setShowDetails(!showDetails)}
|
|
187
|
+
className="shrink-0 text-muted-foreground hover:text-foreground transition-colors"
|
|
188
|
+
>
|
|
189
|
+
{showDetails ? <EyeOff className="size-3" /> : <Eye className="size-3" />}
|
|
190
|
+
</button>
|
|
191
|
+
</TooltipTrigger>
|
|
192
|
+
<TooltipContent>
|
|
193
|
+
{showDetails ? "Hide error details" : "Show detailed error information"}
|
|
194
|
+
</TooltipContent>
|
|
195
|
+
</Tooltip>
|
|
196
|
+
</TooltipProvider>
|
|
197
|
+
)}
|
|
198
|
+
</div>
|
|
199
|
+
{showDetails && errorDetails !== undefined && (
|
|
200
|
+
<div className="text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]">
|
|
201
|
+
{errorHint !== undefined && <div className="mb-1">{errorHint}</div>}
|
|
202
|
+
<div className="font-mono whitespace-pre-wrap break-all text-red-400/80">
|
|
203
|
+
{errorDetails}
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function formatTimeAgo(isoString: string): string {
|
|
212
|
+
const now = Date.now();
|
|
213
|
+
const then = new Date(isoString).getTime();
|
|
214
|
+
const diffMs = now - then;
|
|
215
|
+
const diffSec = Math.floor(diffMs / 1000);
|
|
216
|
+
if (diffSec < 60) return "just now";
|
|
217
|
+
const diffMin = Math.floor(diffSec / 60);
|
|
218
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
219
|
+
const diffHr = Math.floor(diffMin / 60);
|
|
220
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
221
|
+
const diffDay = Math.floor(diffHr / 24);
|
|
222
|
+
return `${diffDay}d ago`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function ProviderCard({
|
|
226
|
+
provider,
|
|
227
|
+
testResults,
|
|
228
|
+
isTesting,
|
|
229
|
+
testingTimeLeft,
|
|
230
|
+
isHighlighted,
|
|
231
|
+
onEdit,
|
|
232
|
+
onDelete,
|
|
233
|
+
onTest,
|
|
234
|
+
}: ProviderCardProps): JSX.Element {
|
|
235
|
+
const [showApiKey, setShowApiKey] = useState(false);
|
|
236
|
+
const [copied, setCopied] = useState(false);
|
|
237
|
+
const [showModelResults, setShowModelResults] = useState(false);
|
|
238
|
+
const hasLoggedRef = useRef<string | null>(null);
|
|
239
|
+
const lastTestedAtRef = useRef<string | undefined>(undefined);
|
|
240
|
+
|
|
241
|
+
// Reset log state when new test results arrive
|
|
242
|
+
if (testResults?.testedAt !== undefined && testResults.testedAt !== lastTestedAtRef.current) {
|
|
243
|
+
lastTestedAtRef.current = testResults.testedAt;
|
|
244
|
+
hasLoggedRef.current = null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Call log API when user expands model test results for the first time
|
|
248
|
+
const handleToggleModelResults = useCallback(() => {
|
|
249
|
+
setShowModelResults((v) => {
|
|
250
|
+
const next = !v;
|
|
251
|
+
if (next && hasLoggedRef.current === null && testResults?.models !== undefined) {
|
|
252
|
+
hasLoggedRef.current = testResults.testedAt ?? "";
|
|
253
|
+
// Fire-and-forget: commit test results to dashboard log
|
|
254
|
+
void fetch(`/api/providers/${provider.id}/test/log`, {
|
|
255
|
+
method: "POST",
|
|
256
|
+
headers: { "Content-Type": "application/json" },
|
|
257
|
+
body: JSON.stringify(testResults),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
return next;
|
|
261
|
+
});
|
|
262
|
+
}, [provider.id, testResults]);
|
|
263
|
+
|
|
264
|
+
function handleCopy() {
|
|
265
|
+
navigator.clipboard.writeText(provider.apiKey).catch(() => {});
|
|
266
|
+
setCopied(true);
|
|
267
|
+
setTimeout(() => setCopied(false), 2000);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Get docs URL: use provider.apiDocsUrl if configured, otherwise check KNOWN_PROVIDER_DOCS
|
|
271
|
+
const docsUrl =
|
|
272
|
+
provider.apiDocsUrl ??
|
|
273
|
+
Object.entries(KNOWN_PROVIDER_DOCS).find(([keyword]) =>
|
|
274
|
+
provider.name.toLowerCase().includes(keyword),
|
|
275
|
+
)?.[1];
|
|
276
|
+
|
|
277
|
+
return (
|
|
278
|
+
<div
|
|
279
|
+
className={`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${isHighlighted === true ? "ring-2 ring-primary shadow-md" : ""}`}
|
|
280
|
+
>
|
|
281
|
+
<div className="flex items-start justify-between gap-2">
|
|
282
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
283
|
+
<span className="font-medium truncate">{provider.name}</span>
|
|
284
|
+
{provider.source === "company" && (
|
|
285
|
+
<TooltipProvider>
|
|
286
|
+
<Tooltip>
|
|
287
|
+
<TooltipTrigger asChild>
|
|
288
|
+
<span className="text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0">
|
|
289
|
+
公司
|
|
290
|
+
</span>
|
|
291
|
+
</TooltipTrigger>
|
|
292
|
+
<TooltipContent>Company-provided API key</TooltipContent>
|
|
293
|
+
</Tooltip>
|
|
294
|
+
</TooltipProvider>
|
|
295
|
+
)}
|
|
296
|
+
{provider.source === "personal" && (
|
|
297
|
+
<TooltipProvider>
|
|
298
|
+
<Tooltip>
|
|
299
|
+
<TooltipTrigger asChild>
|
|
300
|
+
<span className="text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0">
|
|
301
|
+
个人
|
|
302
|
+
</span>
|
|
303
|
+
</TooltipTrigger>
|
|
304
|
+
<TooltipContent>Your personal API key</TooltipContent>
|
|
305
|
+
</Tooltip>
|
|
306
|
+
</TooltipProvider>
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
{docsUrl !== undefined && (
|
|
310
|
+
<a
|
|
311
|
+
href={docsUrl}
|
|
312
|
+
target="_blank"
|
|
313
|
+
rel="noopener noreferrer"
|
|
314
|
+
className="text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs"
|
|
315
|
+
title="View API documentation"
|
|
316
|
+
>
|
|
317
|
+
<ExternalLink className="size-3" />
|
|
318
|
+
<span className="sr-only">Docs</span>
|
|
319
|
+
</a>
|
|
320
|
+
)}
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
{provider.models !== undefined && provider.models.length > 0 && (
|
|
324
|
+
<div className="flex flex-wrap gap-1">
|
|
325
|
+
{provider.models.map((m) => (
|
|
326
|
+
<span key={m} className="text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground">
|
|
327
|
+
{m}
|
|
328
|
+
</span>
|
|
329
|
+
))}
|
|
330
|
+
</div>
|
|
331
|
+
)}
|
|
332
|
+
|
|
333
|
+
<div className="flex items-center gap-2">
|
|
334
|
+
<code className="text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate">
|
|
335
|
+
{showApiKey ? provider.apiKey : maskApiKey(provider.apiKey)}
|
|
336
|
+
</code>
|
|
337
|
+
<button
|
|
338
|
+
type="button"
|
|
339
|
+
onClick={() => setShowApiKey((s) => !s)}
|
|
340
|
+
className="text-muted-foreground hover:text-foreground transition-colors p-1"
|
|
341
|
+
aria-label={showApiKey ? "Hide API key" : "Show API key"}
|
|
342
|
+
>
|
|
343
|
+
{showApiKey ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
|
|
344
|
+
</button>
|
|
345
|
+
<button
|
|
346
|
+
type="button"
|
|
347
|
+
onClick={handleCopy}
|
|
348
|
+
className="text-muted-foreground hover:text-foreground transition-colors p-1"
|
|
349
|
+
aria-label="Copy API key"
|
|
350
|
+
>
|
|
351
|
+
{copied ? <Check className="size-4 text-green-500" /> : <Copy className="size-4" />}
|
|
352
|
+
</button>
|
|
353
|
+
</div>
|
|
354
|
+
|
|
355
|
+
{provider.anthropicBaseUrl !== undefined && provider.anthropicBaseUrl !== "" && (
|
|
356
|
+
<div className="flex items-center justify-between gap-2">
|
|
357
|
+
<div className="text-xs text-muted-foreground min-w-0 flex-1">
|
|
358
|
+
<span className="font-medium">Anthropic:</span>{" "}
|
|
359
|
+
<span className="truncate">{provider.anthropicBaseUrl}</span>
|
|
360
|
+
</div>
|
|
361
|
+
{testResults && <TestStatus result={testResults.anthropic.nonStreaming} />}
|
|
362
|
+
</div>
|
|
363
|
+
)}
|
|
364
|
+
|
|
365
|
+
{provider.openaiBaseUrl !== undefined && provider.openaiBaseUrl !== "" && (
|
|
366
|
+
<div className="flex items-center justify-between gap-2">
|
|
367
|
+
<div className="text-xs text-muted-foreground min-w-0 flex-1">
|
|
368
|
+
<span className="font-medium">OpenAI:</span>{" "}
|
|
369
|
+
<span className="truncate">{provider.openaiBaseUrl}</span>
|
|
370
|
+
</div>
|
|
371
|
+
{testResults && <TestStatus result={testResults.openai.nonStreaming} />}
|
|
372
|
+
</div>
|
|
373
|
+
)}
|
|
374
|
+
|
|
375
|
+
{testResults?.testedAt !== undefined && (
|
|
376
|
+
<div className="text-xs text-muted-foreground flex items-center gap-1">
|
|
377
|
+
<Clock className="size-3" />
|
|
378
|
+
<span>Tested {formatTimeAgo(testResults.testedAt)}</span>
|
|
379
|
+
</div>
|
|
380
|
+
)}
|
|
381
|
+
{testResults?.models !== undefined && Object.keys(testResults.models).length > 0 && (
|
|
382
|
+
<div className="border-t pt-2">
|
|
383
|
+
<button
|
|
384
|
+
type="button"
|
|
385
|
+
onClick={handleToggleModelResults}
|
|
386
|
+
className="text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1"
|
|
387
|
+
>
|
|
388
|
+
<span className="font-mono">{showModelResults ? "▾" : "▸"}</span>
|
|
389
|
+
Model Test Results ({Object.keys(testResults.models).length})
|
|
390
|
+
</button>
|
|
391
|
+
{showModelResults && (
|
|
392
|
+
<div className="mt-2 overflow-x-auto">
|
|
393
|
+
<table className="w-full text-xs border-collapse">
|
|
394
|
+
<thead>
|
|
395
|
+
<tr className="border-b border-border">
|
|
396
|
+
<th className="text-left py-1 px-2 font-medium text-muted-foreground">Model</th>
|
|
397
|
+
{provider.anthropicBaseUrl !== undefined &&
|
|
398
|
+
provider.anthropicBaseUrl !== "" && (
|
|
399
|
+
<th className="text-left py-1 px-2 font-medium text-muted-foreground">
|
|
400
|
+
Anthropic
|
|
401
|
+
</th>
|
|
402
|
+
)}
|
|
403
|
+
{provider.openaiBaseUrl !== undefined && provider.openaiBaseUrl !== "" && (
|
|
404
|
+
<th className="text-left py-1 px-2 font-medium text-muted-foreground">
|
|
405
|
+
OpenAI
|
|
406
|
+
</th>
|
|
407
|
+
)}
|
|
408
|
+
</tr>
|
|
409
|
+
</thead>
|
|
410
|
+
<tbody>
|
|
411
|
+
{Object.entries(testResults.models).map(([modelName, modelResult]) => (
|
|
412
|
+
<tr key={modelName} className="border-b border-border/50 last:border-0">
|
|
413
|
+
<td className="py-1 px-2 font-medium">{modelName}</td>
|
|
414
|
+
{provider.anthropicBaseUrl !== undefined &&
|
|
415
|
+
provider.anthropicBaseUrl !== "" && (
|
|
416
|
+
<td className="py-1 px-2">
|
|
417
|
+
<TestStatus result={modelResult.anthropic.nonStreaming} />
|
|
418
|
+
</td>
|
|
419
|
+
)}
|
|
420
|
+
{provider.openaiBaseUrl !== undefined && provider.openaiBaseUrl !== "" && (
|
|
421
|
+
<td className="py-1 px-2">
|
|
422
|
+
<TestStatus result={modelResult.openai.nonStreaming} />
|
|
423
|
+
</td>
|
|
424
|
+
)}
|
|
425
|
+
</tr>
|
|
426
|
+
))}
|
|
427
|
+
</tbody>
|
|
428
|
+
</table>
|
|
429
|
+
</div>
|
|
430
|
+
)}
|
|
431
|
+
</div>
|
|
432
|
+
)}
|
|
433
|
+
|
|
434
|
+
<div className="flex gap-2 pt-1 border-t">
|
|
435
|
+
{onTest !== undefined && (
|
|
436
|
+
<Button
|
|
437
|
+
variant="outline"
|
|
438
|
+
size="sm"
|
|
439
|
+
onClick={() => onTest(provider.id)}
|
|
440
|
+
className="text-xs h-7 gap-1"
|
|
441
|
+
disabled={isTesting ?? false}
|
|
442
|
+
>
|
|
443
|
+
<RotateCw className={`size-3 ${(isTesting ?? false) ? "animate-spin" : ""}`} />
|
|
444
|
+
{(isTesting ?? false)
|
|
445
|
+
? testingTimeLeft !== undefined
|
|
446
|
+
? `Testing (${testingTimeLeft}s)`
|
|
447
|
+
: "Testing..."
|
|
448
|
+
: "Test"}
|
|
449
|
+
</Button>
|
|
450
|
+
)}
|
|
451
|
+
<Button
|
|
452
|
+
variant="outline"
|
|
453
|
+
size="sm"
|
|
454
|
+
onClick={() => onEdit(provider)}
|
|
455
|
+
className="text-xs h-7 gap-1"
|
|
456
|
+
disabled={isTesting ?? false}
|
|
457
|
+
>
|
|
458
|
+
<Pencil className="size-3" />
|
|
459
|
+
Edit
|
|
460
|
+
</Button>
|
|
461
|
+
<Button
|
|
462
|
+
variant="outline"
|
|
463
|
+
size="sm"
|
|
464
|
+
onClick={() => onDelete(provider.id)}
|
|
465
|
+
className="text-xs h-7 gap-1 text-destructive hover:text-destructive"
|
|
466
|
+
disabled={isTesting ?? false}
|
|
467
|
+
>
|
|
468
|
+
<Trash2 className="size-3" />
|
|
469
|
+
Delete
|
|
470
|
+
</Button>
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
);
|
|
474
|
+
}
|