Skip to content

Attach some long code links in files #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

00-kat
Copy link
Collaborator

@00-kat 00-kat commented May 7, 2025

I only special-case one code link as the context would then be directly above the file:
A screenshot.
If it were done for all cases, the correspondence between contexts and files would not be apparent as the files are necessarily displayed at the end.

While I could do it for the last blob that causes the limit to be exceeded, that might end up being a two line snippet (for example); putting something that small in a file is odd.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the message editing hook and code snippet formatting to better support attaching long code links as files when necessary. Key changes include:

  • Refactoring create_edit_hook by removing the embed_mode parameter and introducing extract_content to handle content, files, and embeds.
  • Updating related hooks in xkcd_mentions and GitHub integrations to work with the new API.
  • Adjusting code link formatting to special-case long single snippets by uploading them as files instead of embedding the entire content.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
app/utils/hooks.py Refactored create_edit_hook to remove embed_mode and support files attachments.
app/components/xkcd_mentions.py & comments/integration.py Removed embed_mode parameter from hook invocations.
app/components/github_integration/code_links.py Modified snippet formatting to conditionally upload long snippets as files.

@00-kat 00-kat force-pushed the code-files branch 2 times, most recently from 03ede89 to baa4c35 Compare May 9, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants