Fixed some context
This commit is contained in:
@ -35,6 +35,5 @@ There's a `<-` arrow on the top right you can click to open the sidebar if it's
|
||||
If you've followed the other steps, you should see some activity in the chat page's console, then see a zip file downloaded with all the artifacts correctly mapped inside.
|
||||
|
||||
|
||||
## Changes under consideration
|
||||
1. Optionally scrape project-level artifacts instead of chat-level artifacts
|
||||
2. Fix the scraper to work with single-artifact chats that don't have a selector button. Not sure how we'll get the artifact name here.
|
||||
## Known bugs
|
||||
1. Fix the scraper to work with single-artifact chats that don't have a selector button. Not sure how we'll get the artifact name here.
|
||||
|
||||
11
src/main.js
11
src/main.js
@ -1,8 +1,17 @@
|
||||
async function main() {
|
||||
console.log('Running artifact collector');
|
||||
|
||||
const currentUrl = window.location.href;
|
||||
const isProjectPage = currentUrl.includes('/project/');
|
||||
const isChatPage = currentUrl.includes('/chat/');
|
||||
|
||||
if (!isProjectPage && !isChatPage) {
|
||||
console.log('Not on a project or chat page, exiting');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ProjectMeta.isInProject()) {
|
||||
console.log('Not in a project chat, exiting');
|
||||
console.log('Not in a project context, exiting');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -215,7 +215,7 @@ const ChatArtifactScraper = {
|
||||
try {
|
||||
const content = await this.getArtifact(filename, isSelected);
|
||||
|
||||
if (filename === 'files.txt') {
|
||||
if (filename.toLowerCase().indexOf('files.txt') !== -1) {
|
||||
fileMap = content;
|
||||
console.log(`✓ Found files.txt - storing in fileMap`);
|
||||
} else {
|
||||
@ -320,7 +320,6 @@ const ProjectArtifactScraper = {
|
||||
const artifactList = this.getArtifactListItems();
|
||||
|
||||
if (Object.keys(artifactList).length === 0) {
|
||||
console.log('Nada');
|
||||
return { artifacts: artifactCollection, fileMap: fileMap };
|
||||
}
|
||||
|
||||
@ -330,7 +329,7 @@ const ProjectArtifactScraper = {
|
||||
try {
|
||||
const content = await this.getArtifact(filename, isSelected);
|
||||
|
||||
if (filename === 'files.txt') {
|
||||
if (filename.toLowerCase().indexOf('files.txt') !== -1) {
|
||||
fileMap = content;
|
||||
console.log(`✓ Found files.txt - storing in fileMap`);
|
||||
} else {
|
||||
@ -351,7 +350,6 @@ const ProjectArtifactScraper = {
|
||||
|
||||
const ArtifactScraper = {
|
||||
async collectArtifacts() {
|
||||
console.log('Collecting')
|
||||
if (ProjectMeta.isProjectChat()) {
|
||||
console.log('Detected project chat - using ChatArtifactScraper');
|
||||
return await ChatArtifactScraper.collectArtifacts();
|
||||
|
||||
Reference in New Issue
Block a user