Skip to content

feat(tools): add screenshot tool for website capture#253

Merged
l1ttps merged 5 commits intomainfrom
take-screenshot
Jan 18, 2026
Merged

feat(tools): add screenshot tool for website capture#253
l1ttps merged 5 commits intomainfrom
take-screenshot

Conversation

@l1ttps
Copy link
Copy Markdown
Member

@l1ttps l1ttps commented Jan 18, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @l1ttps, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the asset management system by introducing a new capability to capture and display website screenshots. This feature provides valuable visual context for assets directly within the console, improving the overall user experience and information richness. The changes span across the frontend for display, the backend API for data management, and the worker service for execution, ensuring a cohesive and integrated solution.

Highlights

  • New Screenshot Tool: A new 'screenshot' tool has been introduced, enabling the system to capture visual representations of websites associated with assets.
  • Frontend Integration: The console's asset table now features a dedicated 'Screenshot' column, displaying captured images with a tooltip for a zoomed-in view.
  • Backend API and Worker Enhancements: The core API has been extended with a new ToolCategory for screenshots, screenshotPath fields in relevant DTOs and entities, and a ScreenshotPayload for data transfer. The worker service now includes a screenshotHandler that leverages Puppeteer to perform the actual screenshot capture and storage.
  • Dependency Update: The puppeteer library has been added as a new dependency to the worker service to facilitate headless browser automation for screenshots.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new screenshot tool, which is a great addition. The implementation spans the backend, worker, and frontend. The worker-side screenshot handler using Puppeteer is well-implemented with good anti-detection measures. The backend changes correctly integrate the new tool into the job system. On the frontend, new components are added to display the screenshots.

I've found a few issues: a critical bug in an image component that could break existing image loading, a high-severity bug in the backend that could lead to broken screenshot URLs, and a medium-severity issue regarding resource management in the worker. My review comments provide details and suggestions for fixing these.

/>
);
// If not a complete URL, prepend with API storage path
const imageUrl = isHttpUrl ? url : `api${url}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The removal of the leading slash in the imageUrl construction changes it from an absolute path to a relative path. This will likely break image loading for any non-HTTP URLs, as the browser will try to resolve the path from the current page's directory.

Suggested change
const imageUrl = isHttpUrl ? url : `api${url}`;
const imageUrl = isHttpUrl ? url : `/api${url}`;

asset.dnsRecords = item.asset?.dnsRecords;
asset.isEnabled = item.asset?.isEnabled;
asset.port = item.port;
asset.screenshotPath = `${STORAGE_BASE_PATH}/${item.screenshotPath}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The screenshotPath is constructed without checking if item.screenshotPath exists. If item.screenshotPath is null or undefined, this will result in asset.screenshotPath being set to a string like '/api/storage/undefined', leading to a broken image link. You should conditionally construct this path, similar to how it's done in getManyAsssetServices.

Suggested change
asset.screenshotPath = `${STORAGE_BASE_PATH}/${item.screenshotPath}`;
asset.screenshotPath = item.screenshotPath && `${STORAGE_BASE_PATH}/${item.screenshotPath}`;

import type { Job } from '../../services/core-api/api';

// Shared browser instance to reuse across requests
let browser: Browser | null = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The shared Puppeteer browser instance is created but never explicitly closed. While it will be terminated when the worker process exits, it's a good practice to handle resources gracefully. Consider exporting a closeBrowser function that can be called during the worker's shutdown sequence to ensure the browser is closed cleanly. This prevents potential resource leaks, especially in scenarios where the worker might be part of a more complex lifecycle management system.

You could add a function like this:

export async function closeBrowser(): Promise<void> {
  if (browser) {
    await browser.close();
    browser = null;
  }
}

...and then call it from your application's shutdown logic.

@l1ttps l1ttps merged commit 5b817da into main Jan 18, 2026
9 checks passed
@l1ttps l1ttps linked an issue Jan 18, 2026 that may be closed by this pull request
1 task
@l1ttps l1ttps deleted the take-screenshot branch February 1, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Capture screenshot website in httpx tool

1 participant