Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/api/src/opendirector_api/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
'higgsfield_frames': 'Each frame slot accepts one image. A last frame requires a first frame.',
'higgsfield_references': 'Reference mode requires at least one image, video, or audio clip. Check the reference roles.',
'higgsfield_prompt': 'MAGI-2 prompts allow up to 15,000 characters. Text-to-video requires a prompt.',
'nextlabs_token': 'The NextLabs upload token is invalid.',
'opendev_magi_model': 'Choose OpenDev MAGI-2 with the official API address.',
'opendev_magi_key': 'Enter your OpenDev API key.',
'opendev_magi_prompt': 'Enter a MAGI-2 prompt of up to 15,000 characters.',
'opendev_magi_url': 'Enter a public HTTPS media URL readable without signing in.',
'opendev_magi_reference_count': 'MAGI-2 accepts up to 10 images (local images and links combined), 5 video links, and 5 audio links.',
'opendev_magi_local_reference': 'Configure a NextLabs upload token in the model service for local images. Use public links for video and audio references.',
'opendev_magi_reference_model': 'This video model does not support media links.',
"desktop_auth_required": "The desktop connection has expired. Reopen the application.",
'prompt_optimization_empty': 'Enter a prompt to optimize.',
'prompt_optimization_refs': 'Prompt references changed. Try again.',
Expand Down
9 changes: 6 additions & 3 deletions apps/api/src/opendirector_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def save_model_batch(value: ModelBatchInput):
protocol=value.protocol, auth_mode=value.authMode, proxy_mode=value.proxyMode, video_adapter=value.videoAdapter,
video_capabilities=video_capabilities(value), input_modalities=value.inputModalities,
model_options=model_options(value),
capabilities_supplied='videoCapabilities' in value.model_fields_set, capability_auto_check=value.capabilityAutoCheck)
capabilities_supplied='videoCapabilities' in value.model_fields_set, capability_auto_check=value.capabilityAutoCheck,
next_labs_token=value.nextLabsToken.get_secret_value() if value.nextLabsToken is not None else None)

@app.post('/api/model-configs/discover')
async def discover_models(value: ModelDiscoveryRequest):
Expand All @@ -295,7 +296,8 @@ def create_model_config(value: ModelConfigInput):
return catalog.save(value.kind, value.url, value.modelId, value.apiKey.get_secret_value(), connection_type=value.connectionType, protocol=value.protocol, auth_mode=value.authMode, proxy_mode=value.proxyMode,
video_adapter=value.videoAdapter, video_capabilities=video_capabilities(value),
capabilities_supplied='videoCapabilities' in value.model_fields_set, input_modalities=value.inputModalities,
capability_auto_check=value.capabilityAutoCheck)
capability_auto_check=value.capabilityAutoCheck,
next_labs_token=value.nextLabsToken.get_secret_value() if value.nextLabsToken is not None else None)

@app.post('/api/model-configs/capabilities')
async def model_capabilities(value: ModelCapabilityRequest):
Expand All @@ -310,7 +312,8 @@ def update_model_config(config_id: UUID, value: ModelConfigInput):
return catalog.save(value.kind, value.url, value.modelId, value.apiKey.get_secret_value(), str(config_id), connection_type=value.connectionType, protocol=value.protocol, auth_mode=value.authMode, proxy_mode=value.proxyMode,
video_adapter=value.videoAdapter, video_capabilities=video_capabilities(value),
capabilities_supplied='videoCapabilities' in value.model_fields_set, input_modalities=value.inputModalities,
capability_auto_check=value.capabilityAutoCheck)
capability_auto_check=value.capabilityAutoCheck,
next_labs_token=value.nextLabsToken.get_secret_value() if value.nextLabsToken is not None else None)

@app.delete("/api/model-configs/{config_id}", status_code=204)
def delete_model_config(config_id: UUID):
Expand Down
3 changes: 2 additions & 1 deletion apps/api/src/opendirector_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UrlSource(Model):

