fix: some video native bug and web api doc#594
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the supported “mode/type” surface in the web UI (including API docs + i18n labels) and fixes native video handling by adding proper request validation/usage extraction for Ali/Doubao, plus improving how video request metadata is persisted and later used for async usage and status/content endpoints.
Changes:
- Web: extend model type options to cover all relay modes (1–38), update UI handling for new video-native modes, and add extensive per-mode API documentation and translations.
- Core: add request validation/usage/price controllers for AliVideo and DoubaoVideo modes; adjust consume-recording rules for new task modes.
- Core adaptors: refine Doubao stored-metadata handling; add/adjust native video usage-context behavior and tests for Ali/Doubao async usage and native flows.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/types/model.ts | Expands mode/type option list to 1–38 and updates which modes support limits/fuzzy match. |
| web/src/feature/model/components/ModelForm.tsx | Updates per-type UI field visibility for additional video-native modes. |
| web/src/feature/model/components/api-doc/ApiDoc.tsx | Adds many new mode-specific API doc entries and examples. |
| web/public/locales/zh/translation.json | Adds zh labels for new modeType keys 14–38. |
| web/public/locales/en/translation.json | Adds en labels for new modeType keys 14–38. |
| core/relay/controller/video_doubao.go | New Doubao native video request validation/usage/price helpers. |
| core/relay/controller/video_doubao_test.go | Tests for Doubao native video request validation and usage context. |
| core/relay/controller/video_ali.go | New Ali native video request validation/usage/price helpers. |
| core/relay/controller/video_ali_test.go | Tests for Ali native video request validation and usage context. |
| core/relay/adaptor/doubao/video.go | Switches Doubao from storing full request to storing normalized metadata; applies stored metadata to responses. |
| core/relay/adaptor/doubao/main_test.go | Updates existing tests for new Doubao metadata storage + adds native usage-context tests. |
| core/relay/adaptor/doubao/doubao_video.go | Improves Doubao native video request conversion + applies stored metadata; ensures native usage context uses native resolution. |
| core/relay/adaptor/doubao/doubao_video_test.go | Updates tests for new Doubao metadata behavior and native usage-context fallback. |
| core/relay/adaptor/doubao/async_usage.go | Adjusts succeeded-path usageContext handling for Doubao native mode. |
| core/relay/adaptor/ali/async_usage.go | Adds Ali native async-usage wrapper to normalize usageContext to native resolution. |
| core/relay/adaptor/ali/ali_video.go | Updates Ali native request conversion/handlers to store metadata and produce native usageContext. |
| core/relay/adaptor/ali/ali_video_test.go | Updates and extends Ali native request/handler tests for new metadata + usageContext behavior. |
| core/relay/adaptor/ali/adaptor_test.go | Adds Ali native async-usage tests for native resolution + fallback behavior. |
| core/controller/relay-controller.go | Wires AliVideo and DoubaoVideo to new controller validation/usage/price functions. |
| core/controller/relay-controller_test.go | Extends relay-controller tests to cover AliVideo and DoubaoVideo wiring. |
| core/common/consume/consume.go | Updates consume-recording skip rules for Ali/Doubao task modes and Doubao delete 204. |
| core/common/consume/consume_record_test.go | Adds tests covering consume-recording behavior for the new modes/status codes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+768
to
+778
| endpoint: '/files/{file}', | ||
| method: 'GET', | ||
| responseFormat: 'json', | ||
| requestExample: `curl --request GET \\ | ||
| --url ${apiEndpoint}/v1beta/files/files/abc123 \\ | ||
| --header "Authorization: Bearer $token"`, | ||
| responseExample: `{ | ||
| "name": "files/abc123", | ||
| "uri": "https://generativelanguage.googleapis.com/v1beta/files/abc123", | ||
| "state": "ACTIVE" | ||
| }` |
| ) | ||
| if size != "" { | ||
| meta.Set(metaAliVideoSize, size) | ||
| } |
Comment on lines
+160
to
+171
| func doubaoNativeVideoString(node *ast.Node) string { | ||
| if node == nil || !node.Exists() || node.TypeSafe() == ast.V_NULL { | ||
| return "" | ||
| } | ||
|
|
||
| value, err := node.String() | ||
| if err != nil { | ||
| return "" | ||
| } | ||
|
|
||
| return value | ||
| } |
Comment on lines
+173
to
+184
| func doubaoNativeVideoInt(node *ast.Node) int { | ||
| if node == nil || !node.Exists() || node.TypeSafe() == ast.V_NULL { | ||
| return 0 | ||
| } | ||
|
|
||
| value, err := node.Int64() | ||
| if err != nil { | ||
| return 0 | ||
| } | ||
|
|
||
| return int(value) | ||
| } |
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.
No description provided.