50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
/**
|
||
* Notion → persona-brain-db 数据导出工具
|
||
* Phase 2/3 启用
|
||
*
|
||
* 用法:NOTION_TOKEN=xxx node export-from-notion.js
|
||
*
|
||
* 功能:通过Notion API批量导出人格体数据,
|
||
* 转换为persona-brain-db的JSON格式
|
||
*/
|
||
|
||
const axios = require('axios');
|
||
|
||
const NOTION_API = 'https://api.notion.com/v1';
|
||
const NOTION_VERSION = '2022-06-28';
|
||
|
||
async function queryDatabase(databaseId, token) {
|
||
const response = await axios.post(
|
||
`${NOTION_API}/databases/${databaseId}/query`,
|
||
{},
|
||
{
|
||
headers: {
|
||
'Authorization': `Bearer ${token}`,
|
||
'Notion-Version': NOTION_VERSION,
|
||
'Content-Type': 'application/json'
|
||
}
|
||
}
|
||
);
|
||
return response.data.results;
|
||
}
|
||
|
||
async function main() {
|
||
const token = process.env.NOTION_TOKEN;
|
||
if (!token) {
|
||
console.error('❌ 请设置环境变量 NOTION_TOKEN');
|
||
process.exit(1);
|
||
}
|
||
|
||
console.log('📥 Notion → persona-brain-db 数据导出');
|
||
console.log('⚠️ Phase 2/3 功能,当前为占位脚本');
|
||
console.log(' 需要配置对应的Notion数据库ID后启用');
|
||
|
||
// Phase 2/3 实现:
|
||
// 1. 查询Notion人格体Profile数据库 → persona-identity.json
|
||
// 2. 查询Notion规则数据库 → persona-cognition.json
|
||
// 3. 查询Notion开发者画像库 → dev-profiles.json
|
||
// 4. 查询Notion核心大脑记忆 → persona-memory.json
|
||
}
|
||
|
||
main().catch(console.error);
|