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
package/README.en.md
CHANGED
|
@@ -50,13 +50,14 @@ An open-source Chinese metaphysics application covering **nine arts of divinatio
|
|
|
50
50
|
- Results computed by the backend and **persisted to SQLite**
|
|
51
51
|
|
|
52
52
|
### AI Deep Interpretation
|
|
53
|
-
- 9
|
|
53
|
+
- **9 role-based personas**: one persona per art (e.g. Ziwei: chart structure → star palaces → twelve houses → major cycles → life stages) with a skill list injected in a single prompt — true multi-agent orchestration is planned (guanwei-pro mode, see ROADMAP)
|
|
54
54
|
- **Dual schemas**: natal-chart reports (raw reading / character / family / mind / life stages / career / love / wealth / health) and divination reports (situation / trend / timing)
|
|
55
55
|
- **Chart-fact consistency**: the AI must quote chart data verbatim; the backend **verifies six-relations facts** (palace branch, main stars, borrowed stars, four transformations) and patches contradictions
|
|
56
56
|
- **Stable readings**: cached chart-parsing step, low sampling temperature, evidence-anchored claims, de-duplication with word budgets
|
|
57
57
|
- **Life-event calibration**: record known life events; the AI echoes them at the matching years and never contradicts them
|
|
58
58
|
- Question–art **suitability analysis** (e.g. Qimen is not advised for romance questions)
|
|
59
59
|
- Streaming generation + structured report cards; export to Markdown / PDF
|
|
60
|
+
- **Classical citations (in progress)**: the duanyu library (`shared/core/data/duanyu.ts`) holds 16 verbatim classical excerpts, all still in `seed` status (pending word-by-word review); per policy they are not injected into the AI prompt until reviewed — current readings rely on model knowledge, with reviewed entries wired in progressively (see ROADMAP)
|
|
60
61
|
|
|
61
62
|
### Other
|
|
62
63
|
- Classics pages, academy (history and knowledge of the nine arts)
|
|
@@ -126,7 +127,7 @@ Open http://localhost:5173 . Stop with `docker compose down`.
|
|
|
126
127
|
|
|
127
128
|
Images: `ghcr.io/rubyccll/guanwei-guanwei-web` / `guanwei-guanwei-backend`; override ports with `WEB_PORT=5180 API_PORT=3020 docker compose up -d` if needed.
|
|
128
129
|
|
|
129
|
-
#### Option 6: Local Node.js (≥ 22)
|
|
130
|
+
#### Option 6: Local Node.js (≥ 22.5, node:sqlite built-in)
|
|
130
131
|
|
|
131
132
|
```bash
|
|
132
133
|
./scripts/setup.sh --key YOUR_API_KEY # interactive mode: run ./scripts/setup.sh
|
|
@@ -184,7 +185,9 @@ npm test # 181 tests (engines / rendering / interactions / storage / prompts)
|
|
|
184
185
|
|
|
185
186
|
## 🔐 Security
|
|
186
187
|
- Keys live only in local `server/.env` (gitignored); Docker builds exclude `.env` via `.dockerignore`
|
|
188
|
+
- Passwords are hashed with **scrypt (random salt)**; legacy hashes are upgraded on successful login
|
|
187
189
|
- Test data is fully fictional/anonymized — no real personal information in this repository
|
|
190
|
+
- ⚠️ **Deployment boundary**: this app targets **local/private self-hosting** and ships **no auth middleware** — user identity is only the `username` passed in requests (anyone knowing a username can read that user's profile via `GET /:username/profile`). **Do not expose it directly to the public internet**; put a reverse proxy with gateway auth in front (e.g. Nginx basic auth / Authelia / Cloudflare Access) if you need public access.
|
|
188
191
|
|
|
189
192
|
## 📄 Sample Output
|
|
190
193
|
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<p align="center">
|
|
22
22
|
<b>Guanwei</b> — an open-source Chinese metaphysics application: eight-character Bazi, Ziwei Doushu, classical astrology, Qimen Dunjia, Liuyao, Da Liu Ren, Meihua, Xiaoliuren and Tarot — with AI-powered in-depth interpretation.
|
|
23
|
-
<br><i>东玄为主、中西合参的玄学占卜应用:九术排盘、AI
|
|
23
|
+
<br><i>东玄为主、中西合参的玄学占卜应用:九术排盘、AI 深度解读、古籍学馆,一条链路贯通「排盘 → 解读 → 归档 → 回看」。</i>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
26
|
> 占问所得,仅供修身养性、怡情遣兴之用,不构成任何决策依据。
|
|
@@ -56,13 +56,14 @@
|
|
|
56
56
|
- 起占结果由后端计算并**持久化入库**(SQLite),六爻摇卦、塔罗抽牌等交互结果同样后端定稿
|
|
57
57
|
|
|
58
58
|
### AI 深度解读
|
|
59
|
-
- 9
|
|
59
|
+
- **9 术角色化解读**:每术独立 persona(紫微:命盘结构 → 星曜落宫 → 十二宫 → 大限流年 → 人生阶段),技能清单单轮注入(多 Agent 编排规划中,接入后作为 guanwei-pro 模式,见 ROADMAP)
|
|
60
60
|
- **双轨 Schema**:命盘类(原始解读/性格/原生家庭/心智模式/人生阶段/事业/爱情/财富/健康)、占问类(现状/趋势/时机)
|
|
61
61
|
- **盘面事实一致性约束**:AI 必须逐字引用排盘数据,不得编造;后端**六亲宫位事实校验 + 矛盾定向修正**(宫位地支/主星/借星/生年四化)
|
|
62
62
|
- **解读稳定性**:Step1 盘面解析缓存复用、低温采样、论断锚定(主观程度词必须有盘面依据)、去重与字数预算
|
|
63
63
|
- **人生经历校准**:可录入命主已知人生事件,AI 解读在对应流年处呼应、且不与已知经历矛盾
|
|
64
64
|
- 问题-术数**适配性分析**(如奇门不适于问情爱)
|
|
65
65
|
- 流式生成 + 结构化报告卡片,可导出 Markdown / 存为 PDF
|
|
66
|
+
- **古籍引证(校核中)**:断语库 `shared/core/data/duanyu.ts` 收录古籍原文 16 条,当前为 seed 状态(待逐字校核),按规范未 reviewed 不注入 AI prompt——现阶段解读引证主要依赖模型知识,断语库校核完成后逐条接入(见 ROADMAP)
|
|
66
67
|
|
|
67
68
|
### 其他
|
|
68
69
|
- 古籍页(背景动画、经典原文)、学馆(九术源流与知识)
|
|
@@ -143,7 +144,7 @@ guanwei start
|
|
|
143
144
|
|
|
144
145
|
镜像:`ghcr.io/rubyccll/guanwei-guanwei-web` / `guanwei-guanwei-backend`;端口冲突时 `WEB_PORT=5180 API_PORT=3020 docker compose up -d` 覆盖。也可直接 `docker pull ghcr.io/rubyccll/guanwei-guanwei-web:latest`。
|
|
145
146
|
|
|
146
|
-
#### 方式六:本地 Node.js(≥ 22
|
|
147
|
+
#### 方式六:本地 Node.js(≥ 22.5,需 node:sqlite 内置支持)
|
|
147
148
|
|
|
148
149
|
```bash
|
|
149
150
|
./scripts/setup.sh --key 你的APIKey # 交互式可直接运行 ./scripts/setup.sh
|
|
@@ -207,8 +208,10 @@ cd server && npx tsx scripts/divineStoreSmoke.ts # SQLite 存储冒烟
|
|
|
207
208
|
|
|
208
209
|
## 🔐 安全说明
|
|
209
210
|
- 所有密钥仅存于本地 `server/.env`(已 gitignore),仓库只提供 `.env.example` 模板;Docker 镜像构建已排除 `.env`(.dockerignore)
|
|
211
|
+
- 密码哈希使用 **scrypt(带随机盐)**,登录时兼容升级存量旧哈希
|
|
210
212
|
- AI 报告质量门槛:结构评分不达标不入库,自动留档供改进提示词
|
|
211
213
|
- 测试数据全部虚构/匿名化,不含真实用户隐私;真实案例仅存本地(git 忽略)
|
|
214
|
+
- ⚠️ **部署边界(务必知晓)**:本项目定位为「本地/内网自部署」工具,**未内置登录鉴权体系**——用户身份仅靠传入的 username 区分,知道用户名即可读取该用户档案(`GET /:username/profile` 无口令校验)。**请勿直接暴露到公网**;如需公网访问,必须在前面架设反向代理 + 网关鉴权(如 Nginx basic auth / Authelia / Cloudflare Access 等),或在应用层另行加固。
|
|
212
215
|
|
|
213
216
|
## 📄 示例输出
|
|
214
217
|
|