feat(resource): 支持飞书用户 token 导入#2549
Open
qin-ctx wants to merge 1 commit into
Open
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
本 PR 为
add_resource增加通用args透传能力,并在飞书/Lark 文档导入中支持通过args.feishu_access_token进行一次性用户 token 导入。默认 app_id/app_secret 自动获取 tenant token 的行为保持不变。Related Issue
无
Type of Change
Changes Made
add_resource增加args参数透传。ResourceService中统一校验 parser-specific args,拒绝核心 add_resource 字段覆盖,并限制feishu_access_token只能用于一次性导入,不能与watch_interval > 0组合。feishu_access_token时使用 Lark SDKRequestOption.user_access_token访问 wiki/docx API,同时保持默认应用凭证 tenant token 流程不变。Testing
测试命令:
.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_resourceChecklist
Screenshots (if applicable)
不适用
Additional Notes
本期不保存、不刷新 Feishu 用户 token;因此通过
args.feishu_access_token导入时会拒绝 watch。后续如需定时更新,需要另行设计由上层应用管理 token 生命周期的方案。