guanwei 1.2.4 → 1.2.6
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 +312 -0
- package/server/src/data/guanwei.db +0 -0
- package/server/src/routes/ai.ts +3 -1
- package/server/src/services/promptBuilder.ts +17 -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,318 @@
|
|
|
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"
|
|
6591
|
+
},
|
|
6592
|
+
{
|
|
6593
|
+
"username": "联调6337",
|
|
6594
|
+
"passHash": "scrypt$fcef8e2d049d828cab00f5b1b9cf053c$b20f9074d8ed06dd77e5deb3e9d1c28e4c26723b05ca6187a77291b9d9038517ee6e631793e58a0ccf8e0aef376c2c8ef02b04129cb8894e254fc0f096336e53",
|
|
6595
|
+
"createdAt": 1787978356427,
|
|
6596
|
+
"profile": {
|
|
6597
|
+
"birthDate": "1996-09-09",
|
|
6598
|
+
"birthHourIndex": 5,
|
|
6599
|
+
"gender": "男",
|
|
6600
|
+
"location": null
|
|
6601
|
+
},
|
|
6602
|
+
"samples": [],
|
|
6603
|
+
"records": [
|
|
6604
|
+
{
|
|
6605
|
+
"artId": "bazi",
|
|
6606
|
+
"createdAt": 1,
|
|
6607
|
+
"result": {
|
|
6608
|
+
"dayGZ": "壬申"
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
],
|
|
6612
|
+
"token": "15fe37911eb72bdd3413a2b7d53d76b2bfca8a291bc86e30e585039afbc3e41f"
|
|
6613
|
+
},
|
|
6614
|
+
{
|
|
6615
|
+
"username": "鉴权6593",
|
|
6616
|
+
"passHash": "scrypt$d4b72586266f6cdfdcc3d3df931237cb$266366a33eb554b0a7de60ec40e789ab79c1fc56c1ac527433fe5fc011636835c195b28455c20dcd093f4b3303acb27b0725b2d6d72c29b269b219123e4d657e",
|
|
6617
|
+
"createdAt": 1787978356640,
|
|
6618
|
+
"profile": {
|
|
6619
|
+
"birthDate": "1999-01-01"
|
|
6620
|
+
},
|
|
6621
|
+
"samples": [],
|
|
6622
|
+
"records": [],
|
|
6623
|
+
"token": "c231ef749f16bbbc7a0151c9f8e8dbc86186b5753da5f8995eee3a7e380c2481"
|
|
6624
|
+
},
|
|
6625
|
+
{
|
|
6626
|
+
"username": "他人6686",
|
|
6627
|
+
"passHash": "scrypt$e5470b328196d5d1415ee56400bac2f0$a576a32b0b6b291d86cc0bc3a83a19f37e97486b115377b73151b8fffc729876a07c007926d03c639ebcea658b884f90a3158954f3b2b30605ec634bff559851",
|
|
6628
|
+
"createdAt": 1787978356737,
|
|
6629
|
+
"profile": {},
|
|
6630
|
+
"samples": [],
|
|
6631
|
+
"records": [],
|
|
6632
|
+
"token": "e7dd53f31c29fa2c30bb841869d763af228e52292953bd5abd4287d78d2d1724"
|
|
6633
|
+
},
|
|
6634
|
+
{
|
|
6635
|
+
"username": "登鉴6745",
|
|
6636
|
+
"passHash": "scrypt$4da27f576a9599933671d16b866091dc$03e88d3b0f93798d28f05cc8e0b85d8c4fe8169fdcb46568dd256cf31b0a9818774a301168003debeb510bb59c0b8fec98e6b9765e211ce5b8829545bd040fda",
|
|
6637
|
+
"createdAt": 1787978356786,
|
|
6638
|
+
"profile": {},
|
|
6639
|
+
"samples": [],
|
|
6640
|
+
"records": [],
|
|
6641
|
+
"token": "694f7a690a4d32223db3fd97c256f1470fe049df9db80173c76c3ed623ce94cd"
|
|
6642
|
+
},
|
|
6643
|
+
{
|
|
6644
|
+
"username": "占位6827",
|
|
6645
|
+
"passHash": "scrypt$80c0cefc6c6bc40375c8ff1ad3369c40$30bb233c5b96843e6e709c2646cd7d65aff34303b32d63900ad7ea8e09f89f5f2a1015341020ff8d42df7d70f384b4d8e55a4e205210d1f7cce0bfa16663b25d",
|
|
6646
|
+
"createdAt": 1787978356830,
|
|
6647
|
+
"profile": {},
|
|
6648
|
+
"samples": [],
|
|
6649
|
+
"records": [],
|
|
6650
|
+
"token": "2d0c81cada1b36571ae965d4180a662cbef68dbb57fa883013510c2eb919cd44"
|
|
6651
|
+
},
|
|
6652
|
+
{
|
|
6653
|
+
"username": "甲6931",
|
|
6654
|
+
"passHash": "scrypt$2ad4bbc5c40b6f30c63cd4d4b8ec58df$c274784703f2a487efc4e58906de2e75951f711fe31eda2debf94663ee79813c71f1204e712e057cf6c23d625af4576927ea7b9f2cfbb8624be6ac346dc88229",
|
|
6655
|
+
"createdAt": 1787978356982,
|
|
6656
|
+
"profile": {},
|
|
6657
|
+
"samples": [],
|
|
6658
|
+
"records": [],
|
|
6659
|
+
"token": "4ef92e4f752f2798fde75c28f4a0672b2d3c848daccd282dd76e0e1f63678f45"
|
|
6660
|
+
},
|
|
6661
|
+
{
|
|
6662
|
+
"username": "乙6931",
|
|
6663
|
+
"passHash": "scrypt$37e3af2e80433cf81d8a6a4d321be293$33c3f391de987f6eb956a49985becc2f64d7c0a73f6af99920261c5ffab90ef624ad61f0bd14a74ba33da3ad6f55f748580ef7730e839602a3c44f502106e88c",
|
|
6664
|
+
"createdAt": 1787978357032,
|
|
6665
|
+
"profile": {},
|
|
6666
|
+
"samples": [],
|
|
6667
|
+
"records": [],
|
|
6668
|
+
"token": "99a53431fb95f7cd5049ac926cd974145dd47d358b8d9f4aae2837940a42a9ea"
|
|
6669
|
+
},
|
|
6670
|
+
{
|
|
6671
|
+
"username": "联调0387",
|
|
6672
|
+
"passHash": "scrypt$573da827e7a7ddf9089438980d3da419$05ebb4314470f3f5951ce1e5db8b83bff360c3c40f187220c3d9786e35cc2dbd57143aedc0de6bbdfe8b98c226ab1f154f85e41dfbb7a5e08eaa02ae57f0e52a",
|
|
6673
|
+
"createdAt": 1787978370461,
|
|
6674
|
+
"profile": {
|
|
6675
|
+
"birthDate": "1996-09-09",
|
|
6676
|
+
"birthHourIndex": 5,
|
|
6677
|
+
"gender": "男",
|
|
6678
|
+
"location": null
|
|
6679
|
+
},
|
|
6680
|
+
"samples": [],
|
|
6681
|
+
"records": [
|
|
6682
|
+
{
|
|
6683
|
+
"artId": "bazi",
|
|
6684
|
+
"createdAt": 1,
|
|
6685
|
+
"result": {
|
|
6686
|
+
"dayGZ": "壬申"
|
|
6687
|
+
}
|
|
6688
|
+
}
|
|
6689
|
+
],
|
|
6690
|
+
"token": "c352a6e5cb4c3f7096d374631c687ec50257a1e82d436b684a4ce624a7650b90"
|
|
6691
|
+
},
|
|
6692
|
+
{
|
|
6693
|
+
"username": "鉴权0656",
|
|
6694
|
+
"passHash": "scrypt$bda3151120b7af6d018dc096b0c7b827$c0dc6f0db7d8d1cab6ea8ee76c22d50d8544d6f6feac721df98624da1975331673b30c5de55aa45b3f28e611ea0d202503a6ee64be40e4394abd5b2bd771e6e7",
|
|
6695
|
+
"createdAt": 1787978370697,
|
|
6696
|
+
"profile": {
|
|
6697
|
+
"birthDate": "1999-01-01"
|
|
6698
|
+
},
|
|
6699
|
+
"samples": [],
|
|
6700
|
+
"records": [],
|
|
6701
|
+
"token": "d4cae222e7c35c80801d47aec4f30bb1098b31d00ae90c7eba00f5c65d50cc70"
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
"username": "他人0721",
|
|
6705
|
+
"passHash": "scrypt$add02bd12f43f37226769736b3fe7590$0dc18e701e6158144a37d5b8fb5d1d81bcd9f51a29150190945615abae8595dd0425dc5b59a22da539dc4c33a2e8f2ff2096eacf760bc08ad921494fdf31aa61",
|
|
6706
|
+
"createdAt": 1787978370765,
|
|
6707
|
+
"profile": {},
|
|
6708
|
+
"samples": [],
|
|
6709
|
+
"records": [],
|
|
6710
|
+
"token": "fce1afbf5f36c6e6257740106e815ae5910a3ef64b89c6cdaef8e88ee1996dc6"
|
|
6711
|
+
},
|
|
6712
|
+
{
|
|
6713
|
+
"username": "登鉴0774",
|
|
6714
|
+
"passHash": "scrypt$b5a877f90ba174fad21a37f08318e07f$df91de7cc0891704ae083c502fda059977cb3c789dfff9e6d75e3089b8c04980355d2d33d44d795131b0476c0bb958fcfdfb318ea65fe2d81ab56679d4c02661",
|
|
6715
|
+
"createdAt": 1787978370819,
|
|
6716
|
+
"profile": {},
|
|
6717
|
+
"samples": [],
|
|
6718
|
+
"records": [],
|
|
6719
|
+
"token": "e5aaa3313c7f72231bf591f2cf4980829ed806d839b4a8d2118580325028a16f"
|
|
6720
|
+
},
|
|
6721
|
+
{
|
|
6722
|
+
"username": "占位0872",
|
|
6723
|
+
"passHash": "scrypt$fadf5b83732b0e4e895e1c9fdd7f66ef$b66960d25301e97b782e7754301a74233503a41eda8585688386b369fea920703cefc983873ac423a17b49cd0264ad113a0b65ef69246d4b93900060c950c3f8",
|
|
6724
|
+
"createdAt": 1787978370874,
|
|
6725
|
+
"profile": {},
|
|
6726
|
+
"samples": [],
|
|
6727
|
+
"records": [],
|
|
6728
|
+
"token": "b7098ef1f563769ca96d56ec751bcc51a98328e580cb5cf54922ef847ea68718"
|
|
6729
|
+
},
|
|
6730
|
+
{
|
|
6731
|
+
"username": "甲0985",
|
|
6732
|
+
"passHash": "scrypt$3b2d3f361dcc7eeafad57e353078ed70$8ea67dfb7fc406de4b91f2d96fe7236db06b5242b4d69098933f82edaa9e3f17b77f7948fca14a2782a8e4359a0804e55282a9836127dd145dca21d717c584db",
|
|
6733
|
+
"createdAt": 1787978371046,
|
|
6734
|
+
"profile": {},
|
|
6735
|
+
"samples": [],
|
|
6736
|
+
"records": [],
|
|
6737
|
+
"token": "10e168af504dbf81deb5516f2f1c8a08f31ad870c62985621f46055a575fc909"
|
|
6738
|
+
},
|
|
6739
|
+
{
|
|
6740
|
+
"username": "乙0985",
|
|
6741
|
+
"passHash": "scrypt$365a2bae3be185a4320f92bf6a5b4fc8$64e199092f297a2d8bc213a278b0483d7587cfe3e022ae7d4cac9985de1a25ad557390a08fed590f9feb87b599135b0e41b15cf520f3cb8ccba5d1180cb68a49",
|
|
6742
|
+
"createdAt": 1787978371091,
|
|
6743
|
+
"profile": {},
|
|
6744
|
+
"samples": [],
|
|
6745
|
+
"records": [],
|
|
6746
|
+
"token": "da86949d87c96659755e15ddc3a511b805cc89524904a3cbeaf7211f8acdc0a0"
|
|
6435
6747
|
}
|
|
6436
6748
|
]
|
|
6437
6749
|
}
|
|
Binary file
|
package/server/src/routes/ai.ts
CHANGED
|
@@ -196,10 +196,12 @@ interface RawReading { summary: string; keyPoints: string[] }
|
|
|
196
196
|
// ─── Step1 盘面解析缓存 ───
|
|
197
197
|
// 同一 divineId + 同一问题复用同一份盘面解析:多次解读的输入一致 → 输出不再互相矛盾
|
|
198
198
|
// (Step1 每次调用结果都不同是「一会严格一会宽松」的主因之一)
|
|
199
|
+
// 键含日期:prompt 注入了【当前时间 · 事实】,跨日/跨年复用会给出过期的"现在"——按天隔离
|
|
199
200
|
const step1Cache = new Map<string, string>();
|
|
200
201
|
const STEP1_CACHE_MAX = 300;
|
|
201
202
|
async function getStep1(divineId: string, artId: string, question: string, resultRaw: unknown, profile: unknown): Promise<string> {
|
|
202
|
-
const
|
|
203
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
204
|
+
const key = divineId + '|' + day + '|' + (question || '');
|
|
203
205
|
const hit = step1Cache.get(key);
|
|
204
206
|
if (hit) return hit;
|
|
205
207
|
try {
|
|
@@ -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 [
|
|
@@ -283,6 +295,8 @@ export function buildStep2Messages(
|
|
|
283
295
|
'【盘面事实(原始排盘,引用须一致)】',
|
|
284
296
|
chartBrief(artId, resultRaw),
|
|
285
297
|
'',
|
|
298
|
+
nowFact(),
|
|
299
|
+
'',
|
|
286
300
|
lifeEventsNote(profile),
|
|
287
301
|
'',
|
|
288
302
|
semantic ? '【问题语义分析】' + JSON.stringify(semantic, null, 1) : '',
|
|
@@ -305,6 +319,7 @@ function systemPrompt(artId: string): string {
|
|
|
305
319
|
'',
|
|
306
320
|
'【语言规范】现代白话,温润克制,不作绝对化断言;引经据典附出处;结尾附免责声明。',
|
|
307
321
|
'输出结构:严格输出合法 json 对象(字段名不可更改)。',
|
|
322
|
+
nowFact(),
|
|
308
323
|
'【可引古籍】' + (p?.classics || ''),
|
|
309
324
|
].join('\n');
|
|
310
325
|
}
|
|
@@ -321,6 +336,8 @@ export function buildMessages(
|
|
|
321
336
|
'【排盘结果】',
|
|
322
337
|
JSON.stringify(resultRaw, null, 1),
|
|
323
338
|
'',
|
|
339
|
+
nowFact(),
|
|
340
|
+
'',
|
|
324
341
|
semantic ? '【问题语义分析】' + JSON.stringify(semantic, null, 1) : '',
|
|
325
342
|
'',
|
|
326
343
|
'请按语言规范生成解读。',
|