class ModelConnection(Model):
connectionType: Literal['api', 'self_hosted'] = 'api'
protocol: Literal['openai', 'volcengine', 'higgsfield_open', 'bigmodel_video', 'kling_video', 'minimax_video_v2', 'vllm_omni', 'vllm_omni_segmentation', 'vllm_omni_music', 'vllm_omni_depth', 'vllm_omni_score', 'vllm_omni_bodies'] | None = None
protocol: Literal['openai', 'volcengine', 'higgsfield_open', 'opendev_magi', 'bigmodel_video', 'kling_video', 'minimax_video_v2', 'vllm_omni', 'vllm_omni_segmentation', 'vllm_omni_music', 'vllm_omni_depth', 'vllm_omni_score', 'vllm_omni_bodies'] | None = None
authMode: Literal['none', 'bearer'] | None = None
proxyMode: Literal['system', 'direct'] | None = None
capabilityAutoCheck: bool | None = Field(default=None, strict=True, exclude_if=lambda value: value is None)
Expand All @@ -45,6 +45,7 @@ class ModelConfigInput(ModelConnection):
url: str = Field(max_length=2048)
modelId: str = Field(max_length=200)
apiKey: SecretStr = SecretStr("")
nextLabsToken: SecretStr | None = Field(default=None, max_length=8192)
inputModalities: list[AgentInputModality] | None = Field(default=None, min_length=1, max_length=4)
videoAdapter: VideoAdapter | None = None
videoCapabilities: VideoCapabilities | None = None
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This directory is the entry point for the repository's shared documentation. The
| [Business CLI](guides/cli.md) | Querying, editing, and generating through a terminal or Agent Shell | Commands, authorization, or receipt semantics change |
| [DeepSeek Harness plugin](../plugins/deepseek-harness/README.md) | Installing the DSH bundle and editing an OpenDirector project from DSH | Plugin setup, tools, or creation workflows change |
| [Video model capabilities](guides/video-model-capabilities.md) ([中文](guides/video-model-capabilities.zh-CN.md)) | Declaring output specifications supported by a service | Configuration fields or capability integration changes |
| [OpenDev video services](guides/opendev-video.md) ([中文](guides/opendev-video.zh-CN.md)) | MAGI-2, Seedance and NextLabs local image uploads | Provider setup or reference upload changes |
| [Video gateway](guides/video-gateway.md) ([中文](guides/video-gateway.zh-CN.md)) | Serving several H3 LoRA variants from one vLLM-Omni server through the gateway started with the application | Gateway configuration keys, startup, or rewrite behavior change |
| [Model availability / 模型可用状态](guides/model-availability.md) | Optional runtime declarations, automatic checks, shared admission and API/CLI/Agent queries | Capability protocol, refresh, or acceptance rules change |
| [OpenAI Images](guides/openai-images.md) | Wiring gpt-image as an optional image service, request shape and failures | Integration fields, capability scope, or the OpenAI interface change |
Expand Down
6 changes: 6 additions & 0 deletions docs/development/lessons.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ When implementing or reviewing a change, trace the affected behavior from its en

When work exposes a consequential risk or a recurring problem, add a lesson or update an existing one with the trigger, failure, suggested check, and a verifiable issue, PR, or commit. Add evidence when a problem recurs. Move requirements proven durable in practice into the validation guide, and revise or remove outdated lessons. Do not count distinct defects as repetitions of the same problem, or add a lesson for every routine fix.

## Passing local tests does not register them in CI

