dsh-metaphysics 0.22.0 → 0.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +650 -413
- package/README.md +81 -18
- package/client.js +2975 -100
- package/docs/assets/dsh-metaphysics-group.png +0 -0
- package/engine/bazi.js +79 -2
- package/engine/classics.js +380 -0
- package/engine/followup.js +58 -0
- package/engine/geo.js +1 -1
- package/engine/index.js +168 -8
- package/engine/interpret-knowledge.js +448 -277
- package/engine/interpret-plain.js +131 -6
- package/engine/interpret.js +208 -7
- package/engine/liuyao.js +847 -237
- package/engine/mbti.js +417 -0
- package/engine/qimen-interpret.js +37 -2
- package/engine/qimen.js +128 -1
- package/engine/ziwei.js +198 -13
- package/index.js +21 -16
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +19 -15
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +18737 -0
package/engine/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// 统一入口:解析参数、分派到各体系、生成可读摘要
|
|
2
2
|
import { buildBazi } from './bazi.js';
|
|
3
|
-
import { buildLiuyao, tossLines } from './liuyao.js';
|
|
3
|
+
import { buildLiuyao, tossLines, bodyLabels, yongshenOf, yongshenStrength, hexagramStrength, jinTuiPower } from './liuyao.js';
|
|
4
4
|
import { buildZiwei, BRIGHTNESS, flowOf, asOfParts } from './ziwei.js';
|
|
5
5
|
import { drawTarot } from './tarot.js';
|
|
6
6
|
import { buildMeihua } from './meihua.js';
|
|
7
7
|
import { buildDaliuren } from './daliuren.js';
|
|
8
8
|
import { buildHepan } from './hepan.js';
|
|
9
9
|
import { buildZiweiHepan } from './ziwei-hepan.js';
|
|
10
|
-
import { buildQimen } from './qimen.js';
|
|
10
|
+
import { buildQimen, buildSnapshot } from './qimen.js';
|
|
11
11
|
import { geocodeAddress, resolveAddress } from './geo.js';
|
|
12
12
|
import { toJDN, ganzhiName, dayGanzhiIndex } from './calendar.js';
|
|
13
13
|
import { randomOf, isSeed } from './random.js';
|
|
14
14
|
import { interpret, DIRECTIONS, DIRECTION_DEFAULT } from './interpret.js';
|
|
15
|
-
import { followup } from './followup.js';
|
|
15
|
+
import { followup, askPrompt } from './followup.js';
|
|
16
16
|
import { crossCheck, crossText } from './crosscheck.js';
|
|
17
17
|
import { pastSignals, verifyFit } from './verify.js';
|
|
18
18
|
import { rectifyBirth } from './rectify.js';
|
|
@@ -22,7 +22,9 @@ import { buildChenggu } from './chenggu.js';
|
|
|
22
22
|
import { buildXiaoliuren } from './xiaoliuren.js';
|
|
23
23
|
import { buildStar } from './star.js';
|
|
24
24
|
import { buildNumerology } from './numerology.js';
|
|
25
|
+
import { buildMbti, mbtiPaper } from './mbti.js';
|
|
25
26
|
import { buildConvert } from './convert.js';
|
|
27
|
+
import { classicsFor, classicsText } from './classics.js';
|
|
26
28
|
import { buildTrend } from './trend.js';
|
|
27
29
|
import { buildFengshui } from './fengshui.js';
|
|
28
30
|
import { buildName } from './name.js';
|
|
@@ -96,6 +98,10 @@ function baziText(r) {
|
|
|
96
98
|
: '';
|
|
97
99
|
const dayun = r.dayun.list.slice(0, 8)
|
|
98
100
|
.map((d) => `${d.startAge}岁 ${d.ganzhi}(${d.stemTenGod})${d.luck ? `·${d.luck.tier}` : ''}${d.relations && d.relations.length ? `[${d.relations.join('')}]` : ''}`).join(' ');
|
|
101
|
+
// 交运时刻(日/时辰级):旧结果没有 dayun.jiao,缺省就只说「起运」,不硬凑
|
|
102
|
+
const jiao = r.dayun.jiao && r.dayun.jiao.at
|
|
103
|
+
? `;交运 ${r.dayun.jiao.at}(${r.dayun.jiao.frame},距${r.dayun.jiao.from.name} ${r.dayun.jiao.spanDays} 天,三日折一年)`
|
|
104
|
+
: '';
|
|
99
105
|
// 阈值 20 分钟:与 NAOJ 历要项对拍实测,本引擎节气最多偏早 13.5 分钟(Meeus 低精度上限约 14 分钟)
|
|
100
106
|
const near = r.jieqi.nearBoundaryMinutes < 20
|
|
101
107
|
? `\n⚠ 出生时刻距「节」仅 ${r.jieqi.nearBoundaryMinutes} 分钟,而节气时刻本身有最多约 14 分钟的偏差,月柱与年柱建议人工复核。`
|
|
@@ -127,9 +133,16 @@ function baziText(r) {
|
|
|
127
133
|
shenshaLine,
|
|
128
134
|
`真太阳时:${r.solarTime.trueSolarText}(${r.input.geo ? r.input.geo.note + ';' : ''}${r.solarTime.note}) 晚子时:${r.input.lateZi ? '23:00 后算次日' : '23:00 后仍算当日'}`,
|
|
129
135
|
`节气:上一节 ${r.jieqi.previous.name} ${r.jieqi.previous.time} 下一节 ${r.jieqi.next.name} ${r.jieqi.next.time}`,
|
|
130
|
-
`大运:${r.dayun.rule}(${r.dayun.direction}),${r.dayun.startAge.years}岁${r.dayun.startAge.months}
|
|
136
|
+
`大运:${r.dayun.rule}(${r.dayun.direction}),${r.dayun.startAge.years}岁${r.dayun.startAge.months}个月起运${jiao}`,
|
|
131
137
|
` ${dayun}`,
|
|
132
138
|
`流年:${r.liunian.slice(0, 10).map((l) => `${l.year}${l.ganzhi}(${l.stemTenGod})${l.luck ? `·${l.luck.tier}` : ''}`).join(' ')}`,
|
|
139
|
+
(() => {
|
|
140
|
+
const hits = r.liunian.filter((l) => l.suiyun && l.suiyun.signals && l.suiyun.signals.length);
|
|
141
|
+
if (!hits.length) return '岁运提示:近十年无岁运并临、运年反吟或流年伏吟/反吟(只标干支,不判吉凶)';
|
|
142
|
+
const label = (s) => `${s.type}${s.type.startsWith('流年') && s.target ? `(${s.target})` : ''}`;
|
|
143
|
+
return '岁运提示(只标干支变动,不判吉凶):' + hits
|
|
144
|
+
.map((l) => `${l.year}${l.ganzhi} ${l.suiyun.signals.map(label).join('/')}`).join(';');
|
|
145
|
+
})(),
|
|
133
146
|
'(格局、用神、行运吉凶为扶抑+简化调候的量化提示,非断语。)',
|
|
134
147
|
].join('\n') + near;
|
|
135
148
|
}
|
|
@@ -156,6 +169,30 @@ function ziweiText(r) {
|
|
|
156
169
|
: '无明显格局(按内置规则)';
|
|
157
170
|
const daxian = (r.daxianList ?? []).slice(0, 8).map((d) =>
|
|
158
171
|
` ${d.branch}宫(${d.palace})${d.ages[0]}-${d.ages[1]}岁 ${d.ganzhi} 会${d.mainStars.join('') || '—'} 化 ${d.mutagenHits.map((m) => `${m.star}${m.type}→${m.palace || '未上盘'}`).join('、')}`);
|
|
172
|
+
// 命宫四化飞星:宫干化出的星落在哪一宫,一路串下去成环为止
|
|
173
|
+
const flyLine = (() => {
|
|
174
|
+
const fc = r.flyChains;
|
|
175
|
+
if (!fc) return '';
|
|
176
|
+
const one = (t) => {
|
|
177
|
+
const ch = fc[t];
|
|
178
|
+
if (!ch || !ch.steps.length) return '';
|
|
179
|
+
return `${t}:${ch.path.join('→')}${ch.closed ? '(成环)' : ''}`;
|
|
180
|
+
};
|
|
181
|
+
const text = ['禄', '权', '科', '忌'].map(one).filter(Boolean).join(' ');
|
|
182
|
+
return text ? `【命宫飞星】${text}` : '';
|
|
183
|
+
})();
|
|
184
|
+
// 三方四正一起飞:四宫的 16 条飞化按落宫归堆,只看会聚
|
|
185
|
+
const flyCompositeLine = (() => {
|
|
186
|
+
const fc = r.flyComposite;
|
|
187
|
+
if (!fc || !Array.isArray(fc.sources) || !fc.sources.length) return '';
|
|
188
|
+
const groups = fc.labels.length ? fc.labels.join(' · ') : '无同宫会聚';
|
|
189
|
+
const detail = ['禄', '权', '科', '忌'].map((t) => {
|
|
190
|
+
const list = ((fc.byType && fc.byType[t]) || []).filter((x) => !x.self);
|
|
191
|
+
const tos = [...new Set(list.map((x) => String(x.to).replace(/宫$/, '')))];
|
|
192
|
+
return tos.length ? `${t}→${tos.join('/')}` : '';
|
|
193
|
+
}).filter(Boolean).join(' ');
|
|
194
|
+
return `【三方四正飞化】${fc.sanfang.join('·')}:${groups}${detail ? ` ${detail}` : ''}`;
|
|
195
|
+
})();
|
|
159
196
|
return [
|
|
160
197
|
`【农历】${lunarText}(月首 ${r.lunar.monthStart}) 时支:${r.hourBranch} 年干支:${r.yearGanzhi}`,
|
|
161
198
|
`【时刻】${r.solarTime ? `${r.solarTime.civilText} → 真太阳时 ${r.solarTime.trueSolarText}${r.input.geo ? '(' + r.input.geo.note + ')' : ''}` : ''}`,
|
|
@@ -164,6 +201,8 @@ function ziweiText(r) {
|
|
|
164
201
|
`【大限】${r.daxian.rule},${r.daxian.startAge}岁起 【小限】${r.xiaoxianRule.direction}`,
|
|
165
202
|
`【昌曲】文昌${r.changqu.wenchang.branch}(${r.changqu.wenchang.palace}${r.changqu.wenchang.mutagen ? '·化' + r.changqu.wenchang.mutagen : ''}) 文曲${r.changqu.wenqu.branch}(${r.changqu.wenqu.palace}${r.changqu.wenqu.mutagen ? '·化' + r.changqu.wenqu.mutagen : ''})`,
|
|
166
203
|
` ${r.changqu.relation} 入命三方:${r.changqu.inSoulSanfang ? '是' : '否'} 吸收面:${r.changqu.absorb.label}(${r.changqu.absorb.reason})`,
|
|
204
|
+
flyLine,
|
|
205
|
+
flyCompositeLine,
|
|
167
206
|
'十二宫:',
|
|
168
207
|
...rows,
|
|
169
208
|
'大限(按起运年龄排序,前 8 限,宫干四化落宫):',
|
|
@@ -171,11 +210,22 @@ function ziweiText(r) {
|
|
|
171
210
|
'流年(前 6 年,完整 12 年在结构化数据里):',
|
|
172
211
|
...liunian,
|
|
173
212
|
`【格局】${patterns}`,
|
|
174
|
-
r.patternSummary ? `【结构统计】吉格 ${r.patternSummary.good.length}、忌格 ${r.patternSummary.bad.length};${r.patternSummary.note}` : '',
|
|
213
|
+
r.patternSummary ? `【结构统计】吉格 ${r.patternSummary.good.length}、中性 ${r.patternSummary.neutral.length}、忌格 ${r.patternSummary.bad.length};${r.patternSummary.note}` : '',
|
|
175
214
|
r.lunar.note ? `注:${r.lunar.note}` : '',
|
|
176
215
|
].filter(Boolean).join('\n');
|
|
177
216
|
}
|
|
178
217
|
|
|
218
|
+
const STATE_ORDER = ['旺', '相', '休', '囚', '死'];
|
|
219
|
+
/** 门/星的月令五态,按 旺相休囚死 顺序拼成一行 */
|
|
220
|
+
function stateLine(r) {
|
|
221
|
+
const st = r.states;
|
|
222
|
+
const mo = r.month;
|
|
223
|
+
if (!st || !mo) return '无月令数据';
|
|
224
|
+
const fmt = (g) => STATE_ORDER.filter((k) => g && Array.isArray(g[k]) && g[k].length)
|
|
225
|
+
.map((k) => `${k} ${g[k].join('/')}`).join(' ');
|
|
226
|
+
return `月令 ${mo.branch}(${mo.element}) 门 ${fmt(st.gate) || '—'} 星 ${fmt(st.star) || '—'} 干 ${fmt(st.stem) || '—'}`;
|
|
227
|
+
}
|
|
228
|
+
|
|
179
229
|
function qimenText(r) {
|
|
180
230
|
const P = r.palaces;
|
|
181
231
|
const cell = (x) => `${x.palace}宫 ${x.star || '—'}/${x.gate || '—'}/${x.god || '—'}${x.kong ? ' 空' : ''}${x.ma ? ' 马' : ''}`;
|
|
@@ -184,6 +234,8 @@ function qimenText(r) {
|
|
|
184
234
|
`【局数】${r.ju} 节气 ${r.jieqi}(${r.jieqiTime})`,
|
|
185
235
|
`【值符】${r.zhiFu.star}(${r.zhiFu.gong}宫) 【值使】${r.zhiShi.gate}(${r.zhiShi.gong}宫) 旬首 ${r.xunshou}`,
|
|
186
236
|
`【空亡】${r.kongWang.join('') || '—'} 驿马 ${r.ma.zhi || '—'}(${r.ma.gong || '—'}宫)`,
|
|
237
|
+
`【宫位条件】击刑 ${(r.conditions && r.conditions.jiXing || []).map((x) => `${x.palace}宫${x.stem}`).join('、') || '无'} 入墓 ${(r.conditions && r.conditions.ruMu || []).map((x) => `${x.palace}宫${x.stem}`).join('、') || '无'}`,
|
|
238
|
+
`【旺衰】${stateLine(r)}`,
|
|
187
239
|
`【九宫】${P.map(cell).join(' ')}`,
|
|
188
240
|
`※ 晚子时:${r.lateZiHourMode === 'next-day' ? '23:00 后归次日' : '23:00 后仍归当日'}(可用 lateZiHourMode / lateZi 指定)`,
|
|
189
241
|
`※ ${r.rules[r.rules.length - 1]}`,
|
|
@@ -285,6 +337,40 @@ function liuyaoText(r) {
|
|
|
285
337
|
];
|
|
286
338
|
if (r.bian) out.push(`动爻:第 ${r.cast.movingPositions.join('、')} 爻`, '变卦(六亲以变卦自身宫论):', fmt(r.bian));
|
|
287
339
|
else out.push('六爻安静,无变卦。');
|
|
340
|
+
// 结果里已带 labels;只有旧数据或裸对象调用时才现算一份
|
|
341
|
+
const body = (r.body && Array.isArray(r.body.labels)) ? r.body.labels : bodyLabels(r.body);
|
|
342
|
+
out.push(`卦体:${body.length ? body.join(' · ') : '无六冲、六合、伏吟、反吟'}`);
|
|
343
|
+
// 用神:按询问方向取六亲(感情分男女、出行以世为用),不上卦时给伏神
|
|
344
|
+
const ug = r.useGod || yongshenOf(r, {});
|
|
345
|
+
if (ug && ug.liuqin) {
|
|
346
|
+
const where = ug.found.length
|
|
347
|
+
? ug.found.map((f) => `${f.position}爻${f.ganzhi}${f.element}${f.kong ? '(空)' : ''}`).join('、')
|
|
348
|
+
: (ug.fushen.length ? ug.fushen.map((f) => `伏 ${f.position}爻${f.ganzhi}${f.element}(${f.relation || '飞伏关系未知'})`).join('、') : '不上卦');
|
|
349
|
+
out.push(`用神:${ug.byShi ? '世爻' : ug.liuqin}(${ug.ask})→ ${where}${ug.side ? `(${ug.side})` : ''}`);
|
|
350
|
+
const head = ug.byShi ? '用神 世爻' : `用神 ${ug.liuqin}`;
|
|
351
|
+
const extra = ug.labels.filter((x) => x !== head && !x.startsWith(head));
|
|
352
|
+
if (extra.length) out.push(`用神联动:${extra.join(' · ')}`);
|
|
353
|
+
const strength = r.useGodStrength;
|
|
354
|
+
if (strength && strength.labels.length) {
|
|
355
|
+
const m = strength.month && strength.month.branch ? `月建 ${strength.month.branch}(${strength.month.element}) ` : '';
|
|
356
|
+
out.push(`用神旺衰:${m}${strength.labels.join(' · ')}`);
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
out.push('用神:未取(未指明所问之事;用「询问方向」指定后即按六亲取用)');
|
|
360
|
+
}
|
|
361
|
+
// 全卦逐爻旺衰:不挑用神,六爻都给状态,世应、动爻、旬空另标
|
|
362
|
+
const hexSt = r.hexStrength;
|
|
363
|
+
if (hexSt && Array.isArray(hexSt.labels) && hexSt.labels.length) {
|
|
364
|
+
const m = hexSt.month && hexSt.month.branch
|
|
365
|
+
? `月建 ${hexSt.month.branch}(${hexSt.month.element}) `
|
|
366
|
+
: '无月建(未给起卦时间) ';
|
|
367
|
+
out.push(`全卦旺衰:${m}${hexSt.labels.join(' · ')}`);
|
|
368
|
+
}
|
|
369
|
+
// 化进/化退的力重:单列一行,免得跟卦体标签混着读
|
|
370
|
+
const jt = r.jinTuiPower;
|
|
371
|
+
if (jt && Array.isArray(jt.lines) && jt.lines.length) {
|
|
372
|
+
out.push(`进退力重:${jt.lines.map((l) => `${l.position}爻${l.from}→${l.to}${l.type}·${l.verdict}`).join(' · ')}`);
|
|
373
|
+
}
|
|
288
374
|
return out.filter(Boolean).join('\n');
|
|
289
375
|
}
|
|
290
376
|
|
|
@@ -301,6 +387,11 @@ function jsonSafe(value) {
|
|
|
301
387
|
*/
|
|
302
388
|
export function compute(args = {}) {
|
|
303
389
|
const r = jsonSafe(computeRaw(args));
|
|
390
|
+
if (r && r.system === 'bazi') {
|
|
391
|
+
r.classics = classicsFor(r);
|
|
392
|
+
const ct = classicsText(r.classics);
|
|
393
|
+
if (ct) r.summary = `${r.summary}\n【古籍】\n${ct}`;
|
|
394
|
+
}
|
|
304
395
|
// 超出 ΔT 覆盖范围时把精度提示顶到摘要最前,别让远期盘悄悄出错
|
|
305
396
|
if (r && r.precision && r.precision.level === 'approx' && r.summary) {
|
|
306
397
|
r.summary = `⚠ ${r.precision.note}\n${r.summary}`;
|
|
@@ -589,6 +680,29 @@ function computeRaw(args = {}) {
|
|
|
589
680
|
} catch (e) {
|
|
590
681
|
throw fail('E_LINES', e && e.message ? e.message : e);
|
|
591
682
|
}
|
|
683
|
+
// 用神挂在结果上:摘要、面板、解析三层读同一份,避免各自取一次走散
|
|
684
|
+
const ug = yongshenOf(result, { direction: args.direction, gender: args.gender });
|
|
685
|
+
if (ug.liuqin) result.useGod = ug;
|
|
686
|
+
// 月建按节气换月、与八字同源:从同一个 snapshot 取月支,取不到就只按日辰算
|
|
687
|
+
let monthBranch = null;
|
|
688
|
+
if (stamp) {
|
|
689
|
+
try {
|
|
690
|
+
const snap = buildSnapshot({ year: stamp.year, month: stamp.month, day: stamp.day, hour: stamp.hour, minute: stamp.minute });
|
|
691
|
+
monthBranch = (snap.monthGanZhi || '')[1] || null;
|
|
692
|
+
} catch {
|
|
693
|
+
monthBranch = null;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
// 全卦逐爻旺衰不依赖用神:没指定所问之事也要能看整张卦的气
|
|
697
|
+
const hexStrength = hexagramStrength(result, { monthBranch, dayBranch: result.dayGanZhi.branch });
|
|
698
|
+
if (hexStrength) result.hexStrength = hexStrength;
|
|
699
|
+
// 化进/化退的力重:与旺衰同一套五态/五关系,只说走不走得动
|
|
700
|
+
const jtPower = jinTuiPower(result, { monthBranch, dayBranch: result.dayGanZhi.branch });
|
|
701
|
+
if (jtPower) result.jinTuiPower = jtPower;
|
|
702
|
+
if (ug.liuqin) {
|
|
703
|
+
const strength = yongshenStrength(result, ug, { monthBranch, dayBranch: result.dayGanZhi.branch });
|
|
704
|
+
if (strength) result.useGodStrength = strength;
|
|
705
|
+
}
|
|
592
706
|
if (args.seed !== undefined && args.seed !== null && args.seed !== '') result.seed = Number(args.seed);
|
|
593
707
|
return { ...result, ...(asOf ? { asOf } : {}), summary: liuyaoText(result) };
|
|
594
708
|
}
|
|
@@ -663,6 +777,15 @@ function computeRaw(args = {}) {
|
|
|
663
777
|
const result = buildNumerology({ year: dt.year, month: dt.month, day: dt.day });
|
|
664
778
|
return { ...result, summary: numerologyText(result) };
|
|
665
779
|
}
|
|
780
|
+
if (system === 'mbti') {
|
|
781
|
+
// 没给答案就先发问卷:让模型把 24 题交给用户逐题打分,而不是自己编一个类型
|
|
782
|
+
if (args.answers === undefined || args.answers === null) {
|
|
783
|
+
const paper = mbtiPaper();
|
|
784
|
+
return { ...paper, summary: mbtiPaperText(paper) };
|
|
785
|
+
}
|
|
786
|
+
const result = buildMbti({ answers: args.answers });
|
|
787
|
+
return { ...result, summary: mbtiText(result) };
|
|
788
|
+
}
|
|
666
789
|
if (system === 'trend') {
|
|
667
790
|
const dt = parseDateTime(args.datetime);
|
|
668
791
|
const result = buildTrend({
|
|
@@ -732,9 +855,9 @@ function computeRaw(args = {}) {
|
|
|
732
855
|
return { ...result, summary: nameText(result) };
|
|
733
856
|
}
|
|
734
857
|
if (!system) {
|
|
735
|
-
throw fail('E_INPUT', '缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。');
|
|
858
|
+
throw fail('E_INPUT', '缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。');
|
|
736
859
|
}
|
|
737
|
-
throw fail('E_SYSTEM', `未知体系「${system}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`);
|
|
860
|
+
throw fail('E_SYSTEM', `未知体系「${system}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`);
|
|
738
861
|
}
|
|
739
862
|
|
|
740
863
|
/** 黄历文本 */
|
|
@@ -840,6 +963,43 @@ function numerologyText(r) {
|
|
|
840
963
|
].join('\n');
|
|
841
964
|
}
|
|
842
965
|
|
|
966
|
+
/** 十六型人格文本 */
|
|
967
|
+
function mbtiText(r) {
|
|
968
|
+
const dims = r.dims.map((d) => {
|
|
969
|
+
const side = d.picked === d.left ? d.leftSay : d.rightSay;
|
|
970
|
+
const pct = Math.round(d.pct * 100);
|
|
971
|
+
return `${d.left}/${d.right} 取 ${d.picked}(${d.strength} ${pct}%,净分 ${d.sum}) ${side}`;
|
|
972
|
+
});
|
|
973
|
+
const p = r.profile;
|
|
974
|
+
const stack = Array.isArray(p.stack) && p.stack.length
|
|
975
|
+
? p.stack.map((f, i) => `${i === 0 ? '主导 ' : ''}${f.code}`).join(' → ') + `\n ${p.stack.map((f) => `${f.code}:${f.say}`).join('\n ')}`
|
|
976
|
+
: '';
|
|
977
|
+
return [
|
|
978
|
+
`【十六型人格】${r.type}(${p.title})· ${p.keywords} 已答 ${r.answered}/${r.total} 题`,
|
|
979
|
+
`一句:${p.oneLine}`,
|
|
980
|
+
'【四维】',
|
|
981
|
+
...dims,
|
|
982
|
+
`【优势】${p.strengths.join(';')}`,
|
|
983
|
+
`【留意】${p.blindspots.join(';')}`,
|
|
984
|
+
`【课题】${p.growth}`,
|
|
985
|
+
`【认知功能】${stack}`,
|
|
986
|
+
`【工作】${p.work}`,
|
|
987
|
+
`【关系】${p.love}`,
|
|
988
|
+
`【学习】${p.study}`,
|
|
989
|
+
`注:${r.note}`,
|
|
990
|
+
].join('\n');
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/** 问卷文本(还没答题时) */
|
|
994
|
+
function mbtiPaperText(paper) {
|
|
995
|
+
return [
|
|
996
|
+
`【十六型人格问卷】${paper.total} 题,每题按 1(完全不像我)到 5(很像我)打分`,
|
|
997
|
+
...paper.questions.map((q) => `${q.no}. ${q.text}`),
|
|
998
|
+
`请把 ${paper.total} 个分数按顺序交给 answers(如 [4,2,5,3,…]);可以跳过某些题(填 null),至少答 12 题。`,
|
|
999
|
+
`注:${paper.note}`,
|
|
1000
|
+
].join('\n');
|
|
1001
|
+
}
|
|
1002
|
+
|
|
843
1003
|
/** 人生 K 线文本 */
|
|
844
1004
|
function trendText(r) {
|
|
845
1005
|
const s = r.meta.strength;
|
|
@@ -946,7 +1106,7 @@ export function renderText(result) {
|
|
|
946
1106
|
export { geocodeAddress, resolveAddress };
|
|
947
1107
|
|
|
948
1108
|
export { buildBazi, buildLiuyao, tossLines };
|
|
949
|
-
export { followup };
|
|
1109
|
+
export { followup, askPrompt };
|
|
950
1110
|
export { pastSignals, verifyFit, rectifyBirth };
|
|
951
1111
|
export { crossCheck, crossText };
|
|
952
1112
|
export { buildAlmanac, buildZeri, buildChenggu, buildXiaoliuren, buildStar, buildNumerology, buildConvert };
|