Introduction

Under the DSH framework, if you need to reuse an authenticated ChatGPT session to generate images and save them automatically, you can use this plugin. It reuses the Edge browser debugging port (9222) to maintain the session state and avoid repeated logins.

Plugin Introduction

Controls the logged-in web version of ChatGPT to generate images and download them locally — a DSH bundle plugin.

  • Maintainer: CAI-MH
  • Category: Internet Tools
  • License: MIT

Core Features

This plugin registers a tool named gpt_generate_image, with the following main capabilities:
1. Reuses the ChatGPT session in the Edge debugging port (9222) to generate images.
2. Downloads generated images to the local figures/gpt_generated directory.

Dependencies and Configuration

This plugin depends on a set of global scripts and resources located in the ~/work/dph directory:
- gpt-image.mjs (includes the puppeteer-core dependency)
- ensure-edge-debug.sh
- start-edge-debug.sh
- Edge debugging profile

If you need to change the default script directory, do not modify the source code of this bundle. Instead, modify the web profile patch configuration:

~/Library/Application Support/dsh-desktop/harness/profiles/web/cordis.patch.yml

- id: gpt-image
  config:
    workspace: ~/work/dph

After changing workspace to the new directory, restart DSH Desktop for the change to take effect.

Installation and Execution

This bundle is installed in the web profile. Dependencies are recorded in the profile package.json, while node_modules stores runtime copies.

If you need to modify the plugin code:
1. Modify the source files in this directory.
2. Copy the modified files back into node_modules.
3. Restart DSH Desktop.

Usage

Before use, configure the Edge debugging port (9222). After invoking the registered gpt_generate_image tool, images are automatically saved to the figures/gpt_generated/ directory in the current session workspace.

References