- **Trigger / 触发:** Adding, renaming or deleting Python test modules when CI selects files through shard rules. / CI 通过分片规则选择文件时,新增、重命名或删除 Python 测试模块。
- **Evidence / 证据:** [PR #685 review](https://github.com/ThinkFlowLab/OpenDirector/pull/685#discussion_r4809603999) found that `test_nextlabs_upload.py` and `test_opendev_magi.py` passed locally but were absent from `scripts/ci/python_shards.json`. Focused execution and pytest collection did not prove that CI selected them. / 两个模块本地通过,但未登记进分片清单;定向测试通过或成功收集用例不能证明 CI 会执行它们。
- **Check / 检查:** After [PR #700](https://github.com/ThinkFlowLab/OpenDirector/pull/700), unlisted modules are discovered into default core. Maintain explicit agent-cli/media assignments and renamed or deleted listed paths according to dependencies and responsibility, preserving alphabetical ordering. Run the full module inventory assertion and inspect the selected shard using the [validation commands](validation.md#python-shard-registration). Each module must occur exactly once in the resolved inventory. Compare unrelated failures against the target base and link their tracking issue; do not weaken the assertion or report a failing inventory as passed. / PR #700 后未列出的模块自动归入默认 core;按依赖和职责维护 agent-cli/media 的显式登记及已登记路径的重命名或删除,保持字母排序;运行完整模块清单断言并检查分片选择结果,确保每个模块恰好登记一次。无关失败需对照目标基线并链接跟踪记录,不能放宽断言或把失败报告为通过。

## Parameter IDs can encode the environment rather than the scenario

- **Trigger:** Comparing collected test IDs or per-test timing evidence across platforms or dependency versions.
Expand Down
25 changes: 25 additions & 0 deletions docs/development/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ Local checks verify workflow syntax, trigger/permission boundaries and rejection

## Python 分层与迁移 / Python layers and transition

<a id="python-shard-registration"></a>

### Python 分片登记 / Python shard registration

新增、重命名或删除 `tests/test_*.py` 时,检查 [`scripts/ci/python_shards.json`](../../scripts/ci/python_shards.json) 解析后的分片归属。未显式列出的模块自动归入默认 `core` 分片;需要 `agent-cli` 或 `media` 的模块应按依赖和职责显式登记。更新已登记模块的重命名或删除,并保持文件路径按字母排序。在已安装测试依赖的环境中,从仓库根目录运行以下检查;`core` 应替换为实际受影响的分片。

When adding, renaming or deleting `tests/test_*.py`, check the resolved assignments from [`scripts/ci/python_shards.json`](../../scripts/ci/python_shards.json). Unlisted modules are discovered into the default `core` shard. Explicitly list modules requiring `agent-cli` or `media` according to dependencies and responsibility; update listed paths when renaming or deleting them and keep paths alphabetically ordered. Run these checks from the repository root with test dependencies installed; replace `core` with the affected shard.

```sh
python -m pytest tests/test_ci_layers.py::test_repo_python_shards_manifest_covers_every_test_module_once -q --tb=short
python scripts/ci/check_test_layers.py --list-shard core
```

第一条检查解析后的清单是否恰好包含每个模块一次;第二条显示 CI 分片实际选择的文件,需确认目标模块出现在预期分片。继续执行受影响的测试;清单检查通过不代表测试通过,本地测试通过也不代表已登记进 CI。如果完整清单检查失败,对照目标基线区分本次遗漏与已有缺口,修复本次遗漏并为其他缺口附上跟踪记录,保留失败结论。

The first command checks that the resolved inventory contains every module exactly once; the second shows the files selected for a CI shard, which must include the intended modules. Also execute the affected tests: inventory success does not prove test success, and local test success does not prove CI registration. If the inventory fails, compare with the target base, fix omissions introduced by the change, link tracking records for other gaps, and retain the failed result.

### 耗时证据 / Timing evidence

Python CI 为全量套件和独立 bundled OpenCode 回归分别保存 JUnit XML、`--durations=50` 日志,以及 `--ci-profile` 生成的 JSON/Markdown;从运行的 `python-test-evidence-<attempt>` artifact 下载,保存 14 天。JSON 记录 SHA、系统、Python/pytest 版本、筛选条件、逐用例 setup/call/teardown 耗时、结果、显式层级与未标记默认归属,不记录 stdout、失败正文或局部变量。
Expand Down Expand Up @@ -734,3 +751,11 @@ Timing JSON includes per-case hardware and aggregate hardware counts.
Ark duration normalization is shared by capability admission and the submitted JSON through `normalize_ark_parameters`. Verify actual serialized POST values against admission for integral floats, integers, fractional values, booleans, strings and omitted duration in `tests/test_ark_availability.py`; do not round fractional durations or mutate saved intent.

Ark 能力检查和发送 JSON 共用 `normalize_ark_parameters` 归一化时长。在 `tests/test_ark_availability.py` 中比对实际 POST 序列化参数与检查参数,覆盖整数浮点数、整数、小数、布尔值、字符串及省略时长;不对小数时长取整,不修改原始生成意图。

### OpenDev MAGI-2 local image uploads

Run `python -m pytest tests/test_opendev_magi.py tests/test_nextlabs_upload.py tests/test_model_configs.py -q`. These checks use actual image bytes, persisted commands and mocked provider HTTP, not paid generation. They cover token secrecy, local and linked image limits, upload destination/header validation, completion validation, one submission, adoption and reopening.

For both interface languages, run `python tests/browser/nextlabs_server.py --port 8507`, Vite with `OPENDIRECTOR_API_URL=http://127.0.0.1:8507 npm run dev -- --port 5507`, and `node tests/browser/nextlabs_upload.mjs`. The isolated fixture checks service configuration, file-picker import, followed image references, generation, retained input snapshots and reopening. Screenshots and receipts go to `output/playwright/nextlabs`. No real upload credential or paid model call is used.

上述 Python 测试使用真实图片字节、持久化命令和模拟服务 HTTP,验证令牌保密、混合图片数量限制、上传地址及请求头检查、上传确认、单次提交、结果采用和重开。浏览器夹具在隔离工程中验证中英文服务配置、文件选择器导入、跟随图片参考、生成和重开后的输入快照,截图与回执保存在 `output/playwright/nextlabs`。这些检查不使用真实上传凭据,也不调用付费生成服务。
22 changes: 22 additions & 0 deletions docs/guides/opendev-video.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generate storyboard video with OpenDev

[中文](opendev-video.zh-CN.md)

In **Settings → Model connections → Video → Add service**, select **OpenDev video** and choose MAGI-2 or Seedance. Enter your OpenDev Credits API key and choose the model IDs available to your account.

| Preset | Base URL | Video protocol | Model ID |
| --- | --- | --- | --- |
| MAGI-2 | `https://api.openai-next.com` | `opendev_magi` | `magi-2` |
| Seedance | `https://api.openai-next.com/seedance/api/v3` | `volcengine` | For example, `doubao-seedance-2-0-260128`. Use **Add manually** for other IDs enabled on your account. |

Select the saved model in a storyboard video node, enter a prompt and generate. For a Seedance text-to-video request, leave the frames empty and use automatic resolution. You can preview a completed clip on the node and adopt it from the result history.

MAGI-2 requires a prompt of up to 15,000 characters and generates 1080p video in whole seconds from 4 to 30. Choose the aspect ratio and whether to generate audio. To guide the result, add up to 10 images, 5 videos and 5 audio files under **Reference media links**. Enter one public HTTPS URL per file, readable without a sign-in. Use links your provider can fetch and keep them available while the task is running. To use local reference images, edit the MAGI-2 service and enter a **NextLabs upload token**: a NextLabs personal access token with `works:write` permission, separate from the model API key. Connect image nodes to the video node, enter a prompt, and generate. OpenDirector uploads the images to NextLabs and submits their public HTTPS URLs automatically. Local images and image links share the 10-image limit; each local image must be a valid PNG, JPEG, WebP or GIF, at most 30,000,000 bytes. Local video and audio references still require public links.

NextLabs uploads are publicly accessible by URL and normally expire after 24 hours; the original assets remain in your local project. Upload tokens are stored with local model credentials and are excluded from project snapshots and public model responses. Leave the token field blank to preserve a saved token, or select **Remove the saved upload token** to remove it. Upload errors stop before the video generation request. After a generation request has been accepted, recovery polls its task ID without uploading again. If an upload was interrupted before confirmation, review the failed task before starting a new attempt.

Create a personal token in NextLabs with `works:write` permission; do not use the OpenDev model API key in this field. The [NextLabs API schema](https://labs.openai-next.com/v1/openapi.json) documents token creation (`POST /v1/me/tokens`, authenticated with your NextLabs session) and the upload ticket / PUT / completion flow. Configure the token in the application, never in a project prompt.

OpenDirector keeps the returned MAGI-2 task ID for polling and recovery. When a result link expires, resuming the original task queries a fresh link. If submission times out before an ID is returned, check the OpenDev console for the original task before trying again, since a new submission can incur a new charge. OpenDev's documented MAGI-2 flow has no remote cancellation call. After stopping locally, check the provider console for the remote task.

Protocol references, accessed 2026-12-02. [MAGI-2 async tasks](https://labs.openai-next.com/docs/tasks#magi-2) · [Input files](https://labs.openai-next.com/docs/files) · [Seedance async tasks](https://labs.openai-next.com/docs/tasks#seedance-ark)
Loading