Feat/add parts support to http api#270
Merged
MaojiaSheng merged 4 commits intovolcengine:mainfrom Feb 25, 2026
Merged
Conversation
- Add optional 'parts' parameter to AddMessageRequest - Support two modes: simple (content string) and parts (array) - Update LocalClient and HTTP Client for consistency - Update Chinese and English documentation This enables HTTP API clients to store full Part information (TextPart, ContextPart, ToolPart) instead of just text content, achieving feature parity with the Python SDK.
When reading a non-existent file, agfs.read() raises AGFSClientError which was not being caught by Session.load()'s exception handler. This caused the server to return 422 errors instead of gracefully handling missing session files. Now read_file() catches all exceptions from agfs.read() and re-raises them as FileNotFoundError, ensuring consistent error handling across the codebase.
Map AGFSClientError to appropriate Python exceptions (FileNotFoundError, PermissionError, IOError) instead of always raising FileNotFoundError. This allows callers to handle file-not-found vs network errors differently.
- Restore offset/limit parameters in HTTPClient and LocalClient read() methods that were accidentally removed - Extract part_from_dict() to openviking/message/part.py to reduce code duplication between LocalClient and sessions router
1142560 to
a269f30
Compare
MaojiaSheng
approved these changes
Feb 25, 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
Add support for
partsparameter in the HTTP APIadd_messageendpoint, enabling feature parity with the Python SDK.Previously, the HTTP API only supported
content: str, which limited the ability to store structured message parts (TextPart, ContextPart, ToolPart). This PR adds an optionalpartsparameter while maintaining backward compatibility with the existingcontentparameter.Type of Change
Changes
API Changes
POST /api/v1/sessions/{session_id}/messagesnow accepts either:content(string) - simple mode, backward compatibleparts(array) - full Part support modeFiles Modified
openviking/server/routers/sessions.py- Server endpointopenviking/client/local.py- Local clientopenviking_cli/client/http.py- HTTP clientdocs/zh/api/05-sessions.md- Chinese documentationdocs/en/api/05-sessions.md- English documentationTesting
Checklist