13 lines
740 B
JavaScript
13 lines
740 B
JavaScript
import "dotenv/config";
|
|
import path from "node:path";
|
|
import { chromium } from "playwright";
|
|
|
|
// Run interactively before starting the PM2 worker. Never share your everyday Chrome profile.
|
|
const context = await chromium.launchPersistentContext(path.resolve(process.env.CHATGPT_PROFILE_DIR || ".data/chatgpt-profile"), {
|
|
channel: process.env.CHATGPT_BROWSER_CHANNEL || "chrome", headless: false,
|
|
});
|
|
const page = await context.newPage();
|
|
await page.goto("https://chatgpt.com/");
|
|
console.log("Complete browser verification and log in to ChatGPT in this dedicated Chrome window. Confirm that the chat composer is visible, then close this window. Start the worker afterward.");
|
|
await new Promise((resolve) => context.once("close", resolve));
|