mirror of
https://github.com/cline/cline.git
synced 2026-09-13 18:10:14 +08:00
fix link by calling grpc (#4422)
This commit is contained in:
committed by
nighttrek
parent
33b53fd6ab
commit
3fbfc24864
@@ -265,4 +265,7 @@ service UiService {
|
||||
|
||||
// Returns the HTML for the webview index page. This is only used by external clients, not by the vscode webview.
|
||||
rpc getWebviewHtml(EmptyRequest) returns (String);
|
||||
|
||||
// Opens a URL in the default browser
|
||||
rpc openUrl(StringRequest) returns (Empty);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { Controller } from "../index"
|
||||
import type { StringRequest } from "../../../shared/proto/common"
|
||||
import { Empty } from "../../../shared/proto/common"
|
||||
import { openUrlInBrowser } from "../../../utils/github-url-utils"
|
||||
|
||||
/**
|
||||
* Opens a URL in the default browser
|
||||
* @param controller The controller instance
|
||||
* @param request The URL to open
|
||||
* @returns Empty response
|
||||
*/
|
||||
export async function openUrl(controller: Controller, request: StringRequest): Promise<Empty> {
|
||||
try {
|
||||
await openUrlInBrowser(request.value)
|
||||
return Empty.create({})
|
||||
} catch (error) {
|
||||
console.error(`Failed to open URL: ${error}`)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import McpResponseDisplay from "@/components/mcp/chat-display/McpResponseDisplay
|
||||
import McpResourceRow from "@/components/mcp/configuration/tabs/installed/server-row/McpResourceRow"
|
||||
import McpToolRow from "@/components/mcp/configuration/tabs/installed/server-row/McpToolRow"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { FileServiceClient, TaskServiceClient } from "@/services/grpc-client"
|
||||
import { FileServiceClient, TaskServiceClient, UiServiceClient } from "@/services/grpc-client"
|
||||
import { findMatchingResourceOrTemplate, getMcpServerDisplayName } from "@/utils/mcp"
|
||||
import { vscode } from "@/utils/vscode"
|
||||
import {
|
||||
@@ -697,15 +697,13 @@ export const ChatRowContent = ({
|
||||
msUserSelect: "none",
|
||||
}}
|
||||
onClick={() => {
|
||||
// Attempt to open the URL in the default browser
|
||||
// Open the URL in the default browser using gRPC
|
||||
if (tool.path) {
|
||||
// Assuming 'openUrl' is a valid action the extension can handle.
|
||||
// If not, this might need adjustment based on how other external link openings are handled.
|
||||
vscode.postMessage({
|
||||
type: "action", // This should be a valid MessageType from WebviewMessage
|
||||
action: "openUrl", // This should be a valid WebviewAction from WebviewMessage
|
||||
url: tool.path,
|
||||
} as any) // Using 'as any' for now if 'openUrl' isn't strictly typed yet
|
||||
UiServiceClient.openUrl(StringRequest.create({ value: tool.path }))
|
||||
|
||||
.catch((err) => {
|
||||
console.error("Failed to open URL:", err)
|
||||
})
|
||||
}
|
||||
}}>
|
||||
<span
|
||||
|
||||
Reference in New Issue
Block a user