feat: add api endpoints for chat attachments#1173
Merged
disintegrator merged 4 commits intomainfrom Jan 9, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 7f130dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
tgmendes
approved these changes
Jan 9, 2026
Contributor
tgmendes
left a comment
There was a problem hiding this comment.
LGTM - non-blocking suggestion but otherwise 🚀
| MaxFileSizeFunctions = 15 * mib | ||
| MaxFileSizeOpenAPI = 10 * mib | ||
| MaxFileSizeImage = 4 * mib | ||
| mib = 1024 * 1024 |
server/internal/assets/impl.go
Outdated
Comment on lines
930
to
941
| explicitTypes := []string{ | ||
| "application/json", | ||
| "application/yaml", "application/x-yaml", | ||
| } | ||
| if slices.Contains(explicitTypes, mediaType) { | ||
| switch mediaType { | ||
| case "application/json": | ||
| return mediaType, ".json", nil | ||
| case "application/yaml", "application/x-yaml": | ||
| return mediaType, ".yaml", nil | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Another option:
Suggested change
| explicitTypes := []string{ | |
| "application/json", | |
| "application/yaml", "application/x-yaml", | |
| } | |
| if slices.Contains(explicitTypes, mediaType) { | |
| switch mediaType { | |
| case "application/json": | |
| return mediaType, ".json", nil | |
| case "application/yaml", "application/x-yaml": | |
| return mediaType, ".yaml", nil | |
| } | |
| } | |
| explicitTypeExtensions := map[string]string{ | |
| "application/json": ".json", | |
| "application/yaml": ".yaml", | |
| "application/x-yaml": ".yaml", | |
| } | |
| extension, ok := explicitTypeExtensions[mediaType] | |
| if ok { | |
| return mediaType, extension, nil | |
| } |
Would make it easier to add more types if needed as you don't need to explicitly add a new switch statement. Also a bit more concise and readable IMO.
This change updates the assets service to include new API endpoints for uploading and serving chat attachments. The `/rpc/assets.serveChatAttachment` endpoint can be accessed with an API key or session cookie. `Gram-Project` is not used on that endpoint to make it easy for session-based clients to embed attachments in chat such as with `<img>` tags for images e.g. `<img src="/rpc/assets.serveChatAttachment?id=...&project_id=..." />`.
…g chat attachments. The `/rpc/assets.serveChatAttachment` endpoint can be accessed with an API key or session cookie. `Gram-Project` is not used on that endpoint to make it easy for session-based clients to embed attachments in chat such as with `<img>` tags for images e.g. `<img src="/rpc/assets.serveChatAttachment?id=...&project_id=..." />`.
dcfd232 to
e7d194e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Authored by Claude Opus 4.5
This change updates the assets service to include new API endpoints for uploading and serving chat attachments.
The
/rpc/assets.serveChatAttachmentendpoint can be accessed with an API key or session cookie.Gram-Projectis not used on that endpoint to make it easy for session-based clients to embed attachments in chat such as with<img>tags for images e.g.<img src="/rpc/assets.serveChatAttachment?id=...&project_id=..." />.