F2: delegate prompt tasks to native Reasoner or OpenCode backends

This commit is contained in:
Xin Wang
2026-10-23 23:46:29 +08:00
parent 529250173d
commit 16ebfe358c
14 changed files with 784 additions and 110 deletions
+13 -1
View File
@@ -76,9 +76,21 @@ class OpenCodeExecutor:
async with client.stream("GET", "event") as stream:
stream.raise_for_status()
if not resume:
payload = {"messageID": handle["message_id"], "parts": [{"type": "text", "text": instruction}]}
if self.config.get("agent"):
payload["agent"] = self.config["agent"]
if self.config.get("model_provider_id") and self.config.get("model_id"):
payload["model"] = {"providerID": self.config["model_provider_id"], "modelID": self.config["model_id"]}
backend = self.config.get("_backend") or {}
from services.runtime_variables import DynamicVariableStore
store = DynamicVariableStore(self.config.get("_variables") or {})
assistant_instructions = store.render(str(backend.get("instructions") or ""))
instructions = "\n\n".join(value for value in (self.config.get("instructions"), assistant_instructions) if value)
if instructions:
payload["system"] = instructions
response = await client.post(
f"session/{handle['session_id']}/prompt_async",
json={"messageID": handle["message_id"], "parts": [{"type": "text", "text": instruction}]},
json=payload,
)
response.raise_for_status()
await emit({"status": "submitted", "summary": "远端已接收,等待执行"})