removed most of the UI, only leaving a link to advanced settings

This commit is contained in:
Evan 2025-01-22 20:32:56 +08:00
parent ab8f5d6f36
commit 5f97b4b7fa
5 changed files with 31 additions and 127 deletions

View file

@ -875,7 +875,7 @@ RULES
- The user may provide a file's contents directly in their message, in which case you shouldn't use the read_file tool to get the file contents again since you already have it.
- Your goal is to try to accomplish the user's task, NOT engage in a back and forth conversation.${
supportsComputerUse
? '\n- The user may ask generic non-development tasks, such as "what\'s the latest news" or "look up the weather in San Diego", in which case you might use the browser_action tool to complete the task if it makes sense to do so, rather than trying to create a website or using curl to answer the question. However, if an available MCP server tool or resource can be used instead, you should prefer to use it over browser_action.'
? `\n- The user may ask generic non-development tasks, such as "what\'s the latest news" or "look up the weather in San Diego", in which case you might use the browser_action tool to complete the task if it makes sense to do so, rather than trying to create a website or using curl to answer the question.${mcpHub.isMcpEnabled() ? "However, if an available MCP server tool or resource can be used instead, you should prefer to use it over browser_action." : ""}`
: ""
}
- NEVER end attempt_completion result with a question or request to engage in further conversation! Formulate the end of your result in a way that is final and does not require further input from the user.

View file

@ -194,7 +194,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.disposables,
)
// Listen for when color changes or MCP settings
// Listen for when color changes
vscode.workspace.onDidChangeConfiguration(
async (e) => {
if (e && e.affectsConfiguration("workbench.colorTheme")) {
@ -204,14 +204,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
text: JSON.stringify(await getTheme()),
})
}
if (e && e.affectsConfiguration("cline.mcp.enabled")) {
// Send updated MCP enabled state
const enabled = this.mcpHub?.isMcpEnabled() ?? true
await this.postMessageToWebview({
type: "mcpEnabled",
enabled,
})
}
},
null,
this.disposables,
@ -580,18 +572,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
await vscode.commands.executeCommand("workbench.action.openSettings", "@ext:saoudrizwan.claude-dev")
break
}
case "getMcpEnabled": {
const enabled = this.mcpHub?.isMcpEnabled() ?? true
await this.postMessageToWebview({
type: "mcpEnabled",
enabled,
})
break
}
case "toggleMcp": {
await vscode.workspace.getConfiguration("cline.mcp").update("enabled", message.enabled, true)
break
}
// Add more switch case statements here as more webview message commands
// are created within the webview context (i.e. inside media/main.js)
}

View file

