import { writeFileSync, readFileSync } from 'node:fs' import { join } from 'node:path' const root = 'e:/Gitea/ai_trade_assistance' function w(rel, content) { writeFileSync(join(root, rel), content, 'utf8') console.log('ok', rel) } const S = { fenshi: '\u5206\u65f6', wuri: '\u4e94\u65e5', riK: '\u65e5K', zhouK: '\u5468K', yueK: '\u6708K', junjia: '\u5747\u4ef7', cjl: '\u6210\u4ea4\u91cf', xindu: '\u7f6e\u4fe1\u5ea6', yijian: '\u4e00\u952e\u83b7\u53d6\u5efa\u8bae', shouqi: '\u6536\u8d77', zhankai: '\u5c55\u5f00', hint: '\u57fa\u4e8e\u884c\u60c5\u3001\u76d8\u53e3\u3001\u65b0\u95fb\u4e0e\u6301\u4ed3\u7684\u7efc\u5408\u5206\u6790\uff08\u5f53\u524d\u4e3a Mock\uff09', warn: '\u8bf7\u5148\u5728\u8bbe\u7f6e\u4e2d\u914d\u7f6e DeepSeek API Key\uff08\u672c\u9636\u6bb5\u4ecd\u8fd4\u56de Mock \u5efa\u8bae\uff09', qita: '\u5176\u4ed6', shuliang: '\u6570\u91cf', zengjian: '\u589e\u51cf', zhanbi: '\u5360\u6bd4', } // Patch ChartPanel: replace garbled labels in existing file structure by rewriting full file from template pieces const chartPath = join(root, 'src/components/quote/ChartPanel.vue') let chart = readFileSync(chartPath, 'utf8') chart = chart .replace(/label="\?+"/g, (m, offset, str) => m) // noop marker .replace(/
AI {{ data.action }} {{ data.summary }} ${S.xindu} {{ data.confidence }}% \u00b7 {{ data.updatedAt }}
${S.yijian} {{ expanded ? '${S.shouqi}' : '${S.zhankai}' }}
${S.hint}
  • {{ r }}
`, ) // Fix PositionDonut Chinese in tooltip/legend if garbled const donutPath = join(root, 'src/components/position/PositionDonut.vue') let donut = readFileSync(donutPath, 'utf8') donut = donut .replace(/data\.push\(\{ name: '[^']*', value: otherQty \}\)/, `data.push({ name: '${S.qita}', value: otherQty })`) .replace( /return `\$\{param\.name\}[^`]+`/, `return \`\${param.name}
${S.shuliang}: \${param.value}
${S.zengjian}: \${sign}\${change}
${S.zhanbi}: \${param.percent}%\``, ) writeFileSync(donutPath, donut, 'utf8') console.log('ok PositionDonut.vue') console.log('batch2 done')