星盘解释库接口说明
POST https://chart.12sign.top/interpretation
概述
星盘解释库接口允许您直接查询星盘解释语料,无需计算完整的星盘。支持单个查询和批量查询,可以按语料集和星盘类型进行过滤。
重要说明: 本接口专门用于查询解释语料库,与星盘计算接口分离。如果您需要在星盘计算结果中自动包含解释,请使用 /onechart 接口并设置 include_analysis: true。
请求参数
| 参数名 |
类型 |
必需 |
说明 |
chartType |
string |
必需 |
星盘类型,如 "natal"、"solar_return" 等 |
fallInto |
object |
必需 |
查询条件对象,包含以下字段: |
fallInto.type |
integer |
必需 |
语料类型:
1 = 行星解释
4 = 行星落宫解释
5 = 行星落座解释
6 = 行星相位解释
7 = 宫头落入星座解释
8 = 宫主飞星解释
|
fallInto.planet_id |
integer/string |
条件必需 |
行星ID(type=1,4,5,6,8时需要)。type=8时使用字符串格式 "hr1"~"hr12",代表第1~12宫的宫主星 |
fallInto.planet_id2 |
integer |
条件必需 |
第二个行星ID(仅type=6时需要) |
fallInto.sign_id |
integer |
条件必需 |
星座ID(type=5,7时需要) |
fallInto.house_id |
integer |
条件必需 |
宫位ID(type=4,7,8时需要)。type=8时代表宫主星实际落入的宫位 |
fallInto.degree |
integer |
条件必需 |
相位度数(仅type=6时需要) |
corpusSets |
array |
可选 |
语料集名称列表,用于过滤查询结果。 |
returnAll |
boolean |
可选 |
是否返回所有匹配的语料集结果,默认为 false |
请求格式
单个查询格式
{
"chartType": "natal",
"fallInto": {
"type": 5,
"planet_id": 0,
"sign_id": 1
},
"corpusSets": ["default"]
}
批量查询格式
[
{
"chartType": "natal",
"fallInto": {
"type": 5,
"planet_id": 0,
"sign_id": 1
}
},
{
"chartType": "natal",
"fallInto": {
"type": 6,
"planet_id1": 0,
"planet_id2": 1,
"degree": 180
}
}
]
返回参数
| 参数名 |
类型 |
说明 |
success |
boolean |
请求是否成功 |
data |
object/array |
解释数据对象(单个查询)或数组(批量查询) |
data.type |
integer |
语料类型 |
data.content |
string |
解释文本内容 |
data.corpus_set |
string |
语料集名称 |
data.chart_type |
string |
星盘类型 |
total |
integer |
批量查询时的总请求数 |
found |
integer |
批量查询时找到的结果数 |
error |
string |
错误信息(仅在失败时返回) |
code |
string |
错误代码(仅在失败时返回) |
返回示例
单个查询成功响应
{
"success": true,
"data": {
"type": 5,
"content": "太阳落在白羊座,象征着新的开始和充满活力的能量...",
"corpus_set": "default",
"chart_type": "natal"
}
}
批量查询成功响应
{
"success": true,
"data": [
{
"type": 5,
"content": "太阳落在白羊座,象征着新的开始和充满活力的能量...",
"corpus_set": "default",
"chart_type": "natal"
},
{
"type": 6,
"content": "太阳与月亮对分相位,代表着意识与情感的冲突...",
"corpus_set": "default",
"chart_type": "natal"
}
],
"total": 2,
"found": 2
}
错误响应示例
{
"success": false,
"error": "未找到匹配的解释语料",
"code": "NOT_FOUND"
}
行星ID对照表
| ID |
行星名称 |
ID |
行星名称 |
ID |
行星名称 |
| 0 | 太阳 |
1 | 月亮 |
2 | 水星 |
| 3 | 金星 |
4 | 火星 |
5 | 木星 |
| 6 | 土星 |
7 | 天王星 |
8 | 海王星 |
| 9 | 冥王星 |
10 | 北交点 |
11 | 真实北交点 |
| 12 | 平均莉莉丝 |
13 | 真实莉莉丝 |
15 | 凯龙星 |
| 16 | 福勒斯 |
17 | 谷神星 |
18 | 智神星 |
| 19 | 婚神星 |
20 | 灶神星 |
100 | 上升点 |
注意: 更多行星ID请参考完整的星盘系统文档。特殊点如上升点(100)、天顶(101)、福点(109)等也支持查询。
星座ID对照表
| ID |
星座名称 |
ID |
星座名称 |
ID |
星座名称 |
| 1 | 白羊座 |
2 | 金牛座 |
3 | 双子座 |
| 4 | 巨蟹座 |
5 | 狮子座 |
6 | 处女座 |
| 7 | 天秤座 |
8 | 天蝎座 |
9 | 射手座 |
| 10 | 摩羯座 |
11 | 水瓶座 |
12 | 双鱼座 |
常见查询示例
1. 查询行星解释
// 查询太阳解释
{
"chartType": "natal",
"fallInto": {
"type": 1,
"planet_id": 0
},
"corpusSets": ["default"]
}
2. 查询行星落座解释
// 查询太阳落在白羊座
{
"chartType": "natal",
"fallInto": {
"type": 5,
"planet_id": 0,
"sign_id": 1
},
"corpusSets": ["default"]
}
3. 查询行星落宫解释
// 查询月亮落在一宫
{
"chartType": "natal",
"fallInto": {
"type": 4,
"planet_id": 1,
"house_id": 1
},
"corpusSets": ["default"]
}
4. 查询行星相位解释
// 查询太阳合月亮
{
"chartType": "natal",
"fallInto": {
"type": 6,
"planet_id1": 0,
"planet_id2": 1,
"degree": 0
},
"corpusSets": ["default"]
}
5. 查询宫头落入星座解释
// 查询第一宫宫头落在天秤座
{
"chartType": "natal",
"fallInto": {
"type": 7,
"house_id": 1,
"sign_id": 7
},
"corpusSets": ["default"]
}
6. 查询宫主飞星解释
// 查询第一宫宫主星落入第八宫
{
"chartType": "natal",
"fallInto": {
"type": 8,
"planet_id": "hr1",
"house_id": 8
},
"corpusSets": ["default"]
}
Python 测试代码
import requests
import json
# 单个查询示例
def query_single_interpretation():
url = "https://chart.12sign.top/interpretation"
payload = {
"chartType": "natal",
"fallInto": {
"type": 5,
"planet_id": 0,
"sign_id": 1
},
"corpusSets": ["default"]
}
response = requests.post(url, json=payload)
result = response.json()
if result.get("success"):
print("解释内容:", result["data"]["content"])
else:
print("查询失败:", result.get("error"))
# 批量查询示例
def query_batch_interpretations():
url = "https://chart.12sign.top/interpretation"
payload = [
{
"chartType": "natal",
"fallInto": {
"type": 5,
"planet_id": 0,
"sign_id": 1
}
},
{
"chartType": "natal",
"fallInto": {
"type": 6,
"planet_id1": 0,
"planet_id2": 1,
"degree": 180
}
}
]
response = requests.post(url, json=payload)
result = response.json()
if result.get("success"):
print(f"找到 {result['found']} 个解释:")
for i, interp in enumerate(result["data"], 1):
print(f"{i}. {interp.get('content', '无内容')}")
else:
print("批量查询失败:", result.get("error"))
if __name__ == "__main__":
query_single_interpretation()
print("-" * 50)
query_batch_interpretations()
在线测试
重要提醒:
- 使用
corpusSets 参数指定语料集名称
- 不同星盘类型的解释语料不混用,请确保
chartType 与您的需求匹配
- 相位查询时,
degree 使用标准相位度数(0=合相, 60=六分相, 90=四分相, 120=三分相, 180=对分相)
- 批量查询可以提高效率,但请注意每个查询都会消耗资源