Remove requirement for chats to be in a project
This commit is contained in:
13
src/main.js
13
src/main.js
@ -1,17 +1,8 @@
|
||||
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 context, exiting');
|
||||
if (!ProjectMeta.isScrapable()) {
|
||||
console.log('Not in a scrapable context, exiting');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -13,10 +13,10 @@ const ProjectMeta = {
|
||||
// Fallback: try to get from H1 (project pages)
|
||||
const projectH1 = document.querySelector('h1.font-ui-serif');
|
||||
if (projectH1) {
|
||||
return projectH1.textContent.trim() || null;
|
||||
return projectH1.textContent.trim() || 'Claude Project';
|
||||
}
|
||||
|
||||
return null;
|
||||
return 'Claude Project';
|
||||
},
|
||||
|
||||
getChatName() {
|
||||
@ -28,8 +28,8 @@ const ProjectMeta = {
|
||||
return chatNameDiv.textContent.trim() || null;
|
||||
},
|
||||
|
||||
isProjectChat() {
|
||||
return Boolean(this.getProjectName()) && Boolean(this.getChatName());
|
||||
isChat() {
|
||||
return Boolean(this.getChatName());
|
||||
},
|
||||
|
||||
isProjectPage() {
|
||||
@ -40,8 +40,8 @@ const ProjectMeta = {
|
||||
return Boolean(this.getProjectName()) && hasProjectKnowledge;
|
||||
},
|
||||
|
||||
isInProject() {
|
||||
return this.isProjectChat() || this.isProjectPage();
|
||||
isScrapable() {
|
||||
return this.isChat() || this.isProjectPage();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -350,14 +350,14 @@ const ProjectArtifactScraper = {
|
||||
|
||||
const ArtifactScraper = {
|
||||
async collectArtifacts() {
|
||||
if (ProjectMeta.isProjectChat()) {
|
||||
console.log('Detected project chat - using ChatArtifactScraper');
|
||||
if (ProjectMeta.isChat()) {
|
||||
console.log('Detected chat - using ChatArtifactScraper');
|
||||
return await ChatArtifactScraper.collectArtifacts();
|
||||
} else if (ProjectMeta.isProjectPage()) {
|
||||
console.log('Detected project page - using ProjectArtifactScraper');
|
||||
return await ProjectArtifactScraper.collectArtifacts();
|
||||
} else {
|
||||
throw new Error('Unknown page type - not a project chat or project page');
|
||||
throw new Error('Unknown page type - not a chat or project page');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user