(images: string[])
| 32 | * @param images Base64 格式的图片数组 |
| 33 | */ |
| 34 | export async function sendImageToChat(images: string[]) { |
| 35 | try { |
| 36 | const [tab] = await chrome.tabs.query({ |
| 37 | active: true, |
| 38 | currentWindow: true |
| 39 | }) |
| 40 | |
| 41 | if (tab.id) { |
| 42 | await chrome.tabs.sendMessage(tab.id, { |
| 43 | action: "sendImageToChat", |
| 44 | images |
| 45 | }) |
| 46 | return { success: true } |
| 47 | } |
| 48 | return { success: false, error: "No active tab" } |
| 49 | } catch (error) { |
| 50 | console.error("[Chat Integration] Error:", error) |
| 51 | return { success: false, error: error.message } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * 截图并发送到聊天 |
no outgoing calls
no test coverage detected