feat: expose GET /v1/files on public API surface with SDK support and… - #2231
feat: expose GET /v1/files on public API surface with SDK support and…#2231jason-dong03 wants to merge 9 commits into
Conversation
… case-insensitive filename search fix (#2215) * feat: public ingested files endpoint -Added public file listing endpoints (`GET /v1/files` and `/v1/files/search`). -Exposed file listing for API key, SDK, and MCP clients. -Added public v1 file routes and delegated to the v2 file service. -Registered new MCP file listing and search endpoints. -Fixed case-insensitive filename search. -Added file listing models to the Python SDK. -Added `list_files()` to the Python SDK. -Exported new file listing models in the Python SDK. -Added file listing examples to the Python SDK docs. -Added file listing types to the TypeScript SDK. -Added `listFiles()` to the TypeScript SDK. -Exported new file listing types in the TypeScript SDK. -Added file listing examples to the TypeScript SDK docs. -Added unit tests for the new v1 file endpoints. -Added Python SDK integration tests for file listing. -Added TypeScript SDK integration tests for file listing. -Updated API documentation with file listing examples and pagination. * style: ruff autofix (auto) * updated unit tests quick fix: file service docstring mismatch with implementation -refactoring var names -removed unused import -more coverage via tests * quick fix * style: ruff autofix (auto) * Update test_v1_files.py * style: ruff autofix (auto) * PR fixes ---------
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
-implemented file ingestion endpoint based on a v2 endpoint for consistency / future roadmaps
|
React Doctor skipped this pull request — it changed no React files. Reviewed by React Doctor for commit |
…ub.com/langflow-ai/openrag into cherry-pick/expose-v1-files-into-0.6.5
| @@ -0,0 +1,22 @@ | |||
| """Public /v2/* route registrations (API-key auth).""" | |||
|
|
|||
There was a problem hiding this comment.
is dropping the _list_files / _search_files API-key wrappers intentional here?
Latest main still uses them with require_api_key_permission("knowledge:read:own"), while this registers the cookie-auth handlers directly.
| import pytest | ||
| from fastapi import params as fastapi_params | ||
|
|
||
| from api.v1.files import list_files, search_files |
There was a problem hiding this comment.
This still imports list_files and search_files from api.v1.files, but that module only defines get_all_files now. Should these tests be rewritten for getAll, or will collection fail with ImportError?
| ) | ||
| app.add_api_route( | ||
| "/v2/files", | ||
| v2_files.list_files, |
There was a problem hiding this comment.
internal.py already registers GET /v2/files with cookie auth, and register_all_routes registers the internal routes before the public ones. Since Starlette uses first-match-wins routing, wouldn’t an SDK request to GET /api/v2/files hit the internal cookie-auth route even if we restore the API-key wrappers here?
main doesn’t appear to have this collision because the SDK uses /v1/files, whereas this PR switches it to /v2/files.
I think the same issue applies to /v2/files/search here vs. internal.py:136.
Wallgau
left a comment
There was a problem hiding this comment.
just need few clarifications @edwinjosechittilappilly can you take a look to my comments please
-Added public file listing endpoints (
GET /v1/filesand/v1/files/search).-Exposed file listing for API key, SDK, and MCP clients.
-Added public v1 file routes and delegated to the v2 file service.
-Registered new MCP file listing and search endpoints.
-Fixed case-insensitive filename search.
-Added file listing models to the Python SDK.
-Added
list_files()to the Python SDK.-Exported new file listing models in the Python SDK. -Added file listing examples to the Python SDK docs.
-Added file listing types to the TypeScript SDK.
-Added
listFiles()to the TypeScript SDK.-Exported new file listing types in the TypeScript SDK. -Added file listing examples to the TypeScript SDK docs.
-Added unit tests for the new v1 file endpoints.
-Added Python SDK integration tests for file listing. -Added TypeScript SDK integration tests for file listing. -Updated API documentation with file listing examples and pagination.
-case-insensitive filename search fix