| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- /**
- * AI 数据分析应用 —— 常量与展示映射
- */
- import { useGlobSetting } from '@/core/hooks/setting';
- const glob = useGlobSetting();
- /** 后端管理路径前缀(defHttp 会自动再加 urlPrefix=/js) */
- export const AI_ADMIN_PATH = glob.adminPath || '/a';
- /** 接口完整前缀:/js/a —— 与后端 context-path 一致 */
- export const AI_API_PREFIX = `${glob.urlPrefix || ''}${AI_ADMIN_PATH}`;
- /** 后端根地址(生产环境为绝对地址,开发环境为空走代理) */
- export const AI_API_ORIGIN = glob.apiUrl || '';
- /**
- * 拼接后端可达地址(含 origin)。
- * 用于 fetch / img src 这类不走 defHttp 的场景。
- */
- export function resolveApiUrl(path: string): string {
- const p = path.startsWith('/') ? path : `/${path}`;
- return `${AI_API_ORIGIN}${AI_API_PREFIX}${p}`;
- }
- /** 流式对话地址 */
- export const CHAT_STREAM_URL = resolveApiUrl('/chat/stream');
- /** 会话列表默认每页条数(前端本地分页) */
- export const SESSION_PAGE_SIZE = 20;
- /* ------------------------------------------------------------------ *
- * 工具名称 → 中文展示
- *
- * 覆盖聊天时间线/状态栏/产物栏会露出来的全部工具(后端 @Tool 名,见
- * ai-server .../module/agent/tools 与 mcp/AgentScopeMcpToolProvider)。
- * ★ 加了新工具要同步补这里,否则时间线会退回显示英文工具名;
- * 产物文件名的中文前缀另有一份(后端 ArtifactService.ARTIFACT_LABELS)。
- * ------------------------------------------------------------------ */
- export const TOOL_LABELS: Record<string, string> = {
- // ---- 基础设施 ----
- execute_sql: '执行 SQL 查询',
- list_tables: '列出数据表',
- search_table_schema: '检索表结构',
- query_table_data: '查询表格数据',
- execute_python: '执行 Python 分析',
- render_chart: '校验图表配置',
- render_graph: '校验关系图谱',
- get_current_workspace: '读取当前工作空间',
- get_user_selected_workspace: '读取用户所选空间',
- get_case_graph: '取关系图谱数据',
- // ---- 人员画像与亲密度(person) ----
- list_persons: '列出案件人员',
- get_person_call_profile: '通话数据画像',
- stat_person_call_station: '通话基站分布',
- stat_person_call_top10: '最常联系人 TOP10',
- stat_call_record_summary: '通话记录汇总',
- get_person_trans_profile: '交易数据画像',
- stat_person_trans_top10: '最常交易对手 TOP10',
- stat_trans_record_summary: '交易记录汇总',
- get_trans_bank_card_info: '银行卡交易汇总',
- stat_trans_amount_trend_month: '交易金额月度趋势',
- stat_trans_amount_trend_year: '交易金额年度趋势',
- stat_intimacy_summary: '亲密度总览',
- // ---- 通话明细(call) ----
- get_call_records: '查询通话明细',
- stat_call_night_summary: '夜间通话汇总',
- stat_call_night_detail: '夜间通话明细',
- stat_call_continuous_summary: '持续通话汇总',
- stat_call_continuous_detail: '持续通话明细',
- stat_call_sensitive_summary: '敏感日期通话汇总',
- stat_call_sensitive_detail: '敏感日期通话明细',
- // ---- 交易与资金(trans) ----
- get_trans_records: '查询交易明细',
- stat_trans_big_summary: '大额交易汇总',
- stat_trans_big_by_date: '大额交易按日统计',
- stat_trans_big_detail: '大额交易明细',
- stat_trans_together: '共同交易分析',
- stat_trans_card_hold: '代持卡分析',
- stat_trans_cash_flow: '交易现金流汇总',
- stat_trans_continuous_summary: '持续交易汇总',
- stat_trans_continuous_detail: '持续交易明细',
- stat_trans_fast_fund_flow: '资金快转分析',
- stat_trans_financial: '金融交易筛选',
- stat_trans_fixed_deposit: '定期存款汇总',
- stat_trans_fixed_deposit_detail: '定期存款明细',
- stat_trans_frequency: '交易频次统计',
- stat_trans_sensitive_summary: '敏感日期交易汇总',
- stat_trans_sensitive_detail: '敏感日期交易明细',
- // ---- 轨迹 / 出行 / 快递(track) ----
- stat_track_cell_tower_summary: '基站轨迹汇总',
- stat_track_cell_tower_detail: '基站轨迹明细',
- stat_track_en_local_summary: '境外昼夜活动汇总',
- stat_track_en_local_detail: '境外昼夜活动明细',
- stat_express_summary: '快递收寄汇总',
- stat_express_by_phone: '按号码查快递',
- get_express_records: '查询快递明细',
- stat_track_meet_summary: '人员碰面汇总',
- stat_track_meet_detail: '人员碰面明细',
- stat_together_live_summary: '同住关系汇总',
- stat_together_live_detail: '同住关系明细',
- get_hotel_stay_detail: '旅馆住宿明细',
- get_together_live_info_detail: '同住服务记录明细',
- stat_together_travel_summary: '同行出行汇总',
- stat_together_travel_detail: '同行出行明细',
- get_travel_record_detail: '出行票务明细',
- // ---- 关系图谱(graph) ----
- // get_case_graph 见基础段
- // ---- 非表格材料档案(file) ----
- list_file_profiles: '检索材料清单',
- stat_file_profiles_by_category: '材料分类统计',
- get_file_sample: '读取材料正文片段',
- // ---- 案件管理(MCP 接入用) ----
- list_cases: '列出案件清单',
- open_case: '切换案件',
- current_case: '查看当前案件',
- close_case: '解除案件绑定',
- // ---- 框架内置(AgentScope 提供,源码里没有 @Tool 注解) ----
- reset_equipped_tools: '切换工具组',
- };
- export function toolLabel(name?: string): string {
- if (!name) return '工具调用';
- return TOOL_LABELS[name] || name;
- }
- /* ------------------------------------------------------------------ *
- * 富内容块
- * ------------------------------------------------------------------ */
- /** 块类型 */
- export type BlockKind = 'markdown' | 'code' | 'html' | 'echarts' | 'graph' | 'image' | 'insight';
- /** 围栏语言 → 块类型 */
- export const FENCE_BLOCK_MAP: Record<string, BlockKind> = {
- echarts: 'echarts',
- graph: 'graph',
- html: 'html',
- // AI 研判结构化产物(线索 + 下一步思路),契约见 InsightPromptBuilder#RENDER_CONTRACT。
- // ★ 改契约必须两头一起改:后端提示词 / scanner 校验 / blocks/InsightBlock.vue
- insight: 'insight',
- };
- /** 代码块中需要高亮/特殊展示的语言(非富渲染) */
- export const PLAIN_CODE_LANGS = [
- 'json',
- 'sql',
- 'python',
- 'bash',
- 'sh',
- 'text',
- 'plaintext',
- 'yaml',
- 'xml',
- 'java',
- 'ts',
- 'js',
- 'vue',
- 'css',
- 'less',
- ];
- /* ------------------------------------------------------------------ *
- * 业务工具组(与后端 AgentToolRegistry#groupLabel 保持一致)
- * ------------------------------------------------------------------ */
- /** 业务工具组短标签:研判方案页展示 / 编辑弹窗勾选项标题用 */
- export const TOOL_GROUP_LABELS: Record<string, string> = {
- person: '人员画像与亲密度',
- call: '通话分析',
- trans: '交易与资金分析',
- track: '轨迹、出行与快递',
- graph: '关系图谱',
- file: '非表格材料档案',
- };
- /** 研判方案配置里可能出现的全部业务组(顺序即页面展示顺序) */
- export const TOOL_GROUP_KEYS = Object.keys(TOOL_GROUP_LABELS);
- export function toolGroupLabel(group?: string | null): string {
- if (!group) return '';
- return TOOL_GROUP_LABELS[group] || group;
- }
- /* ------------------------------------------------------------------ *
- * 报告导出
- * ------------------------------------------------------------------ */
- export type ReportFormat = 'markdown' | 'pdf';
- export const REPORT_FORMATS: Array<{ value: ReportFormat; label: string; icon: string; tip: string }> = [
- { value: 'markdown', label: 'Markdown', icon: 'mdi:language-markdown', tip: '导出 .md 纯文本,保留原始结构与围栏块' },
- { value: 'pdf', label: 'PDF', icon: 'mdi:file-pdf-box', tip: '调用浏览器打印,选择"另存为 PDF"' },
- ];
- /* ------------------------------------------------------------------ *
- * 流式渲染节流参数
- * ------------------------------------------------------------------ */
- /** 尾部重扫窗口(字节/字符)——已解析完成的块会被冻结,仅重扫尾部窗口 */
- export const TAIL_RESCAN_SIZE = 8 * 1024;
- /** 增量重扫最小间隔(毫秒) */
- export const RESCAN_THROTTLE_MS = 100;
|