mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-14 20:54:30 +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:
@@ -71,7 +71,6 @@ class TenkiProvider(SandboxProvider):
|
||||
|
||||
def __init__(self):
|
||||
self.api_key = ""
|
||||
self.project_id = ""
|
||||
self.base_url = ""
|
||||
self.image = ""
|
||||
self.allow_outbound = False
|
||||
@@ -89,7 +88,6 @@ class TenkiProvider(SandboxProvider):
|
||||
|
||||
def initialize(self, config: Dict[str, Any]) -> bool:
|
||||
self.api_key = str(config.get("api_key", "") or "").strip()
|
||||
self.project_id = str(config.get("project_id", "") or "").strip()
|
||||
self.base_url = str(config.get("base_url", "") or "").strip()
|
||||
self.image = str(config.get("image", "") or "").strip()
|
||||
self.allow_outbound = bool(config.get("allow_outbound", False))
|
||||
@@ -105,7 +103,6 @@ class TenkiProvider(SandboxProvider):
|
||||
is_valid, error_message = self.validate_config(
|
||||
{
|
||||
"api_key": self.api_key,
|
||||
"project_id": self.project_id,
|
||||
"timeout": self.timeout,
|
||||
"max_lifetime": self.max_lifetime,
|
||||
"max_output_bytes": self.max_output_bytes,
|
||||
@@ -131,7 +128,6 @@ class TenkiProvider(SandboxProvider):
|
||||
errors = self._tenki_errors()
|
||||
|
||||
create_kwargs: dict[str, Any] = {
|
||||
"project_id": self.project_id,
|
||||
"allow_outbound": self.allow_outbound,
|
||||
"max_duration": self.max_lifetime,
|
||||
"metadata": {"source": "ragflow"},
|
||||
@@ -285,13 +281,6 @@ class TenkiProvider(SandboxProvider):
|
||||
"placeholder": "tk_...",
|
||||
"description": "Tenki API key. Create one at https://app.tenki.cloud under API Keys.",
|
||||
},
|
||||
"project_id": {
|
||||
"type": "string",
|
||||
"required": True,
|
||||
"label": "Project ID",
|
||||
"placeholder": "Tenki project UUID",
|
||||
"description": "Tenki project that sandboxes are created under.",
|
||||
},
|
||||
"base_url": {
|
||||
"type": "string",
|
||||
"required": False,
|
||||
@@ -388,12 +377,9 @@ class TenkiProvider(SandboxProvider):
|
||||
|
||||
def validate_config(self, config: Dict[str, Any]) -> tuple[bool, Optional[str]]:
|
||||
api_key = str(config.get("api_key", "") or "").strip()
|
||||
project_id = str(config.get("project_id", "") or "").strip()
|
||||
|
||||
if not api_key:
|
||||
return False, "Tenki API key is required"
|
||||
if not project_id:
|
||||
return False, "Tenki project_id is required"
|
||||
|
||||
for key in ("timeout", "max_lifetime", "max_output_bytes", "max_artifacts", "max_artifact_bytes"):
|
||||
try:
|
||||
@@ -528,8 +514,8 @@ def _get_tenki_module():
|
||||
try:
|
||||
import tenki_sandbox
|
||||
except ImportError as exc:
|
||||
# tenki-sandbox is an optional dependency: it requires protobuf>=6.31,
|
||||
# tenki is an optional dependency: it requires protobuf>=6.31,
|
||||
# which conflicts with RAGFlow's pinned gRPC stack, so it is not a core
|
||||
# dependency. Install it into the runtime to enable this provider.
|
||||
raise SandboxProviderConfigError("tenki-sandbox is required for the Tenki sandbox provider. Install it with `pip install tenki-sandbox` (or `uv pip install tenki-sandbox`).") from exc
|
||||
raise SandboxProviderConfigError("tenki is required for the Tenki sandbox provider. Install it with `pip install tenki` (or `uv pip install tenki`).") from exc
|
||||
return tenki_sandbox
|
||||
|
||||
Reference in New Issue
Block a user