Refactor CLI tool cards to use BaseUrlSelect component and pass additional tunnel and Tailscale configuration

This commit is contained in:
decolua
2026-05-05 20:22:21 +07:00
parent 1c8314252b
commit 6344abcf8d
11 changed files with 340 additions and 185 deletions
@@ -3,9 +3,9 @@
import { useState, useEffect } from "react";
import { Card, Button, ModelSelectModal, ManualConfigModal } from "@/shared/components";
import Image from "next/image";
import EndpointPresetControl from "./EndpointPresetControl";
import BaseUrlSelect from "./BaseUrlSelect";
export default function CopilotToolCard({ tool, isExpanded, onToggle, baseUrl, apiKeys, activeProviders, cloudEnabled, initialStatus }) {
export default function CopilotToolCard({ tool, isExpanded, onToggle, baseUrl, apiKeys, activeProviders, cloudEnabled, initialStatus, tunnelEnabled, tunnelPublicUrl, tailscaleEnabled, tailscaleUrl }) {
const [status, setStatus] = useState(initialStatus || null);
const [checking, setChecking] = useState(false);
const [applying, setApplying] = useState(false);
@@ -206,21 +206,16 @@ export default function CopilotToolCard({ tool, isExpanded, onToggle, baseUrl, a
</div>
<div className="flex flex-col gap-3">
<EndpointPresetControl
baseUrl={getEffectiveBaseUrl()}
apiKey={selectedApiKey}
onBaseUrlChange={setCustomBaseUrl}
onApiKeyChange={setSelectedApiKey}
/>
<div className="flex flex-col gap-1">
<label className="text-xs font-medium text-text-muted">Base URL</label>
<input
type="text"
value={getEffectiveBaseUrl()}
onChange={(e) => setCustomBaseUrl(e.target.value)}
placeholder="https://.../v1"
className="px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"
<BaseUrlSelect
value={customBaseUrl || getEffectiveBaseUrl()}
onChange={setCustomBaseUrl}
requiresExternalUrl={tool.requiresExternalUrl}
tunnelEnabled={tunnelEnabled}
tunnelPublicUrl={tunnelPublicUrl}
tailscaleEnabled={tailscaleEnabled}
tailscaleUrl={tailscaleUrl}
/>
</div>