You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于匹配参数从队列批量提取Agent的实现问题

基于共同参数的Agent批处理问题

需求场景

Agent进入队列后,需基于共同的agent.sortingParameter参数值和动态批量大小进行批处理。例如当批量大小为9时,需将队列中前9个具有相同参数值的Agent移出队列,加入当前批次后传递至下一个模块。

问题描述

我在batchJobs模块的「On enter」事件中编写了如下代码,但遇到问题:无法将从前置队列移除的Agent添加至当前批次Agent中。

// 获取队列中第一个订单对应的门店
Store targetStore = agent.pCustomer.pStore;

// 创建临时集合存放当前批次的订单
ArrayList<Order> selectedOrders = new ArrayList<>();

// 遍历队列(暂不移除Agent,仅筛选符合条件的订单)
for (int i = 0; i < qAvailableJobs.size() && selectedOrders.size() < batchJobs.batchSize; i++) {
    Order currentOrder = (Order)qAvailableJobs.get(i);
    if (currentOrder.pCustomer.pStore == targetStore) {
        selectedOrders.add(currentOrder);
    }
}

// 将选中的订单从主队列移除,并添加至OrdersBatch批次Agent
for (Order o : selectedOrders) {
    qAvailableJobs.remove(o);
    // 如何将移除的Agent添加到批次并触发On Add事件?
}

尝试过的方案及报错

我尝试用以下代码替代上述注释行,但出现报错batch cannot be resolved to a variable,且发现「On enter」事件中无法直接访问批次对象,该方案不可行,寻求其他解决方法:

this.batchJobs.onAdd(o, batch);

内容的提问来源于stack exchange,提问作者Vince

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 17:32:49