| 514 | } |
| 515 | |
| 516 | bool AgentClient::handle_context_run_task(const json::value& j) |
| 517 | { |
| 518 | if (!j.is<ContextRunTaskReverseRequest>()) { |
| 519 | return false; |
| 520 | } |
| 521 | |
| 522 | const ContextRunTaskReverseRequest& req = j.as<ContextRunTaskReverseRequest>(); |
| 523 | LogFunc << VAR(req) << VAR(ipc_addr_); |
| 524 | |
| 525 | MaaContext* context = query_context(req.context_id); |
| 526 | if (!context) { |
| 527 | LogError << "context not found" << VAR(req.context_id); |
| 528 | return false; |
| 529 | } |
| 530 | |
| 531 | auto task_id = context->run_task(req.entry, req.pipeline_override); |
| 532 | |
| 533 | ContextRunTaskReverseResponse resp { |
| 534 | .task_id = task_id, |
| 535 | }; |
| 536 | send(resp); |
| 537 | |
| 538 | return true; |
| 539 | } |
| 540 | |
| 541 | bool AgentClient::handle_context_run_recognition(const json::value& j) |
| 542 | { |