Open
Conversation
…ry option) Closes #605 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
selectFiles()touseFiles()hook — opens ChatGPT's file library picker (with feature detection for hosts that don't support it yet){ library?: boolean }option toupload()— saves uploads to the user's ChatGPT file libraryFileMetadatatype with optionalfileNameandmimeTypefieldsgetFileDownloadUrlto document expanded scope (uploads, selected files, tool/file params)trackFileIdshelper inAppsSdkAdaptorto DRY widget state updatesCloses #605
Test plan
pnpm test)pnpm build)selectFilesis documented but not yet available in the host runtime)🤖 Generated with Claude Code
Greptile Summary
This PR extends
useFiles()with two new capabilities: aselectFiles()method that opens ChatGPT's file library picker (with proper feature detection for older host versions) and a{ library?: boolean }option onupload()to persist files to the user's library.FileMetadatais also enriched with optionalfileNameandmimeTypefields.Key changes:
AppsSdkAdaptorextracts the repeated widgetStateimageIdsupdate into a privatetrackFileIdshelper used by bothuploadFileand the newselectFiles— a clean DRY improvementMcpAppAdaptoradds a correctly-throwingselectFilesstub, consistent with the existing pattern for other unsupported file methodslibraryupload option andselectFilessuccess path; the switch fromvi.resetAllMocks()tovi.clearAllMocks()leaves a dynamically-addedOpenaiMock.selectFilesproperty alive across subsequent tests, which could interfere with testing the unsupported-host code path in the futureConfidence Score: 4/5
trackFileIdsrefactor is a net improvement, and the MCP stub follows the established pattern. The only flag is a P2 test hygiene issue:vi.clearAllMocks()doesn't remove theselectFilesproperty added in one test, leaving it visible to subsequent tests and making the unsupported-host path untestable without a cleanup step.selectFilespropertyPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: support OpenAI file library APIs (..." | Re-trigger Greptile