guanwei 1.2.4 → 1.2.5
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 +9 -5
- package/README.md +13 -8
- package/package.json +1 -1
- package/server/src/data/db.json +156 -0
- package/server/src/data/guanwei.db +0 -0
- package/server/src/services/promptBuilder.ts +12 -0
package/README.en.md
CHANGED
|
@@ -78,25 +78,28 @@ AI: multi-LLM adapter (OpenAI-compatible & Google formats; DeepSeek / Gemi
|
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
80
|
npm i -g guanwei
|
|
81
|
-
guanwei setup
|
|
81
|
+
guanwei setup
|
|
82
82
|
guanwei start
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Open http://localhost:5173 . Upgrade: `guanwei update`. Stop: `guanwei stop`.
|
|
86
86
|
|
|
87
|
+
> 💡 **Configure your key (`guanwei setup`)**: interactive wizard — pick a provider, paste your key (not echoed), stored in `~/.guanwei/.env` (readable only by you). Or one-shot: `guanwei setup --key YOUR_API_KEY` (5 providers, see below).
|
|
88
|
+
> 💡 **No key? Still works**: `guanwei start` runs fine — charting, demos and classics all work; only AI reading needs a key (the page shows a config hint).
|
|
89
|
+
|
|
87
90
|
### ⚡ Docker one-liner (no Node needed, easiest)
|
|
88
91
|
|
|
89
92
|
```bash
|
|
90
|
-
docker run -d --name guanwei -p 5173:80 -e LLM_DEEPSEEK_KEY=
|
|
93
|
+
docker run -d --name guanwei -p 5173:80 -e LLM_DEEPSEEK_KEY=sk-YOUR_REAL_KEY ghcr.io/rubyccll/guanwei:latest
|
|
91
94
|
```
|
|
92
95
|
|
|
93
|
-
Open http://localhost:5173 . Stop: `docker stop guanwei`. Other providers: `-e LLM_PROVIDER=gemini -e LLM_GEMINI_KEY
|
|
96
|
+
Open http://localhost:5173 . Stop: `docker stop guanwei`. Other providers: `-e LLM_PROVIDER=gemini -e LLM_GEMINI_KEY=sk-YOUR_REAL_KEY` (deepseek / gemini / groq / qwen / custom).
|
|
94
97
|
|
|
95
98
|
### ⚡ Source installer (fallback)
|
|
96
99
|
|
|
97
100
|
```bash
|
|
98
101
|
curl -fsSL https://raw.githubusercontent.com/RubyCcll/guanwei/main/scripts/install.sh | bash
|
|
99
|
-
guanwei setup
|
|
102
|
+
guanwei setup
|
|
100
103
|
guanwei start
|
|
101
104
|
```
|
|
102
105
|
|
|
@@ -140,7 +143,8 @@ The script installs dependencies, writes `server/.env` (key stays local), and st
|
|
|
140
143
|
```bash
|
|
141
144
|
npm link # install globally (or use ./scripts/guanwei directly)
|
|
142
145
|
|
|
143
|
-
guanwei setup
|
|
146
|
+
guanwei setup # configure API key (interactive wizard)
|
|
147
|
+
guanwei setup --key sk-xxx # one-shot (replace sk-xxx with your real key)
|
|
144
148
|
guanwei start # start (--docker for containers)
|
|
145
149
|
guanwei doctor # environment self-check (Node/config/ports/deps/version)
|
|
146
150
|
guanwei update # update to latest (git incremental merge; local config preserved)
|
package/README.md
CHANGED
|
@@ -93,25 +93,28 @@ AI 层:多 LLM 适配(OpenAI 兼容 / Google 格式,DeepSeek / Gemini / Gr
|
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
npm i -g guanwei
|
|
96
|
-
guanwei setup
|
|
96
|
+
guanwei setup
|
|
97
97
|
guanwei start
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
打开 http://localhost:5173 即用。国内用户自动走 npmmirror 加速;升级:`guanwei update`。停止:`guanwei stop`。
|
|
101
101
|
|
|
102
|
+
> 💡 **配置 Key(`guanwei setup`)**:交互式引导——选服务商 → 粘贴 Key(不回显),写进 `~/.guanwei/.env` 仅本机可读。也可一步到位:`guanwei setup --key sk-你的真实Key`(DeepSeek 等 5 家任选,Key 申请见下文)。
|
|
103
|
+
> 💡 **不配 Key 也能启动**:`guanwei start` 直接跑,排盘/演示/古籍全部可用,仅 AI 解读不可用(页面会提示配置入口)。
|
|
104
|
+
|
|
102
105
|
### ⚡ 方式二:Docker 一行启动(免装 Node,最省心)
|
|
103
106
|
|
|
104
107
|
```bash
|
|
105
|
-
docker run -d --name guanwei -p 5173:80 -e LLM_DEEPSEEK_KEY
|
|
108
|
+
docker run -d --name guanwei -p 5173:80 -e LLM_DEEPSEEK_KEY=sk-你的真实Key ghcr.io/rubyccll/guanwei:latest
|
|
106
109
|
```
|
|
107
110
|
|
|
108
|
-
打开 http://localhost:5173 即用。停止:`docker stop guanwei`。其他服务商:`-e LLM_PROVIDER=gemini -e LLM_GEMINI_KEY
|
|
111
|
+
打开 http://localhost:5173 即用。停止:`docker stop guanwei`。其他服务商:`-e LLM_PROVIDER=gemini -e LLM_GEMINI_KEY=sk-你的真实Key`(deepseek / gemini / groq / qwen / custom 均可)。
|
|
109
112
|
|
|
110
113
|
### ⚡ 方式三:curl 一键安装(源码方式,备用)
|
|
111
114
|
|
|
112
115
|
```bash
|
|
113
116
|
curl -fsSL https://raw.githubusercontent.com/RubyCcll/guanwei/main/scripts/install.sh | bash
|
|
114
|
-
guanwei setup
|
|
117
|
+
guanwei setup
|
|
115
118
|
guanwei start
|
|
116
119
|
```
|
|
117
120
|
|
|
@@ -126,7 +129,7 @@ guanwei start
|
|
|
126
129
|
点击按钮 → 云端环境自动装好依赖 → 终端执行:
|
|
127
130
|
|
|
128
131
|
```bash
|
|
129
|
-
./scripts/setup.sh --key
|
|
132
|
+
./scripts/setup.sh --key sk-你的真实Key
|
|
130
133
|
```
|
|
131
134
|
|
|
132
135
|
#### 方式五:Docker Compose(多容器)
|
|
@@ -134,7 +137,7 @@ guanwei start
|
|
|
134
137
|
预构建镜像已发布到 GitHub Container Registry(amd64 + arm64 双平台):
|
|
135
138
|
|
|
136
139
|
```bash
|
|
137
|
-
./scripts/setup.sh --docker --key
|
|
140
|
+
./scripts/setup.sh --docker --key sk-你的真实Key # 自动配置 + 拉取镜像 + 启动
|
|
138
141
|
# 或手动:
|
|
139
142
|
# cp server/.env.example server/.env (填入 Key)
|
|
140
143
|
# docker compose up -d (自动拉取 GHCR 镜像)
|
|
@@ -147,7 +150,8 @@ guanwei start
|
|
|
147
150
|
#### 方式六:本地 Node.js(≥ 22.5,需 node:sqlite 内置支持)
|
|
148
151
|
|
|
149
152
|
```bash
|
|
150
|
-
./scripts/setup.sh
|
|
153
|
+
./scripts/setup.sh # 交互式:选服务商 + 输入 Key
|
|
154
|
+
# 或一步到位:./scripts/setup.sh --key sk-你的真实Key
|
|
151
155
|
```
|
|
152
156
|
|
|
153
157
|
脚本自动:安装依赖 → 写入 `server/.env`(Key 仅存本地)→ 启动前后端。打开 http://localhost:5173 → 缘起页注册 → 九术页起占 → 召 AI 成报告。
|
|
@@ -159,7 +163,8 @@ guanwei start
|
|
|
159
163
|
npm link
|
|
160
164
|
# ② 不想全局安装?直接使用:./scripts/guanwei <命令>
|
|
161
165
|
|
|
162
|
-
guanwei setup
|
|
166
|
+
guanwei setup # 配置 API Key(交互式:选服务商 + 粘贴 Key)
|
|
167
|
+
guanwei setup --key sk-xxx # 一步到位(sk-xxx 换成你的真实 Key)
|
|
163
168
|
guanwei start # 启动(--docker 用容器)
|
|
164
169
|
guanwei doctor # 环境自检(Node/配置/占位密钥/端口/依赖/版本)
|
|
165
170
|
guanwei update # 更新到最新版(git 增量合并,.env 等本地配置不覆盖)
|
package/package.json
CHANGED
package/server/src/data/db.json
CHANGED
|
@@ -6432,6 +6432,162 @@
|
|
|
6432
6432
|
"samples": [],
|
|
6433
6433
|
"records": [],
|
|
6434
6434
|
"token": "a4c67d7d395086f836811508e9199d007487ad24f3f92db0492163bcef07ed44"
|
|
6435
|
+
},
|
|
6436
|
+
{
|
|
6437
|
+
"username": "联调4720",
|
|
6438
|
+
"passHash": "scrypt$3f5d6299295a3a9918e0416c626bcdef$67f7d06f536c2dcf312ea7ae15b50565916f97e200b904476ab96b3c4ef5d9fe3bd093734fbcf27a271682972fff3b9dff32bf02c671c496c338cf0df82c95a3",
|
|
6439
|
+
"createdAt": 1787978014815,
|
|
6440
|
+
"profile": {
|
|
6441
|
+
"birthDate": "1996-09-09",
|
|
6442
|
+
"birthHourIndex": 5,
|
|
6443
|
+
"gender": "男",
|
|
6444
|
+
"location": null
|
|
6445
|
+
},
|
|
6446
|
+
"samples": [],
|
|
6447
|
+
"records": [
|
|
6448
|
+
{
|
|
6449
|
+
"artId": "bazi",
|
|
6450
|
+
"createdAt": 1,
|
|
6451
|
+
"result": {
|
|
6452
|
+
"dayGZ": "壬申"
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6455
|
+
],
|
|
6456
|
+
"token": "5acff6d1a3d077e1043b57bfd0e7b197b554e6895c3c5ad7aab91eb6c5e055dd"
|
|
6457
|
+
},
|
|
6458
|
+
{
|
|
6459
|
+
"username": "鉴权5000",
|
|
6460
|
+
"passHash": "scrypt$4abab2b41008b858f4f0d57083e0b00d$1af134638bb86539577633e60e77bae1c31125bc041f7ff372877984ab00c9b917c2b52fb9b2a283a2e0a57576471e879f625ea44bbdd0ab525b95ea15ffaaa9",
|
|
6461
|
+
"createdAt": 1787978015042,
|
|
6462
|
+
"profile": {
|
|
6463
|
+
"birthDate": "1999-01-01"
|
|
6464
|
+
},
|
|
6465
|
+
"samples": [],
|
|
6466
|
+
"records": [],
|
|
6467
|
+
"token": "c483184079880cc968ca31607701d9dcdafbe6a97302345a5193ab6ac4c97a18"
|
|
6468
|
+
},
|
|
6469
|
+
{
|
|
6470
|
+
"username": "他人5082",
|
|
6471
|
+
"passHash": "scrypt$51321757c7a676de91f379a812ad7bce$e1750ec9daf3b5f19c8213c9fb51420746986cbabd9ecd507d805fc957942996011489220975566de6782616b614212a7755f507ae31d21946864c6e3458650b",
|
|
6472
|
+
"createdAt": 1787978015129,
|
|
6473
|
+
"profile": {},
|
|
6474
|
+
"samples": [],
|
|
6475
|
+
"records": [],
|
|
6476
|
+
"token": "07a612c8e5de4e8982efedd10cb9084b446bb3c5ece03bfcd3392a075997b7b0"
|
|
6477
|
+
},
|
|
6478
|
+
{
|
|
6479
|
+
"username": "登鉴5138",
|
|
6480
|
+
"passHash": "scrypt$10094d85734baa9671128fc10c5e8d83$ec7d061fac3f81efb0ef5b1e8297372ef9165f2221492185a6d19a8158bf0677ea664d935fb4ccd7742f0e3c1b5caaab715c860b5c4c8fd0c1368ea53eb21521",
|
|
6481
|
+
"createdAt": 1787978015183,
|
|
6482
|
+
"profile": {},
|
|
6483
|
+
"samples": [],
|
|
6484
|
+
"records": [],
|
|
6485
|
+
"token": "a6c1d3612e8f34e83d735e8dddaa5fadba775fa79b85f2cfc1e0720063b92ad9"
|
|
6486
|
+
},
|
|
6487
|
+
{
|
|
6488
|
+
"username": "占位5233",
|
|
6489
|
+
"passHash": "scrypt$86ce84ec1222fe4888a75d2b19324c83$0316d5c423c34fa2bcf1088670bbbe35617ee2f501451af7ec8e3bad915eda8ed49cadf9836f2127b0b72f043a0d24ba9bad598b79d3ff19f451e89a7e8b33d2",
|
|
6490
|
+
"createdAt": 1787978015236,
|
|
6491
|
+
"profile": {},
|
|
6492
|
+
"samples": [],
|
|
6493
|
+
"records": [],
|
|
6494
|
+
"token": "267fd8173c3e0536a66bf6432ca5b07ed8e87e044be6c33edf41b3d55abb0748"
|
|
6495
|
+
},
|
|
6496
|
+
{
|
|
6497
|
+
"username": "甲5347",
|
|
6498
|
+
"passHash": "scrypt$bb2c32b24b75e33435eb8c6910f5ab2f$20a91be38796f811012fb1879a4ffb9da462049340994af0df150206388879c1d34e76ca7b9b9024870b42311062b2c3915c7102e55e74a31a819892f268f0f0",
|
|
6499
|
+
"createdAt": 1787978015397,
|
|
6500
|
+
"profile": {},
|
|
6501
|
+
"samples": [],
|
|
6502
|
+
"records": [],
|
|
6503
|
+
"token": "ba249a40c22dbc4c5a6b9068d3ebc3e1d1afe5212821dbffd0d2b192abf543be"
|
|
6504
|
+
},
|
|
6505
|
+
{
|
|
6506
|
+
"username": "乙5347",
|
|
6507
|
+
"passHash": "scrypt$cfe4fd0384b866b77abed2746d6c882d$c275b3373db1986865e430a392f771e29ed776006d4a7e1a9cef7afe583d81158b0dcb2b86361e863b2fae7273da61d86bbad0c8cadf06eba268b22c14f667b1",
|
|
6508
|
+
"createdAt": 1787978015472,
|
|
6509
|
+
"profile": {},
|
|
6510
|
+
"samples": [],
|
|
6511
|
+
"records": [],
|
|
6512
|
+
"token": "e12f06635335a7d365dca3dc5f4d3c87f0c0c0989199100e3cd40fb1f51b563b"
|
|
6513
|
+
},
|
|
6514
|
+
{
|
|
6515
|
+
"username": "联调1046",
|
|
6516
|
+
"passHash": "scrypt$9212a84cc0e275b12e32aba82966195f$943a2029711318c91a68ca0e9f3393a128d753b6ad00936ad9f08d14ae0abf033b6b0b808f2defecc2f284bccdbe7da6e4624ce15e75c7eb670d6d8486380dd1",
|
|
6517
|
+
"createdAt": 1787978041147,
|
|
6518
|
+
"profile": {
|
|
6519
|
+
"birthDate": "1996-09-09",
|
|
6520
|
+
"birthHourIndex": 5,
|
|
6521
|
+
"gender": "男",
|
|
6522
|
+
"location": null
|
|
6523
|
+
},
|
|
6524
|
+
"samples": [],
|
|
6525
|
+
"records": [
|
|
6526
|
+
{
|
|
6527
|
+
"artId": "bazi",
|
|
6528
|
+
"createdAt": 1,
|
|
6529
|
+
"result": {
|
|
6530
|
+
"dayGZ": "壬申"
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
],
|
|
6534
|
+
"token": "2b8f9cdcbeae6f368028bbdac2171f56975d41542f440b98faea51ea24348eb0"
|
|
6535
|
+
},
|
|
6536
|
+
{
|
|
6537
|
+
"username": "鉴权1356",
|
|
6538
|
+
"passHash": "scrypt$d1c69b653d8c59bac97a60cc564a2812$85b38421cc4a8449957a390bea3fafedbec2f1426a3c59a17fd60045a67ea25840da9c03e49159012a18bae42ea997ad98b585a504cfaf1dba41d159c91a6a88",
|
|
6539
|
+
"createdAt": 1787978041401,
|
|
6540
|
+
"profile": {
|
|
6541
|
+
"birthDate": "1999-01-01"
|
|
6542
|
+
},
|
|
6543
|
+
"samples": [],
|
|
6544
|
+
"records": [],
|
|
6545
|
+
"token": "03ae064372554daa1be328b5f435b7a9aa9f5eb5f57d3fdf0e1775de05a42c8f"
|
|
6546
|
+
},
|
|
6547
|
+
{
|
|
6548
|
+
"username": "他人1429",
|
|
6549
|
+
"passHash": "scrypt$d0ff8f7529212c5927843355c53719da$1fa2d57a5ee18124b8752222f5587a02372060f2b2b9faba6ed4ff0b77a90b0c7178f9d182dedd9c8ae300dd20ce1e5f7ec79f368ed21610f5f8756ff2d7da35",
|
|
6550
|
+
"createdAt": 1787978041467,
|
|
6551
|
+
"profile": {},
|
|
6552
|
+
"samples": [],
|
|
6553
|
+
"records": [],
|
|
6554
|
+
"token": "611138970fc695680cbaf59a4e85dc1a121c58aad81a540111b6f548eb607784"
|
|
6555
|
+
},
|
|
6556
|
+
{
|
|
6557
|
+
"username": "登鉴1475",
|
|
6558
|
+
"passHash": "scrypt$faf0d6d072301c2442a54f390f47e6f3$6f5727c69f5164d10607626e7197c4a0532945f9f881a7f9d8526188b106836c274d1e9d0552d4d8b4ae3c2627014fdc7423ee99a81bb61049845ab6e96d8738",
|
|
6559
|
+
"createdAt": 1787978041510,
|
|
6560
|
+
"profile": {},
|
|
6561
|
+
"samples": [],
|
|
6562
|
+
"records": [],
|
|
6563
|
+
"token": "c315d05d8d733976a00e43a89b62fc324251051badbb2ab7921b14f168bc2fe8"
|
|
6564
|
+
},
|
|
6565
|
+
{
|
|
6566
|
+
"username": "占位1550",
|
|
6567
|
+
"passHash": "scrypt$95a6313661da39b23785cc467c9e6acc$d40d094d3f0c92b9d3382640fcc073163aa45aaaaa13dc3adc8379e25239e4aae0ff4a8f85c4115e8ad50e72fff0a317aaeb648c8e5b5fff76b93a08e5f8b38d",
|
|
6568
|
+
"createdAt": 1787978041553,
|
|
6569
|
+
"profile": {},
|
|
6570
|
+
"samples": [],
|
|
6571
|
+
"records": [],
|
|
6572
|
+
"token": "0ad1e0459861b10d3c123ff5e8738ab688b31c258b418f19a11ed55ccc83b365"
|
|
6573
|
+
},
|
|
6574
|
+
{
|
|
6575
|
+
"username": "甲1644",
|
|
6576
|
+
"passHash": "scrypt$b2815193a5c0e718566dabbb6beb7387$3663b9efe26b1e02eac7b5130920f6709847853d06b80857ff09205b9757d1ce9534d8da5bd440763f45c16cbdd1078099c8f76e9e6672fd039b35936cb813d3",
|
|
6577
|
+
"createdAt": 1787978041683,
|
|
6578
|
+
"profile": {},
|
|
6579
|
+
"samples": [],
|
|
6580
|
+
"records": [],
|
|
6581
|
+
"token": "586d4a39d7b0cd5d4a4196ccacf8225459e94c9b07947988640e41ebfb0fe390"
|
|
6582
|
+
},
|
|
6583
|
+
{
|
|
6584
|
+
"username": "乙1644",
|
|
6585
|
+
"passHash": "scrypt$f22718cad108fe66f6c2e822a15d80b2$833ac84622054781111427dff13b732a5fb2f68f01fa95d7176ac3d6c168bd4a314e566e232b6481fa77e431e6feae1f0878ebfe909a0c062429247fb6e9ee49",
|
|
6586
|
+
"createdAt": 1787978041733,
|
|
6587
|
+
"profile": {},
|
|
6588
|
+
"samples": [],
|
|
6589
|
+
"records": [],
|
|
6590
|
+
"token": "957487f61daf7c8a30abe1a6d8c7f18615a60ad1f482b41603a847bf4aa02af8"
|
|
6435
6591
|
}
|
|
6436
6592
|
]
|
|
6437
6593
|
}
|
|
Binary file
|
|
@@ -79,6 +79,14 @@ function hourUnknownNote(profile?: unknown): string {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// 命主已知人生经历 → 解读校准注入(报告须呼应该年份事件、不得与其矛盾)
|
|
82
|
+
// 当前公历时间事实:注入给 AI,防止其自行推算年份(占问类无出生档案,AI 不知道"现在是哪年")
|
|
83
|
+
function nowFact(): string {
|
|
84
|
+
const d = new Date();
|
|
85
|
+
const p = (n: number) => String(n).padStart(2, '0');
|
|
86
|
+
const week = '日一二三四五六'[d.getDay()];
|
|
87
|
+
return '【当前时间 · 事实】现在是公历 ' + d.getFullYear() + ' 年 ' + (d.getMonth() + 1) + ' 月 ' + d.getDate() + ' 日 ' + p(d.getHours()) + ':' + p(d.getMinutes()) + '(星期' + week + ')。\n凡涉及年份/日期/时令的表述(如"今年""去年""明年""当下节令"),必须以此为准,不得自行推算或编造年份。';
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
function lifeEventsNote(profile?: unknown): string {
|
|
83
91
|
const evs: { year: number; text: string }[] = (profile as any)?.lifeEvents;
|
|
84
92
|
if (!Array.isArray(evs) || evs.length === 0) return '';
|
|
@@ -166,6 +174,8 @@ export function buildReportMessages(
|
|
|
166
174
|
'【盘面事实(以下为不可更改的排盘结果,解读必须逐字引用、不得编造)】',
|
|
167
175
|
chartBrief(artId, resultRaw),
|
|
168
176
|
'',
|
|
177
|
+
nowFact(),
|
|
178
|
+
'',
|
|
169
179
|
lifeEventsNote(profile),
|
|
170
180
|
'',
|
|
171
181
|
semantic ? '【问题语义分析】' + JSON.stringify(semantic, null, 1) : '',
|
|
@@ -213,6 +223,8 @@ export function buildStep1Messages(
|
|
|
213
223
|
'【盘面事实】',
|
|
214
224
|
chartBrief(artId, resultRaw),
|
|
215
225
|
'',
|
|
226
|
+
nowFact(),
|
|
227
|
+
'',
|
|
216
228
|
'请输出盘面解析 json。',
|
|
217
229
|
].filter(Boolean).join('\n');
|
|
218
230
|
return [
|