(prompt?: string)
| 57 | * @param prompt 可选的提示文本 |
| 58 | */ |
| 59 | export 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 | * 翻译选中的文本 |
nothing calls this directly
no test coverage detected