feat(resource): add preserve_structure option for directory scanning#509
Merged
MaojiaSheng merged 2 commits intovolcengine:mainfrom Mar 10, 2026
Merged
Conversation
Support preserving nested directory structure when adding resources. When preserve_structure=True (default), files maintain their relative path hierarchy under the resource URI root. When False, all files are flattened to a single level (legacy behavior). Configurable default via ov.conf. Closes volcengine#490 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix import sorting (I001) across 15+ files - Remove unused imports (F401): signal, hashlib, time, asyncio, pytest, etc. - Remove unused variables (F841): level, e - Rename unused loop vars (B007): idx -> _idx - Replace lambda with def (E731) in feishu.py - Replace dict() with literal (C408) in resources.py - Remove f-strings without placeholders (F541) - Add TYPE_CHECKING imports for ExecToolConfig/CronService (F821) - Add FastAPI/Depends/Header imports in openapi.py (F821) - Remove duplicate import of load_config (F811) - Auto-format 4 files with ruff format
MaojiaSheng
approved these changes
Mar 10, 2026
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
Support preserving nested directory structure when adding resources via
add_resource.preserve_structure=True(default): files maintain their relative path hierarchy under the resource URI rootpreserve_structure=False: all files are flattened to a single level (legacy behavior)ov.conf(directory.preserve_structure)Changes
openviking/parse/parsers/directory.pypreserve_structurethrough_process_one_fileand_direct_upload_fileopenviking/server/routers/resources.pypreserve_structurequery parameteropenviking_cli/client/http.pyopenviking_cli/utils/config/open_viking_config.pyOpenVikingConfigopenviking_cli/utils/config/parser_config.pyDirectoryConfigwithpreserve_structurefieldtests/parse/test_add_directory.pyDesign Decisions
Trueper maintainer @MaojiaSheng's guidancemax_depth— dropped per maintainer feedback (unnecessary API complexity)preserve_structure=FalseCloses #490