@ -21,9 +21,6 @@ export interface ExtensionMessage {
| "openRouterModels"
| "mcpServers"
| "relinquishControl"
| "getMcpEnabled"
| "mcpEnabled"
| "toggleMcp"
text?: string
action?: "chatButtonClicked" | "mcpButtonClicked" | "settingsButtonClicked" | "historyButtonClicked" | "didBecomeVisible"
invoke?: "sendMessage" | "primaryButtonClick" | "secondaryButtonClick"
@ -35,7 +32,6 @@ export interface ExtensionMessage {
partialMessage?: ClineMessage
openRouterModels?: Record<string, ModelInfo>
mcpServers?: McpServer[]
enabled?: boolean // For mcpEnabled message
}
export interface ExtensionState {

View file

@ -32,8 +32,6 @@ export interface WebviewMessage {
| "checkpointRestore"
| "taskCompletionViewChanges"
| "openExtensionSettings"
| "getMcpEnabled"
| "toggleMcp"
// | "relaunchChromeDebugMode"
text?: string
askResponse?: ClineAskResponse
@ -43,7 +41,6 @@ export interface WebviewMessage {
number?: number
autoApprovalSettings?: AutoApprovalSettings
browserSettings?: BrowserSettings
enabled?: boolean // For toggleMcp message
}
export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "messageResponse"

View file

@ -1,12 +1,5 @@
import {
VSCodeButton,
VSCodeLink,
VSCodePanels,
VSCodePanelTab,
VSCodePanelView,
VSCodeCheckbox,
} from "@vscode/webview-ui-toolkit/react"
import { useEffect, useState } from "react"
import { VSCodeButton, VSCodeLink, VSCodePanels, VSCodePanelTab, VSCodePanelView } from "@vscode/webview-ui-toolkit/react"
import { useState } from "react"
import { vscode } from "../../utils/vscode"
import { useExtensionState } from "../../context/ExtensionStateContext"
import { McpServer } from "../../../../src/shared/mcp"
@ -19,31 +12,7 @@ type McpViewProps = {
const McpView = ({ onDone }: McpViewProps) => {
const { mcpServers: servers } = useExtensionState()
const [isMcpEnabled, setIsMcpEnabled] = useState(true)
useEffect(() => {
// Get initial MCP enabled state
vscode.postMessage({ type: "getMcpEnabled" })
}, [])
useEffect(() => {
const handler = (event: MessageEvent) => {
const message = event.data
if (message.type === "mcpEnabled") {
setIsMcpEnabled(message.enabled)
}
}
window.addEventListener("message", handler)
return () => window.removeEventListener("message", handler)
}, [])
const toggleMcp = () => {
vscode.postMessage({
type: "toggleMcp",
enabled: !isMcpEnabled,
})
setIsMcpEnabled(!isMcpEnabled)
}
// const [servers, setServers] = useState<McpServer[]>([
// // Add some mock servers for testing
// {
@ -150,58 +119,7 @@ const McpView = ({ onDone }: McpViewProps) => {
</VSCodeLink>
</div>
{/* MCP Toggle Section */}
<div
style={{
marginBottom: "16px",
paddingBottom: "16px",
borderBottom: "1px solid var(--vscode-textSeparator-foreground)",
}}>
<div>
<VSCodeCheckbox
checked={isMcpEnabled}
onChange={toggleMcp}
style={{
display: "flex",
alignItems: "center",
gap: "8px",
padding: "4px 0",
cursor: "pointer",
fontSize: "13px",
}}>
Enable MCP
</VSCodeCheckbox>
{isMcpEnabled && (
<div
style={{
marginTop: "4px",
marginLeft: "24px",
color: "var(--vscode-descriptionForeground)",
fontSize: "12px",
}}>
Disabling MCP will save on tokens passed in the context.
</div>
)}
{!isMcpEnabled && (
<div
style={{
padding: "8px 12px",
marginTop: "8px",
background: "var(--vscode-textBlockQuote-background)",
border: "1px solid var(--vscode-textBlockQuote-border)",
borderRadius: "4px",
color: "var(--vscode-descriptionForeground)",
fontSize: "12px",
lineHeight: "1.4",
}}>
MCP is currently disabled. Enable MCP to use MCP servers and tools. Enabling MCP will use
additional tokens.
</div>
)}
</div>
</div>
{servers.length > 0 && isMcpEnabled && (
{servers.length > 0 && (
<div
style={{
display: "flex",
@ -215,19 +133,32 @@ const McpView = ({ onDone }: McpViewProps) => {
)}
{/* Server Configuration Button */}
{isMcpEnabled && (
<div style={{ marginTop: "10px", width: "100%" }}>
<VSCodeButton
appearance="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
}}>
<span className="codicon codicon-server" style={{ marginRight: "6px" }}></span>
Configure MCP Servers
</VSCodeButton>
</div>
)}
<div style={{ marginTop: "10px", width: "100%" }}>
<VSCodeButton
appearance="secondary"
style={{ width: "100%" }}
onClick={() => {
vscode.postMessage({ type: "openMcpSettings" })
}}>
<span className="codicon codicon-server" style={{ marginRight: "6px" }}></span>
Configure MCP Servers
</VSCodeButton>
</div>
{/* Advanced Settings Link */}
<div style={{ textAlign: "center", marginTop: "5px" }}>
<VSCodeLink
onClick={() => {
vscode.postMessage({
type: "openExtensionSettings",
text: "cline.mcp",
})
}}
style={{ fontSize: "12px" }}>
Edit Advanced MCP Settings...
</VSCodeLink>
</div>
{/* Bottom padding */}
<div style={{ height: "20px" }} />