Skip to content

feat(resource): 支持飞书用户 token 导入#2549

Open
qin-ctx wants to merge 1 commit into
mainfrom
feat/feishu-access-token-args
Open

feat(resource): 支持飞书用户 token 导入#2549
qin-ctx wants to merge 1 commit into
mainfrom
feat/feishu-access-token-args

Conversation

@qin-ctx

@qin-ctx qin-ctx commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Description

本 PR 为 add_resource 增加通用 args 透传能力,并在飞书/Lark 文档导入中支持通过 args.feishu_access_token 进行一次性用户 token 导入。默认 app_id/app_secret 自动获取 tenant token 的行为保持不变。

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • 为 REST、MCP、Python SDK、HTTP client、本地 client 和 Rust CLI 的 add_resource 增加 args 参数透传。
  • ResourceService 中统一校验 parser-specific args,拒绝核心 add_resource 字段覆盖,并限制 feishu_access_token 只能用于一次性导入,不能与 watch_interval > 0 组合。
  • 更新 FeishuAccessor,在传入 feishu_access_token 时使用 Lark SDK RequestOption.user_access_token 访问 wiki/docx API,同时保持默认应用凭证 tenant token 流程不变。
  • 补充中英文资源 API/MCP 文档和相关单元测试。

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

测试命令:

.venv/bin/ruff check openviking/service/resource_service.py openviking/server/routers/resources.py openviking/server/mcp_endpoint.py openviking/parse/accessors/feishu_accessor.py openviking_cli/client/base.py openviking_cli/client/http.py openviking_cli/client/sync_http.py openviking/async_client.py openviking/sync_client.py openviking/client/local.py tests/service/test_resource_service_watch.py tests/parse/test_feishu_accessor.py tests/client/test_http_client_local_upload.py tests/server/test_api_resources.py
.venv/bin/python -m pytest --no-cov tests/parse/test_feishu_accessor.py tests/service/test_resource_service_watch.py::TestAddResourceArgs tests/client/test_http_client_local_upload.py::test_add_resource_forwards_args_for_remote_url tests/server/test_api_resources.py::test_add_resource_forwards_args_to_service -q
cargo test -p ov_cli add_resource

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

不适用

Additional Notes

本期不保存、不刷新 Feishu 用户 token;因此通过 args.feishu_access_token 导入时会拒绝 watch。后续如需定时更新,需要另行设计由上层应用管理 token 生命周期的方案。

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🏅 Score: 90
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant