Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(document-reader): add Notion document reader support #274 #345

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brianxiadong
Copy link
Contributor

Add Notion Document Reader Support

添加 Notion 文档读取器支持

Features 功能特性

  • Add NotionResource to handle Notion API interactions
    添加 NotionResource 类处理 Notion API 交互
  • Add NotionDocumentReader implementing DocumentReader interface
    添加 NotionDocumentReader 实现 DocumentReader 接口
  • Support both Notion pages and databases content types
    支持 Notion 页面和数据库两种内容类型
  • Add comprehensive metadata extraction
    添加完整的元数据提取功能
  • Add integration tests with environment variables
    添加基于环境变量的集成测试

Implementation Details 实现细节

  1. NotionResource

    • Handle authentication with Notion API
      处理 Notion API 认证
    • Support page and database content fetching
      支持页面和数据库内容获取
    • Extract metadata from API response
      从 API 响应中提取元数据
  2. NotionDocumentReader

    • Implement Spring AI's DocumentReader interface
      实现 Spring AI 的 DocumentReader 接口
    • Convert Notion content to Document format
      将 Notion 内容转换为 Document 格式
    • Handle metadata safely with null checks
      安全处理元数据,包含空值检查
  3. Integration Tests

    • Test both page and database reading
      测试页面和数据库的读取功能
    • Verify metadata extraction
      验证元数据提取
    • Use environment variables for credentials
      使用环境变量存储凭证

Usage 使用方法

- Add NotionResource class to handle Notion API interactions
- Add NotionDocumentReader to implement DocumentReader interface
- Support both page and database content types
- Add comprehensive metadata handling
- Add integration tests

Key features:
1. Support reading Notion pages and databases
2. Extract rich metadata (creation time, authors, etc.)
3. Handle null values safely in metadata
4. Follow Spring AI document reader patterns
5. Add proper error handling and logging

Related PR: #alibaba#274
@brianxiadong brianxiadong changed the title feat(document-reader): add Notion document reader support feat(document-reader): add Notion document reader support #274 Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant