Add Crawl4AI Assistant Chrome Extension

- Created manifest.json for the Crawl4AI Assistant extension.
- Added popup HTML, CSS, and JS files for the extension interface.
- Included icons and favicon for the extension.
- Implemented functionality for schema capture and code generation.
- Updated index.md to reflect the availability of the new extension.
- Enhanced LLM Context Builder layout and styles for consistency.
- Adjusted global styles for better branding and responsiveness.
This commit is contained in:
UncleCode
2025-06-08 18:34:05 +08:00
parent 6f3a0ea38e
commit 926592649e
32 changed files with 3056 additions and 36 deletions

View File

@@ -0,0 +1,39 @@
// Service worker for Crawl4AI Assistant
// Handle messages from content script
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === 'downloadCode') {
try {
// Create a data URL for the Python code
const dataUrl = 'data:text/plain;charset=utf-8,' + encodeURIComponent(message.code);
// Download the file
chrome.downloads.download({
url: dataUrl,
filename: message.filename || 'crawl4ai_schema.py',
saveAs: true
}, (downloadId) => {
if (chrome.runtime.lastError) {
console.error('Download failed:', chrome.runtime.lastError);
sendResponse({ success: false, error: chrome.runtime.lastError.message });
} else {
console.log('Download started with ID:', downloadId);
sendResponse({ success: true, downloadId: downloadId });
}
});
} catch (error) {
console.error('Error creating download:', error);
sendResponse({ success: false, error: error.message });
}
return true; // Keep the message channel open for async response
}
return false;
});
// Clean up on extension install/update
chrome.runtime.onInstalled.addListener(() => {
// Clear any stored state
chrome.storage.local.clear();
});