Skip to content

feat: update media parsers#196

Merged
MaojiaSheng merged 19 commits intovolcengine:mainfrom
MaojiaSheng:main
Feb 20, 2026
Merged

feat: update media parsers#196
MaojiaSheng merged 19 commits intovolcengine:mainfrom
MaojiaSheng:main

Conversation

@MaojiaSheng
Copy link
Collaborator

Description

  1. ✅ Updated sanitize_segment to support CJK characters (Japanese, Korean, etc.) in openviking_cli/utils/uri.py, openviking/parse/parsers/markdown.py, openviking/parse/parsers/html.py
  2. ✅ split media parsers into image.py, video.py, audio.py, so that we can apply different strategies in the future
  3. ✅ Added VikingURI.normalize() to auto-complete viking:// scheme in all relevant places in openviking_cli/client/http.py
  4. ✅ Updated media parsers to:
    • Keep original filename (spaces replaced by underscores)
    • Create folder name with extension (like {filename}_{ext})
    • Add original_filename to node.meta
    • Update overview.md to reference original filename

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ MaojiaSheng
❌ openviking


openviking seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MaojiaSheng MaojiaSheng changed the title feat: feat: update media parsers Feb 16, 2026
MaojiaSheng and others added 9 commits February 17, 2026 14:12
- Add parse/parsers/media/utils.py with media helpers
- Refactor ImageParser.parse(), AudioParser.parse(), VideoParser.parse() to remove content understanding, keep only metadata extraction
- Update SemanticProcessor._generate_single_file_summary() to handle media types and call media utils for summary generation
- Update TreeBuilder._get_base_uri() to use media utils
- Update ResourceNode.get_abstract() and get_overview() to check meta for abstract/overview
- Add debug logs and error handling
…ummary

- Add _generate_text_summary function for text file processing
- Update media utils functions to accept llm_sem and use it to limit concurrent calls
- Update _generate_single_file_summary to call _generate_text_summary and media utils functions
- Fix import ordering
- Fix issue where _generate_file_summaries was creating a new semaphore, now each _generate_single_file_summary handles its own
@MaojiaSheng MaojiaSheng marked this pull request as ready for review February 20, 2026 05:37
await viking_fs.mkdir(root_dir_uri)

# 1.1 Save original video with original filename (sanitized)
await viking_fs.write_file_bytes(f"{root_dir_uri}/{original_filename}", video_bytes)
Copy link
Collaborator

Choose a reason for hiding this comment

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

openviking/parse/parsers/media/video.py:97

  1. 改成 chunked read-write with buffer 是否对内存更好
  2. 在 write bytes 之前检查头文件是否更好,isValid 检查只需要 head x bytes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里没细琢磨,不过不应假设只操作本地文件系统

prompt = render_prompt(
"parsing.image_summary",
{
"context": "No additional context",
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里是不是给 “” 就行了

f"size = image_resource.get_size() # ({node.meta['width']}, {node.meta['height']})\n"
)
overview_parts.append(f'format = image_resource.get_format() # "{node.meta["format"]}"\n')
overview_parts.append("```\n")
Copy link
Collaborator

@ZaynJarvis ZaynJarvis Feb 20, 2026

Choose a reason for hiding this comment

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

这一段和 overview parts 已有信息重复了,也许不需要指导执行,另外这部分 guide 应该不需要每个 image 都有一份

@MaojiaSheng MaojiaSheng merged commit dc7bc95 into volcengine:main Feb 20, 2026
1 check was pending
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants