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

Function sendTextToChat

utils/chat-integration.ts:8–28  ·  view source on GitHub ↗
(text: string, autoSend = false)

Source from the content-addressed store, hash-verified

6 * @param autoSend 是否自动发送(true)或仅插入(false)
7 */
8export async function sendTextToChat(text: string, autoSend = false) {
9 try {
10 const [tab] = await chrome.tabs.query({
11 active: true,
12 currentWindow: true
13 })
14
15 if (tab.id) {
16 await chrome.tabs.sendMessage(tab.id, {
17 action: "sendToChat",
18 text,
19 autoSend
20 })
21 return { success: true }
22 }
23 return { success: false, error: "No active tab" }
24 } catch (error) {
25 console.error("[Chat Integration] Error:", error)
26 return { success: false, error: error.message }
27 }
28}
29
30/**
31 * 发送图片到聊天应用

Callers 4

captureAndSendToChatFunction · 0.70
translateTextFunction · 0.70
explainCodeFunction · 0.70
summarizeContentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected