mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-15 05:04:27 +08:00
fix(sandbox): update Tenki SDKs and drop removed project_id (#18117)
### Summary Brings both halves of the Tenki sandbox provider onto current SDKs and removes `project_id`, which Tenki deleted from its API. **Go:** `github.com/LuxorLabs/tenki-sdk-go/sandbox` `v0.5.2` → `v0.7.0` (current latest). **Python:** the provider's SDK was renamed on PyPI — `tenki-sandbox` is frozen at 0.4.0 and everything from 0.5 ships as [`tenki`](https://pypi.org/project/tenki/). The docs told operators to `pip install tenki-sandbox`, which installs a stale SDK that no longer matches this provider's expectations. **`project_id` is gone.** Tenki removed project scoping from the sandbox API in 0.5.x: `Client.create()` no longer accepts `project_id`, so the current code path would raise `TypeError` against a current SDK. It was also marked `required: True` in the config schema, so the Admin > Sandbox Settings form asked for a value that no longer exists.
This commit is contained in:
@@ -125,7 +125,6 @@ class _FakeClient:
|
||||
def _build_provider(sandbox: _FakeSandbox, monkeypatch) -> tuple[TenkiProvider, _FakeClient]:
|
||||
provider = TenkiProvider()
|
||||
provider.api_key = "tk_test"
|
||||
provider.project_id = "proj-1"
|
||||
provider.timeout = 30
|
||||
provider.max_output_bytes = 1024 * 1024
|
||||
provider.max_artifacts = 20
|
||||
@@ -227,7 +226,7 @@ def test_tenki_provider_create_passes_project_and_outbound(monkeypatch):
|
||||
|
||||
provider.create_instance("python")
|
||||
|
||||
assert client.create_kwargs["project_id"] == "proj-1"
|
||||
assert "project_id" not in client.create_kwargs
|
||||
assert client.create_kwargs["allow_outbound"] is True
|
||||
assert client.create_kwargs["image"] == "my-image"
|
||||
assert client.create_kwargs["cpu_cores"] == 4
|
||||
@@ -237,12 +236,12 @@ def test_tenki_provider_config_schema_and_validation():
|
||||
schema = TenkiProvider.get_config_schema()
|
||||
assert schema["api_key"]["required"] is True
|
||||
assert schema["api_key"]["secret"] is True
|
||||
assert schema["project_id"]["required"] is True
|
||||
assert "project_id" not in schema
|
||||
|
||||
provider = TenkiProvider()
|
||||
ok, _ = provider.validate_config({"api_key": "tk", "project_id": "p", "timeout": 30, "max_lifetime": 3600, "max_output_bytes": 1024, "max_artifacts": 5, "max_artifact_bytes": 1024})
|
||||
ok, _ = provider.validate_config({"api_key": "tk", "timeout": 30, "max_lifetime": 3600, "max_output_bytes": 1024, "max_artifacts": 5, "max_artifact_bytes": 1024})
|
||||
assert ok is True
|
||||
bad, msg = provider.validate_config({"api_key": "", "project_id": "p"})
|
||||
bad, msg = provider.validate_config({"api_key": ""})
|
||||
assert bad is False
|
||||
assert "API key" in msg
|
||||
|
||||
@@ -262,7 +261,7 @@ def test_tenki_provider_initialize_maps_auth_error(monkeypatch):
|
||||
monkeypatch.setattr(provider, "_create_client", lambda: _UnauthorizedClient())
|
||||
|
||||
with pytest.raises(SandboxProviderConfigError, match="authentication failed"):
|
||||
provider.initialize({"api_key": "tk_bad", "project_id": "proj-1"})
|
||||
provider.initialize({"api_key": "tk_bad"})
|
||||
|
||||
|
||||
def test_tenki_provider_instances_are_independent(monkeypatch):
|
||||
@@ -277,7 +276,6 @@ def test_tenki_provider_instances_are_independent(monkeypatch):
|
||||
|
||||
provider = TenkiProvider()
|
||||
provider.api_key = "tk_test"
|
||||
provider.project_id = "proj-1"
|
||||
provider.timeout = 30
|
||||
provider._initialized = True
|
||||
provider._client = _MultiClient(None)
|
||||
|
||||
Reference in New Issue
Block a user