支持对话触发 Optimize 柔性排产
This commit is contained in:
parent
6478e8c512
commit
5485f6de62
|
|
@ -707,6 +707,10 @@ def parse_fast(text: str, world: World) -> IntentResult | None:
|
|||
params["window"] = win
|
||||
elif re.search(r"滚动", t):
|
||||
params["window"] = "short"
|
||||
# Explicit Optimize wording selects the integrated Optimize V2 adapter;
|
||||
# ordinary flexible scheduling keeps the CLOSED_LOOP default.
|
||||
if re.search(r"\boptimize\b|优化引擎|优化算法", t, re.I):
|
||||
params["engine"] = "OPTIMIZE"
|
||||
return hit("flex.schedule", params)
|
||||
# 瓶颈产能评估(瓶颈产能法)
|
||||
if re.search(r"瓶颈产能|产能池|产能评估|各?工序产能|瓶颈在哪|产能瓶颈|能做多少|日产能", t):
|
||||
|
|
|
|||
|
|
@ -1785,9 +1785,12 @@ def _run_flex(store: WorldStore, intent: IntentResult, actor: str) -> AgentReply
|
|||
store.save()
|
||||
else:
|
||||
result = run_flex_schedule(store, sort_mode=mode, order_ids=order_ids or None,
|
||||
actor=actor, window=window) # P1
|
||||
actor=actor, window=window,
|
||||
engine_type=engine or None) # P1
|
||||
mode_key = str(result.get("sortMode") or result.get("engineType") or mode or "CLOSED_LOOP")
|
||||
mode_cn = _FLEX_MODE_CN.get(mode_key, mode_key)
|
||||
if engine == "OPTIMIZE":
|
||||
mode_cn = f"Optimize · {mode_cn}"
|
||||
solve_status = str(result.get("solveStatus") or "FEASIBLE").upper()
|
||||
if result.get("sortMode") == "EXTERNAL" or use_ext:
|
||||
mode_cn = f"外部算法({result.get('skillId') or 'skill'})"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from server.agent_core.intent import parse_fast
|
||||
from server.state.packs import load_pack
|
||||
|
||||
|
||||
PACK_PATH = Path(__file__).resolve().parents[2] / "server" / "data" / "packs" / "optimize-simulation-v1.json"
|
||||
|
||||
|
||||
def test_explicit_optimize_language_selects_optimize_flex_engine():
|
||||
world = load_pack(str(PACK_PATH))
|
||||
|
||||
result = parse_fast("用 Optimize 算法生成一版柔性排产", world)
|
||||
|
||||
assert result is not None
|
||||
assert result.intent == "flex.schedule"
|
||||
assert result.params["engine"] == "OPTIMIZE"
|
||||
assert result.params["sortMode"] == "BOTTLENECK"
|
||||
|
||||
|
||||
def test_plain_flexible_schedule_keeps_closed_loop_default():
|
||||
world = load_pack(str(PACK_PATH))
|
||||
|
||||
result = parse_fast("生成一版柔性排产方案", world)
|
||||
|
||||
assert result is not None
|
||||
assert result.intent == "flex.schedule"
|
||||
assert "engine" not in result.params
|
||||
Loading…
Reference in New Issue