F2: delegate prompt tasks to native Reasoner or OpenCode backends
This commit is contained in:
@@ -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": "远端已接收,等待执行"})
|
||||
|
||||
Reference in New Issue
Block a user