| 123456789101112131415161718192021222324252627 |
- 'use strict';
- /**
- * 智能问数智能体 · 确定性假模型(NAPOS_AGENT_MOCK=1 时启用)
- * ----------------------------------------------------------------------------
- * 按已完成的工具步骤输出脚本化动作,零网络跑通 loop→guard→工具→final 全链路,
- * 供 smoke 回归锁定行为(smoke 红线:绝不发真实 LLM 请求)。
- */
- function mockReply(rec) {
- const done = new Set(rec.steps.filter((s) => s.type === 'tool' && s.ok).map((s) => s.tool));
- const act = (tool, args, thought) => JSON.stringify({ thought, action: { tool, args } });
- if (!done.has('lake_overview')) return act('lake_overview', {}, '(mock)先摸底湖内有什么数据');
- if (!done.has('query_report')) return act('query_report', { mode: 'date', metrics: ['grossAmt', 'validOrderCnt'] }, '(mock)看近期按日趋势');
- if (!done.has('compare_periods')) return act('compare_periods', {}, '(mock)做环比对比');
- if (!done.has('data_quality')) return act('data_quality', {}, '(mock)做数据体检');
- if (!done.has('build_report')) return act('build_report', {}, '(mock)生成分析报告入口');
- return JSON.stringify({
- thought: '(mock)信息已足够',
- final: {
- answer: '(mock 模型)已完成 lake_overview → query_report → compare_periods → data_quality → build_report 五步演练,链路正常。',
- chart: { type: 'line', x: 'date', y: ['grossAmt'], title: 'mock 趋势' },
- },
- });
- }
- module.exports = { mockReply };
|