fix(asset-ai): answer vehicle status from authorized vehicle facts
ci/woodpecker/push/woodpecker Pipeline was canceled
ci/woodpecker/push/woodpecker Pipeline was canceled
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { planVehicleStatus, vehicleStatusResult } from "./vehicle-status.js";
|
||||
import { applyAction } from "./execute.js";
|
||||
import type { Vehicle } from "../../types.js";
|
||||
import type { AssistantRow } from "../../../shared/assets/assistant.js";
|
||||
const vehicles = [{ id: "a", plateNumber: "沪A57850F", vin: "L123456789012345X" }] as Vehicle[];
|
||||
test("natural vehicle questions resolve locally and unknown VIN never queries all assets", () => {
|
||||
for (const question of ["沪A57850F现在怎么样", "沪A57850F在运营吗", "沪A57850F在哪个部门"]) {
|
||||
assert.deepEqual(planVehicleStatus(question, vehicles)?.vehicleIds, ["a"]);
|
||||
}
|
||||
assert.equal(planVehicleStatus("L123456789012345Y现在什么状态", vehicles)?.kind, "clarify");
|
||||
});
|
||||
test("missing flags remain unknown and resetting removes status presentation", () => {
|
||||
const plan = planVehicleStatus("沪A57850F状态", vehicles)!;
|
||||
const result = vehicleStatusResult([{ id: "a", plate: "沪A57850F", status: "未标注" } as AssistantRow], plan);
|
||||
assert.match(result.summary, /库存归属未标注/);
|
||||
assert.match(result.summary, /异动标记未知/);
|
||||
assert.match(result.summary, /待交车标记未知/);
|
||||
const reset = applyAction(plan, { type: "reset-filters" }, result);
|
||||
assert.equal(reset.responseMode, undefined);
|
||||
assert.equal(reset.vehicleIds, undefined);
|
||||
});
|
||||
Reference in New Issue
Block a user