mock-model.js 1.5 KB

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