Skip to content
Merged
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 docs/development/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,14 @@ OPENDIRECTOR_URL=http://127.0.0.1:18238 ZHIPU_API_KEY=... ZHIPU_SAMPLE=/path/to/

Python 用例使用按真实服务响应录制的模拟 HTTP,检查 `/audio/speech` 只请求非流式 WAV 并按 RIFF/WAVE 字节验收(服务默认返回裸 PCM,且部分错误以 HTTP 200 + JSON 返回)、`1113` 余额不足归为额度而非限流、音色库只列出文档中的 7 个预置音色加 `PRIVATE` 复刻音色、复刻前的真实音频校验(mp3/wav、3–30 秒、10 MB)、复刻成功或失败后都删除上传的样本文件、`POST /voice/delete` 删除及重名/不存在的错误映射、试听只从公网 HTTPS 下载且不带凭据,以及统一生成服务的音色预检与执行快照。真实验收需要已充值且开通 GLM-TTS 的 BigModel 账户;保留预置音色与复刻音色生成的实际音频、复刻到删除的完整流程截图,并确认账户中没有遗留的 `voice-clone-input` 文件。

Atlas Cloud chat access uses the following checks. The preset has no fixed model list: the provider form discovers models from the gateway's public `/v1/models` endpoint, like the DeepSeek preset.

```sh
.venv/bin/python -m pytest tests/test_atlascloud.py -q
node --test tests/providerPresets.test.ts
```

The Python cases check that only the high thinking level sends reasoning_effort. The gateway serves several model families and some reject low and medium with a 400, so the other levels use the model default. The Node cases check the preset shape, the label in both display languages and the saved connection identity. Neither calls api.atlascloud.ai. Real streaming and model discovery additionally require network access, and chat requires an Atlas Cloud API key; keep the discovered model count, the reply and the status codes as evidence.

### Voice library / 音色库

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def chat_payload(config: dict, messages: list[dict], thinking: str) -> dict:
# auto so the provider default applies, and fall back to high for unknown levels.
if thinking != "auto":
value["reasoning_effort"] = thinking_map.get(thinking, thinking_map["auto"])
elif hostname == "api.atlascloud.ai":
# The gateway fronts many model families and some (Qwen) reject low and medium
# with a 400. Only high is accepted everywhere, so other levels use the model default.
if thinking == "high":
value["reasoning_effort"] = "high"
elif thinking != "auto":
value["reasoning_effort"] = thinking
if len(json.dumps(value, ensure_ascii=False).encode()) > 48 * 1024 * 1024:
Expand Down
9 changes: 9 additions & 0 deletions src/canvas/providerPresets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
connectionType: "api",
authMode: "bearer",
},
{
id: "atlascloud",
name: "Atlas Cloud",
kinds: ["agent"],
url: "https://api.atlascloud.ai/v1",
protocol: "openai",
connectionType: "api",
authMode: "bearer",
},
{
id: "zhipu",
logoOrganization: "zai-org",
Expand Down
38 changes: 38 additions & 0 deletions tests/providerPresets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,44 @@ test("a saved Zhipu agent connection reopens with its provider identity", () =>
}
});

test("Atlas Cloud preset offers agent chat through the OpenAI-compatible gateway", () => {
const preset = PROVIDER_PRESETS.find((item) => item.id === "atlascloud");
assert.ok(preset);
assert.equal(preset.name, "Atlas Cloud");
assert.equal(preset.url, "https://api.atlascloud.ai/v1");
assert.equal(preset.protocol, "openai");
assert.equal(preset.connectionType, "api");
assert.equal(preset.authMode, "bearer");
assert.deepEqual(preset.kinds, ["agent"]);
assert.equal(preset.modelsByKind, undefined);
assert.ok(providerOptions("agent").some((item) => item.id === "atlascloud"));
for (const kind of ["image", "video", "audio", "vision"] as const)
assert.ok(!providerOptions(kind).some((item) => item.id === "atlascloud"));
});

test("Atlas Cloud provider label is the same in both display languages", () => {
const previous = getActiveLocale();
try {
for (const locale of ["zh-CN", "en-US"] as const) {
setActiveLocale(locale);
assert.equal(providerOptions("agent").find((item) => item.id === "atlascloud")?.name, "Atlas Cloud");
}
} finally {
setActiveLocale(previous);
}
});

test("a saved Atlas Cloud agent connection reopens with its provider identity", () => {
const preset = PROVIDER_PRESETS.find((item) => item.id === "atlascloud")!;
const model: ModelConfig = {
...preset, id: "saved-atlascloud", kind: "agent", modelId: "deepseek-ai/deepseek-v4-flash",
url: `${preset.url}/`,
inputRules: { profile: "agent", allowedKinds: [], maxImages: 0, maxVideos: 0, maxAudios: 0, videoModes: [] },
};
assert.equal(providerPresetFor(model), "atlascloud");
assert.equal(providerPresetFor({ ...model, url: "https://other.test/v1" }), "custom");
});

test("a saved MOSS image connection reopens with its provider identity", () => {
const preset = PROVIDER_PRESETS.find((item) => item.id === "moss");
assert.ok(preset);
Expand Down
22 changes: 22 additions & 0 deletions tests/test_atlascloud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Atlas Cloud chat requests send reasoning_effort only at the level every model family accepts."""
from opendirector.integrations.chat_completions import chat_payload


ATLAS = {"modelId": "deepseek-ai/deepseek-v4-flash", "url": "https://api.atlascloud.ai/v1"}


def test_atlascloud_sends_reasoning_effort_only_for_high():
assert chat_payload(ATLAS, [], "high")["reasoning_effort"] == "high"
for level in ("auto", "low", "medium"):
assert "reasoning_effort" not in chat_payload(ATLAS, [], level)


def test_atlascloud_base_fields_and_other_hosts_unchanged():
payload = chat_payload(ATLAS, [{"role": "user", "content": "hi"}], "high")
assert payload["model"] == "deepseek-ai/deepseek-v4-flash"
assert payload["stream"] is True
assert payload["max_tokens"] == 8192
assert "thinking" not in payload
assert payload["messages"] == [{"role": "user", "content": "hi"}]
other = chat_payload({"modelId": "x", "url": "https://api.example.com/v1"}, [], "medium")
assert other["reasoning_effort"] == "medium"
Loading