MCPcopy Create free account
hub / github.com/027xiguapi/code-box / captureAndSendToChat

Function captureAndSendToChat

utils/chat-integration.ts:59–78  ·  view source on GitHub ↗
(prompt?: string)

Source from the content-addressed store, hash-verified

57 * @param prompt 可选的提示文本
58 */
59export async function captureAndSendToChat(prompt?: string) {
60 try {
61 const dataUrl = await chrome.tabs.captureVisibleTab(null, {
62 format: "png"
63 })
64
65 await sendImageToChat([dataUrl])
66
67 if (prompt) {
68 setTimeout(() => {
69 sendTextToChat(prompt, false)
70 }, 100)
71 }
72
73 return { success: true }
74 } catch (error) {
75 console.error("[Chat Integration] Capture error:", error)
76 return { success: false, error: error.message }
77 }
78}
79
80/**
81 * 翻译选中的文本

Callers

nothing calls this directly

Calls 2

sendImageToChatFunction · 0.70
sendTextToChatFunction · 0.70

Tested by

no test coverage detected