(annotation: any)
| 110 | } |
| 111 | |
| 112 | function buildAnnotationPrompt(annotation: any): string { |
| 113 | const comment = typeof annotation?.comment === "string" ? annotation.comment.trim() : ""; |
| 114 | const page = annotation?.page || {}; |
| 115 | const element = annotation?.element || {}; |
| 116 | const rect = element?.rect || {}; |
| 117 | const viewport = annotation?.viewport || {}; |
| 118 | |
| 119 | return [ |
| 120 | "Browser annotation from Chrome", |
| 121 | "", |
| 122 | "User comment:", |
| 123 | comment || "(no comment provided)", |
| 124 | "", |
| 125 | "Page:", |
| 126 | `Title: ${page.title || ""}`, |
| 127 | `URL: ${page.url || ""}`, |
| 128 | typeof annotation?.tabId === "number" ? `Tab ID: ${annotation.tabId}` : "Tab ID: ", |
| 129 | `Viewport: width=${viewport.width ?? ""} height=${viewport.height ?? ""} devicePixelRatio=${viewport.devicePixelRatio ?? ""}`, |
| 130 | "", |
| 131 | "Selected element:", |
| 132 | `Selector: ${element.selector || ""}`, |
| 133 | `Tag: ${element.tag || ""}`, |
| 134 | `Role: ${element.role || ""}`, |
| 135 | `Text: ${element.text || ""}`, |
| 136 | `Aria label: ${element.ariaLabel || ""}`, |
| 137 | `Rect: x=${rect.x ?? ""} y=${rect.y ?? ""} width=${rect.width ?? ""} height=${rect.height ?? ""}`, |
| 138 | "", |
| 139 | "Please inspect the screenshot and selected element metadata, then make the appropriate code change.", |
| 140 | ].join("\n"); |
| 141 | } |
| 142 | |
| 143 | function isExplicitFalse(value: any): boolean { |
| 144 | return value === false || value?.data === false; |
no outgoing calls
no test coverage detected