guanwei 1.1.2 → 1.1.4
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/README.en.md +5 -2
- package/README.md +6 -3
- package/dist/assets/{index-C7ql6zvs.js → index-DmdGzBy9.js} +25 -25
- package/dist/assets/index-DmdGzBy9.js.map +1 -0
- package/dist/assets/index-hLV3S-Cj.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/scripts/release.sh +15 -0
- package/server/src/data/db.json +210 -0
- package/server/src/data/guanwei.db +0 -0
- package/server/src/index.ts +28 -5
- package/server/src/routes/tarot.ts +4 -4
- package/server/src/routes/users.ts +42 -7
- package/server/src/services/divineStore.ts +1 -5
- package/server/src/services/promptBuilder.ts +2 -2
- package/server/src/types/index.ts +2 -104
- package/shared/core/data/ganzhi.ts +1 -1
- package/shared/core/data/gua64.ts +1 -1
- package/{src → shared/core}/data/lifeContext.ts +2 -8
- package/shared/core/data/liuren.ts +1 -1
- package/shared/core/data/qimen.ts +1 -1
- package/{src → shared/core}/data/spreads.ts +1 -1
- package/{src → shared/core}/data/tarotCards.ts +1 -1
- package/shared/core/data/xiaoliuren.ts +1 -1
- package/shared/core/data/ziwei.ts +1 -1
- package/shared/core/data/zodiac.ts +1 -1
- package/shared/core/engine/bazi.ts +0 -1
- package/shared/core/engine/calendar.ts +2 -2
- package/{server/src/utils → shared/core/engine}/semanticAnalyzer.ts +9 -46
- package/{server/src/utils → shared/core/engine}/tarotEngine.ts +6 -6
- package/shared/core/engine/ziwei.ts +3 -2
- package/shared/core/engine/ziweiInterpret.ts +0 -3
- package/shared/core/types.ts +157 -0
- package/src/App.tsx +1 -1
- package/src/arts/registry.ts +1 -1
- package/src/components/QuestionFields.tsx +0 -1
- package/src/components/ReportView.tsx +0 -1
- package/src/components/TimeShichenInput.tsx +1 -0
- package/src/components/arts/BaziArt.tsx +0 -10
- package/src/components/arts/LiurenArt.tsx +1 -1
- package/src/components/arts/LiuyaoArt.tsx +0 -1
- package/src/components/arts/MeihuaArt.tsx +0 -1
- package/src/components/arts/QimenArt.tsx +0 -1
- package/src/components/arts/TarotArt.tsx +2 -2
- package/src/components/arts/XiaoliurenArt.tsx +1 -2
- package/src/components/arts/ZiweiArt.tsx +2 -15
- package/src/data/arts.ts +1 -1
- package/src/index.css +2 -74
- package/src/pages/AuthPage.tsx +4 -6
- package/src/pages/DemoPage.tsx +1 -2
- package/src/pages/HistoryPage.tsx +10 -9
- package/src/pages/ModulePage.tsx +6 -32
- package/src/services/api.ts +4 -4
- package/src/stores/useDivinationStore.ts +1 -1
- package/src/types/index.ts +2 -104
- package/tailwind.config.js +0 -35
- package/tsconfig.json +5 -5
- package/dist/assets/index-C7ql6zvs.js.map +0 -1
- package/dist/assets/index-DQx62TUr.css +0 -1
- package/server/src/data/lifeContext.ts +0 -423
- package/server/src/data/spreads.ts +0 -255
- package/server/src/data/tarotCards.ts +0 -2353
- package/src/components/Navigation.tsx +0 -80
- package/src/components/TarotCard.tsx +0 -129
- package/src/pages/AstrologyPage.tsx +0 -33
- package/src/pages/BaZiPage.tsx +0 -33
- package/src/pages/Home.tsx +0 -179
- package/src/pages/SpreadEditor.tsx +0 -230
- package/src/pages/SpreadLibrary.tsx +0 -199
- package/src/pages/SpreadLibraryPage.tsx +0 -17
- package/src/pages/TarotPage.tsx +0 -738
- package/src/pages/ZiWeiPage.tsx +0 -33
- package/src/utils/semanticAnalyzer.ts +0 -555
- package/src/utils/tarotEngine.ts +0 -849
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
nameEn: string;
|
|
5
|
-
arcana: 'major' | 'minor';
|
|
6
|
-
suit?: 'wands' | 'cups' | 'swords' | 'pentacles';
|
|
7
|
-
number?: number;
|
|
8
|
-
keywords: string[];
|
|
9
|
-
meanings: {
|
|
10
|
-
upright: string;
|
|
11
|
-
reversed: string;
|
|
12
|
-
};
|
|
13
|
-
deepMeaning: {
|
|
14
|
-
coreTheme: string;
|
|
15
|
-
psychological: string;
|
|
16
|
-
spiritual: string;
|
|
17
|
-
shadow: string;
|
|
18
|
-
lifeAreas: {
|
|
19
|
-
love: string;
|
|
20
|
-
career: string;
|
|
21
|
-
wealth: string;
|
|
22
|
-
health: string;
|
|
23
|
-
growth: string;
|
|
24
|
-
};
|
|
25
|
-
advice: string;
|
|
26
|
-
warning: string;
|
|
27
|
-
};
|
|
28
|
-
imageSymbols: string[];
|
|
29
|
-
story: string;
|
|
30
|
-
astrology: {
|
|
31
|
-
zodiac?: string;
|
|
32
|
-
planet?: string;
|
|
33
|
-
element?: string;
|
|
34
|
-
};
|
|
35
|
-
kabbalah: {
|
|
36
|
-
path?: number;
|
|
37
|
-
sephirah?: string;
|
|
38
|
-
};
|
|
39
|
-
alchemy: {
|
|
40
|
-
stage?: string;
|
|
41
|
-
element?: string;
|
|
42
|
-
};
|
|
43
|
-
numerology: {
|
|
44
|
-
number: number;
|
|
45
|
-
meaning: string;
|
|
46
|
-
};
|
|
47
|
-
image: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface SpreadPosition {
|
|
51
|
-
id: number;
|
|
52
|
-
name: string;
|
|
53
|
-
description: string;
|
|
54
|
-
x: number;
|
|
55
|
-
y: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface Spread {
|
|
59
|
-
id: string;
|
|
60
|
-
name: string;
|
|
61
|
-
description: string;
|
|
62
|
-
positions: SpreadPosition[];
|
|
63
|
-
category: 'basic' | 'advanced' | 'custom';
|
|
64
|
-
scene?: string[];
|
|
65
|
-
isCustom?: boolean;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface DrawnCard {
|
|
69
|
-
cardId: number;
|
|
70
|
-
isReversed: boolean;
|
|
71
|
-
positionId: number;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface DivinationRecord {
|
|
75
|
-
id: string;
|
|
76
|
-
type: 'tarot' | 'combo' | 'ziwei' | 'bazi' | 'astrology';
|
|
77
|
-
question: string;
|
|
78
|
-
category: string;
|
|
79
|
-
spreadId?: string;
|
|
80
|
-
cards?: DrawnCard[];
|
|
81
|
-
comboMethod?: string;
|
|
82
|
-
comboResult?: string;
|
|
83
|
-
interpretation: string;
|
|
84
|
-
timestamp: number;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface ComboResult {
|
|
88
|
-
method: 'xiaoliuren' | 'daliuren' | 'liuyao' | 'meihua' | 'qimen';
|
|
89
|
-
methodName: string;
|
|
90
|
-
result: string;
|
|
91
|
-
detail: string;
|
|
92
|
-
relationToTarot: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type QuestionCategory = 'love' | 'career' | 'wealth' | 'health' | 'study' | 'family' | 'friendship' | 'spiritual' | 'travel' | 'general';
|
|
96
|
-
|
|
97
|
-
export interface TarotReading {
|
|
98
|
-
question: string;
|
|
99
|
-
category: QuestionCategory;
|
|
100
|
-
spreadId: string;
|
|
101
|
-
cards: DrawnCard[];
|
|
102
|
-
interpretation: string;
|
|
103
|
-
comboResult?: ComboResult;
|
|
104
|
-
}
|
|
1
|
+
// 类型桥(单一副本):全部类型收敛于 shared/core/types.ts,此处仅 re-export 保持旧导入路径兼容
|
|
2
|
+
export * from '../../../shared/core/types.js';
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
// 生活化场景语料库
|
|
2
2
|
// 根据场景提供具体的日常落地建议
|
|
3
3
|
|
|
4
|
-
import type { Scene,
|
|
4
|
+
import type { Scene, LifeContext } from '../types.js';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
scenes: string[];
|
|
8
|
-
actions: string[];
|
|
9
|
-
warnings: string[];
|
|
10
|
-
timeline: { short: string; mid: string; long: string };
|
|
11
|
-
emotionAdvice: Record<Emotion, string>;
|
|
12
|
-
}
|
|
6
|
+
export type { LifeContext };
|
|
13
7
|
|
|
14
8
|
export const LIFE_CONTEXTS: Record<Scene, LifeContext> = {
|
|
15
9
|
love: {
|
|
@@ -104,7 +104,6 @@ export function baziCalc(input: BaziInput): BaziResult {
|
|
|
104
104
|
const nayin = NAYIN[Math.floor(jiaziIndex(y) / 2) % 30];
|
|
105
105
|
const support = wxCount[dayGanWx] + wxCount[WX_ORDER[(WX_ORDER.indexOf(dayGanWx) + 4) % 5]];
|
|
106
106
|
const drain = gzList.length * 2 - support;
|
|
107
|
-
const strength = support > drain ? '身强' : (support < drain ? '身弱' : '中和');
|
|
108
107
|
|
|
109
108
|
// ─── 7. 地支藏干 + 藏干十神 + 加权五行 ───
|
|
110
109
|
const canggan = gzList.map(gz => ({
|
|
@@ -16,7 +16,7 @@ export function daysSince(y: number, m: number, d: number): number {
|
|
|
16
16
|
|
|
17
17
|
/* ---------- 节气 ---------- */
|
|
18
18
|
// 近似表取法(奇门定遁 / 展示用):
|
|
19
|
-
export function getJieqiApproxName(
|
|
19
|
+
export function getJieqiApproxName(_y: number, m: number, d: number): string {
|
|
20
20
|
const v = m * 100 + d;
|
|
21
21
|
let name = '大雪';
|
|
22
22
|
for (let i = JIEQI_APPROX.length - 1; i >= 0; i--) {
|
|
@@ -58,7 +58,7 @@ export function currentJieqiNameExact(y: number, m: number, d: number): string {
|
|
|
58
58
|
return best ? best.name : '大雪';
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// 十二「节」(定月支用)与月支映射(0=寅 … 11
|
|
61
|
+
// 十二「节」(定月支用)与月支映射(0=寅 … 11=丑)
|
|
62
62
|
export const JIE_BRANCH: Record<string, number> = {
|
|
63
63
|
小寒: 11, 立春: 0, 惊蛰: 1, 清明: 2, 立夏: 3, 芒种: 4,
|
|
64
64
|
小暑: 5, 立秋: 6, 白露: 7, 寒露: 8, 立冬: 9, 大雪: 10,
|
|
@@ -1,53 +1,16 @@
|
|
|
1
1
|
// 问题语义分析器
|
|
2
2
|
// 在解读阶段对用户问题进行多维度分析
|
|
3
|
+
// 类型定义收敛自 shared/core/types.ts(单一副本),此处仅保留分析与函数逻辑
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type Depth = 'surface' | 'mid' | 'deep';
|
|
9
|
-
|
|
10
|
-
// 问题类型:决策 / 预测 / 原因 / 建议 / 读心 / 时间 / 通用
|
|
11
|
-
export type QuestionType = 'decision' | 'prediction' | 'reason' | 'advice' | 'mindreading' | 'timing' | 'general';
|
|
12
|
-
// 用户需要的回应方式:安慰 / 方向 / 确认 / 警示
|
|
13
|
-
export type ResponseNeed = 'comfort' | 'direction' | 'confirmation' | 'warning';
|
|
14
|
-
|
|
15
|
-
// 关键实体
|
|
16
|
-
export interface KeyEntity {
|
|
17
|
-
type: 'person' | 'event' | 'time';
|
|
18
|
-
value: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// 问题的深度分析
|
|
22
|
-
export interface QuestionAnalysis {
|
|
23
|
-
realQuestion: string; // 用户真正想问的是什么
|
|
24
|
-
emotionalNeed: string; // 问题背后的情绪需求
|
|
25
|
-
responseNeed: ResponseNeed; // 用户需要什么样的回应
|
|
26
|
-
responseNeedLabel: string;
|
|
27
|
-
}
|
|
5
|
+
import type {
|
|
6
|
+
Scene, Emotion, Tense, Subject, Depth,
|
|
7
|
+
QuestionType, ResponseNeed, KeyEntity, QuestionAnalysis, SemanticAnalysis,
|
|
8
|
+
} from '../types.js';
|
|
28
9
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
emotionLabel: string;
|
|
34
|
-
tense: Tense;
|
|
35
|
-
tenseLabel: string;
|
|
36
|
-
subject: Subject;
|
|
37
|
-
subjectLabel: string;
|
|
38
|
-
depth: Depth;
|
|
39
|
-
depthLabel: string;
|
|
40
|
-
keywords: string[];
|
|
41
|
-
intensity: number; // 0-1,问题强度
|
|
42
|
-
confidence: number; // 0-1,分析置信度
|
|
43
|
-
// —— 以下为新增字段 ——
|
|
44
|
-
questionType: QuestionType; // 问题类型
|
|
45
|
-
questionTypeLabel: string; // 问题类型中文标签
|
|
46
|
-
questionCore: string; // 问题的核心意图
|
|
47
|
-
questionSummary: string; // 一句话概括用户问题的本质
|
|
48
|
-
keyEntities: KeyEntity[]; // 问题中的关键实体
|
|
49
|
-
questionAnalysis: QuestionAnalysis; // 深度分析问题的潜台词
|
|
50
|
-
}
|
|
10
|
+
export type {
|
|
11
|
+
Scene, Emotion, Tense, Subject, Depth,
|
|
12
|
+
QuestionType, ResponseNeed, KeyEntity, QuestionAnalysis, SemanticAnalysis,
|
|
13
|
+
};
|
|
51
14
|
|
|
52
15
|
// 场景关键词库
|
|
53
16
|
const SCENE_KEYWORDS: Record<Scene, { label: string; words: string[]; weight: number }> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TarotCard, DrawnCard, Spread, QuestionCategory } from '../types
|
|
1
|
+
import type { TarotCard, DrawnCard, Spread, QuestionCategory } from '../types.js';
|
|
2
2
|
import { tarotCards } from '../data/tarotCards.js';
|
|
3
|
-
import { analyzeQuestion, type SemanticAnalysis, type Scene, type Emotion } from '
|
|
3
|
+
import { analyzeQuestion, type SemanticAnalysis, type Scene, type Emotion } from './semanticAnalyzer.js';
|
|
4
4
|
import { LIFE_CONTEXTS } from '../data/lifeContext.js';
|
|
5
5
|
|
|
6
6
|
type LifeAreaKey = 'love' | 'career' | 'wealth' | 'health' | 'growth';
|
|
@@ -157,7 +157,7 @@ ${revealLines[Math.floor(Math.random() * revealLines.length)]}`;
|
|
|
157
157
|
function generateOverviewSection(
|
|
158
158
|
cards: DrawnCard[],
|
|
159
159
|
spread: Spread,
|
|
160
|
-
|
|
160
|
+
_question: string,
|
|
161
161
|
semantic: SemanticAnalysis
|
|
162
162
|
): InterpretationSection {
|
|
163
163
|
const cardData = cards.map((drawn) => {
|
|
@@ -316,7 +316,7 @@ function generateOverviewSection(
|
|
|
316
316
|
|
|
317
317
|
function generateOverviewStoryFlow(
|
|
318
318
|
cardData: { card: TarotCard; drawn: DrawnCard; position: { name: string; description: string } }[],
|
|
319
|
-
|
|
319
|
+
_semantic: SemanticAnalysis
|
|
320
320
|
): string {
|
|
321
321
|
if (cardData.length === 0) return '';
|
|
322
322
|
|
|
@@ -362,7 +362,7 @@ function generateCardSection(
|
|
|
362
362
|
position: { name: string; description: string },
|
|
363
363
|
index: number,
|
|
364
364
|
semantic: SemanticAnalysis,
|
|
365
|
-
|
|
365
|
+
_lifeContext: typeof LIFE_CONTEXTS.love,
|
|
366
366
|
totalCards: number
|
|
367
367
|
): InterpretationSection {
|
|
368
368
|
const orientation = drawn.isReversed ? '逆位' : '正位';
|
|
@@ -429,7 +429,7 @@ ${selectedSymbols[0] || '画面里的核心意象'}在这个位置倒过来,
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
function generateEsotericSection(cards: DrawnCard[],
|
|
432
|
+
function generateEsotericSection(cards: DrawnCard[], _semantic: SemanticAnalysis): InterpretationSection {
|
|
433
433
|
const elements: Record<string, number> = { 火: 0, 水: 0, 风: 0, 土: 0, 以太: 0 };
|
|
434
434
|
const planets = new Set<string>();
|
|
435
435
|
const sephiroth = new Set<string>();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// 紫微斗数:简式星盘(命宫/五行局/紫微定位/十四主星)+ 补齐层(辅星/身宫/四化/庙旺/格局)
|
|
2
|
-
import { NAYIN,
|
|
2
|
+
import { NAYIN, ganZhiIndex, mod } from '../data/ganzhi';
|
|
3
|
+
import { GAN } from '../data/ganzhi';
|
|
3
4
|
import { trueSolarTime } from './trueSolarTime';
|
|
4
5
|
import type { ZiweiInput, ZiweiResult } from '../types';
|
|
5
|
-
|
|
6
|
+
|
|
6
7
|
import { PALACE_NAMES, ZW_SIHUA, ZW_BRIGHTNESS, LU_CUN, KUI_YUE, TIAN_MA, HUO_START, LING_START, ZW_GEJU } from '../data/ziwei';
|
|
7
8
|
|
|
8
9
|
// 地支位:0=寅 起(与既有约定一致)
|
|
@@ -73,9 +73,6 @@ export function interpretZiwei(r: ZiweiResult): ZiweiInsight[] {
|
|
|
73
73
|
const stars = starsOf(r, pos);
|
|
74
74
|
if (stars.length === 0) continue;
|
|
75
75
|
const pname = PALACE_NAMES[i];
|
|
76
|
-
const brief = stars.map(starBrief).join(';');
|
|
77
|
-
const line = pname + '宫(' + DIZHI[pos] + ')见' + stars.join('、') + '——' + brief + '。此宫主' + palaceTheme(pname) + '。'
|
|
78
|
-
+ stars[0] + '入' + pname + ',' + (GOOD_STARS.includes(stars[0]) ? '为得地之象,多主顺遂。' : '须留意分寸,化其棱角则吉。');
|
|
79
76
|
overview.push({ name: pname, stars, pos });
|
|
80
77
|
}
|
|
81
78
|
out.push({
|
package/shared/core/types.ts
CHANGED
|
@@ -198,6 +198,163 @@ export interface TarotCardData {
|
|
|
198
198
|
reversed: boolean;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// ─── 塔罗解读链路(原 src/types + src/utils/semanticAnalyzer 收敛至此,双端单一副本)───
|
|
202
|
+
export interface TarotCard {
|
|
203
|
+
id: number;
|
|
204
|
+
name: string;
|
|
205
|
+
nameEn: string;
|
|
206
|
+
arcana: 'major' | 'minor';
|
|
207
|
+
suit?: 'wands' | 'cups' | 'swords' | 'pentacles';
|
|
208
|
+
number?: number;
|
|
209
|
+
keywords: string[];
|
|
210
|
+
meanings: {
|
|
211
|
+
upright: string;
|
|
212
|
+
reversed: string;
|
|
213
|
+
};
|
|
214
|
+
deepMeaning: {
|
|
215
|
+
coreTheme: string;
|
|
216
|
+
psychological: string;
|
|
217
|
+
spiritual: string;
|
|
218
|
+
shadow: string;
|
|
219
|
+
lifeAreas: {
|
|
220
|
+
love: string;
|
|
221
|
+
career: string;
|
|
222
|
+
wealth: string;
|
|
223
|
+
health: string;
|
|
224
|
+
growth: string;
|
|
225
|
+
};
|
|
226
|
+
advice: string;
|
|
227
|
+
warning: string;
|
|
228
|
+
};
|
|
229
|
+
imageSymbols: string[];
|
|
230
|
+
story: string;
|
|
231
|
+
astrology: {
|
|
232
|
+
zodiac?: string;
|
|
233
|
+
planet?: string;
|
|
234
|
+
element?: string;
|
|
235
|
+
};
|
|
236
|
+
kabbalah: {
|
|
237
|
+
path?: number;
|
|
238
|
+
sephirah?: string;
|
|
239
|
+
};
|
|
240
|
+
alchemy: {
|
|
241
|
+
stage?: string;
|
|
242
|
+
element?: string;
|
|
243
|
+
};
|
|
244
|
+
numerology: {
|
|
245
|
+
number: number;
|
|
246
|
+
meaning: string;
|
|
247
|
+
};
|
|
248
|
+
image: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface SpreadPosition {
|
|
252
|
+
id: number;
|
|
253
|
+
name: string;
|
|
254
|
+
description: string;
|
|
255
|
+
x: number;
|
|
256
|
+
y: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface Spread {
|
|
260
|
+
id: string;
|
|
261
|
+
name: string;
|
|
262
|
+
description: string;
|
|
263
|
+
positions: SpreadPosition[];
|
|
264
|
+
category: 'basic' | 'advanced' | 'custom';
|
|
265
|
+
scene?: string[];
|
|
266
|
+
isCustom?: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface DrawnCard {
|
|
270
|
+
cardId: number;
|
|
271
|
+
isReversed: boolean;
|
|
272
|
+
positionId: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface DivinationRecord {
|
|
276
|
+
id: string;
|
|
277
|
+
type: 'tarot' | 'combo' | 'ziwei' | 'bazi' | 'astrology';
|
|
278
|
+
question: string;
|
|
279
|
+
category: string;
|
|
280
|
+
spreadId?: string;
|
|
281
|
+
cards?: DrawnCard[];
|
|
282
|
+
comboMethod?: string;
|
|
283
|
+
comboResult?: string;
|
|
284
|
+
interpretation: string;
|
|
285
|
+
timestamp: number;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ComboResult {
|
|
289
|
+
method: 'xiaoliuren' | 'daliuren' | 'liuyao' | 'meihua' | 'qimen';
|
|
290
|
+
methodName: string;
|
|
291
|
+
result: string;
|
|
292
|
+
detail: string;
|
|
293
|
+
relationToTarot: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export type QuestionCategory = 'love' | 'career' | 'wealth' | 'health' | 'study' | 'family' | 'friendship' | 'spiritual' | 'travel' | 'general';
|
|
297
|
+
|
|
298
|
+
export interface TarotReading {
|
|
299
|
+
question: string;
|
|
300
|
+
category: QuestionCategory;
|
|
301
|
+
spreadId: string;
|
|
302
|
+
cards: DrawnCard[];
|
|
303
|
+
interpretation: string;
|
|
304
|
+
comboResult?: ComboResult;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 问题语义分析(原 src/utils/semanticAnalyzer 类型部分)
|
|
308
|
+
export type Scene = 'love' | 'career' | 'wealth' | 'study' | 'health' | 'family' | 'friendship' | 'spiritual' | 'travel' | 'general';
|
|
309
|
+
export type Emotion = 'anxious' | 'hopeful' | 'confused' | 'lost' | 'grateful' | 'calm' | 'angry' | 'sad' | 'curious';
|
|
310
|
+
export type Tense = 'past' | 'present' | 'future' | 'hypothetical' | 'ongoing';
|
|
311
|
+
export type Subject = 'self' | 'other' | 'mutual' | 'third-party';
|
|
312
|
+
export type Depth = 'surface' | 'mid' | 'deep';
|
|
313
|
+
export type QuestionType = 'decision' | 'prediction' | 'reason' | 'advice' | 'mindreading' | 'timing' | 'general';
|
|
314
|
+
export type ResponseNeed = 'comfort' | 'direction' | 'confirmation' | 'warning';
|
|
315
|
+
|
|
316
|
+
export interface KeyEntity {
|
|
317
|
+
type: 'person' | 'event' | 'time';
|
|
318
|
+
value: string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface QuestionAnalysis {
|
|
322
|
+
realQuestion: string;
|
|
323
|
+
emotionalNeed: string;
|
|
324
|
+
responseNeed: ResponseNeed;
|
|
325
|
+
responseNeedLabel: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface SemanticAnalysis {
|
|
329
|
+
scene: Scene;
|
|
330
|
+
sceneLabel: string;
|
|
331
|
+
emotion: Emotion;
|
|
332
|
+
emotionLabel: string;
|
|
333
|
+
tense: Tense;
|
|
334
|
+
tenseLabel: string;
|
|
335
|
+
subject: Subject;
|
|
336
|
+
subjectLabel: string;
|
|
337
|
+
depth: Depth;
|
|
338
|
+
depthLabel: string;
|
|
339
|
+
keywords: string[];
|
|
340
|
+
intensity: number; // 0-1,问题强度
|
|
341
|
+
confidence: number; // 0-1,分析置信度
|
|
342
|
+
questionType: QuestionType; // 问题类型
|
|
343
|
+
questionTypeLabel: string; // 问题类型中文标签
|
|
344
|
+
questionCore: string; // 问题的核心意图
|
|
345
|
+
questionSummary: string; // 一句话概括用户问题的本质
|
|
346
|
+
keyEntities: KeyEntity[]; // 问题中的关键实体
|
|
347
|
+
questionAnalysis: QuestionAnalysis; // 深度分析问题的潜台词
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface LifeContext {
|
|
351
|
+
scenes: string[];
|
|
352
|
+
actions: string[];
|
|
353
|
+
warnings: string[];
|
|
354
|
+
timeline: { short: string; mid: string; long: string };
|
|
355
|
+
emotionAdvice: Record<Emotion, string>;
|
|
356
|
+
}
|
|
357
|
+
|
|
201
358
|
// 通用引擎契约
|
|
202
359
|
export interface ArtEngine<TInput, TResult> {
|
|
203
360
|
id: ArtId;
|
package/src/App.tsx
CHANGED
package/src/arts/registry.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { AstrologyPanel, AstrologyResult } from '@/components/arts/AstrologyArt'
|
|
|
11
11
|
import { TarotPanel, TarotResult } from '@/components/arts/TarotArt';
|
|
12
12
|
|
|
13
13
|
export interface ArtPair {
|
|
14
|
-
Panel: ComponentType<{ onDivine: (
|
|
14
|
+
Panel: ComponentType<{ onDivine: (...args: any[]) => void }>;
|
|
15
15
|
Result: ComponentType<{ data: any }>;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// 四柱八字:输入面板(含出生地点→真太阳时)+ 结果渲染(四柱/五行/十神)
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { baziCalc } from '@core/engine/bazi';
|
|
4
3
|
import { SHISHEN_MAP, WUXING } from '@core/data/ganzhi';
|
|
5
4
|
import type { BaziResult, GeoLocation } from '@core/types';
|
|
6
5
|
import type { UserProfile } from '@/utils/userStore';
|
|
@@ -258,12 +257,3 @@ export function BaziResult({ data }: { data: BaziResult }) {
|
|
|
258
257
|
</>
|
|
259
258
|
);
|
|
260
259
|
}
|
|
261
|
-
// 十神格局点睛
|
|
262
|
-
function shishenFocus(r: any): string {
|
|
263
|
-
const names = r.shishen.map((s: any) => s.name);
|
|
264
|
-
if (names.includes('正官') || names.includes('七杀')) return '官杀透干,主担当与约束,成事在于守正。';
|
|
265
|
-
if (names.includes('正财') || names.includes('偏财')) return '财星显露,主经营与所得,宜务实聚财。';
|
|
266
|
-
if (names.includes('正印') || names.includes('偏印')) return '印星为用,主学识与荫庇,宜向学深造。';
|
|
267
|
-
if (names.includes('食神') || names.includes('伤官')) return '食伤泄秀,主才情与输出,宜展露所长。';
|
|
268
|
-
return '比劫同气,主自立与同侪,宜广结善缘。';
|
|
269
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 大六壬:起课面板 + 天地盘/四课三传渲染
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jiangName } from '@core/engine/liuren';
|
|
4
4
|
import { ZHI } from '@core/data/ganzhi';
|
|
5
5
|
import { LR_JIANG_SYMBOL, LR_JIANG_WX } from '@core/data/liuren';
|
|
6
6
|
import type { LiurenResult } from '@core/types';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// 梅花易数:起卦面板(时间/报数)+ 卦象渲染(本卦/互卦/变卦 + 体用)
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { meihuaCalc } from '@core/engine/meihua';
|
|
4
3
|
import { BAGUA } from '@core/data/gua64';
|
|
5
4
|
import type { MeihuaResult } from '@core/types';
|
|
6
5
|
import { ResultCard } from '@/components/ResultCard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 塔罗:问镜面板(牌阵选择)+ 扇形翻牌(未翻开不示牌名)+ 牌阵之示
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
|
-
import {
|
|
4
|
+
import { SUIT } from '@core/engine/tarot';
|
|
5
5
|
import { allTarotSpreads, type TarotSpread } from '@core/data/tarotSpreads';
|
|
6
6
|
import type { TarotCardData } from '@core/types';
|
|
7
7
|
import { ResultCard } from '@/components/ResultCard';
|
|
@@ -96,7 +96,7 @@ export function TarotResult({ data }: { data: DrawResult }) {
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
// 塔罗全阵参详(正逆位比例 + 元素侧重,现代语言)
|
|
99
|
-
function tarotSummary(cards: any[],
|
|
99
|
+
function tarotSummary(cards: any[], _spread: any): string {
|
|
100
100
|
const rev = cards.filter(c => c.reversed).length;
|
|
101
101
|
const majors = cards.filter(c => c.major).length;
|
|
102
102
|
const parts: string[] = [];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// 小六壬:掐指占时面板 + 掌诀/推演轨迹渲染
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { XLR_ORDER, XLR } from '@core/data/xiaoliuren';
|
|
3
|
+
import { XLR_ORDER } from '@core/data/xiaoliuren';
|
|
5
4
|
import { mod } from '@core/data/ganzhi';
|
|
6
5
|
import type { XiaoliurenResult } from '@core/types';
|
|
7
6
|
import { ResultCard } from '@/components/ResultCard';
|