Repository navigation
feat(skills): batch import endpoint for the directory picker - #10
Conversation
Selecting several sub-skills in the directory-of-skills picker previously fired
N sequential client import requests. With unauthenticated/throttled GitHub, one
skill's many file downloads could run ~20s, long enough that the browser dropped
the connection mid-import (server saw "context canceled" → 500) and the skill
was lost.
Add POST /api/skills/import/batch: one request carrying the selected URLs; the
server imports them with bounded concurrency (4) + a single fetch retry, and
returns a per-URL result plus created/skipped/failed counts. on_conflict
defaults to "skip" so one pre-existing skill never fails the rest ("fail" is
rejected as meaningless for a set).
Refactors the create/conflict tail of a single import into returning helpers
(importOneImportedSkill / resolveImportConflictResult) that the batch aggregates,
leaving the existing single-import write path untouched.
Frontend: api.importSkillsBatch; the picker's "Import selected" now makes one
batch call and reports created/skipped/failed. i18n en/zh/ja/ko.
Verified end-to-end in a browser: picked 3 lark skills (base/calendar/doc) →
one batch request → all three landed with content (13565/7001/6769 bytes,
25/10/18 files). The previously-failing lark-calendar now imports cleanly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYStwEXJFCJLokYqKVUBUg
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
Walkthrough新增技能批量导入能力:服务端提供并发批量接口及冲突策略,客户端增加类型与调用方法,导入对话框根据汇总结果展示成功、跳过和失败提示。 Changes技能批量导入
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant 用户
participant CreateSkillDialog
participant ApiClient
participant ImportSkillsBatch
participant SkillImportPipeline
用户->>CreateSkillDialog: 选择候选技能并导入
CreateSkillDialog->>ApiClient: 调用 importSkillsBatch
ApiClient->>ImportSkillsBatch: POST 批量 URL 与冲突策略
ImportSkillsBatch->>SkillImportPipeline: 并发导入各 URL
SkillImportPipeline-->>ImportSkillsBatch: 返回逐项状态
ImportSkillsBatch-->>ApiClient: 返回 results 与 created/skipped/failed
ApiClient-->>CreateSkillDialog: 返回批量结果
CreateSkillDialog-->>用户: 显示导入、失败或全部跳过提示
Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Selecting several sub-skills in the directory-of-skills picker previously fired
N sequential client import requests. With unauthenticated/throttled GitHub, one
skill's many file downloads could run ~20s, long enough that the browser dropped
the connection mid-import (server saw "context canceled" → 500) and the skill
was lost.
Add POST /api/skills/import/batch: one request carrying the selected URLs; the
server imports them with bounded concurrency (4) + a single fetch retry, and
returns a per-URL result plus created/skipped/failed counts. on_conflict
defaults to "skip" so one pre-existing skill never fails the rest ("fail" is
rejected as meaningless for a set).
Refactors the create/conflict tail of a single import into returning helpers
(importOneImportedSkill / resolveImportConflictResult) that the batch aggregates,
leaving the existing single-import write path untouched.
Frontend: api.importSkillsBatch; the picker's "Import selected" now makes one
batch call and reports created/skipped/failed. i18n en/zh/ja/ko.
Verified end-to-end in a browser: picked 3 lark skills (base/calendar/doc) →
one batch request → all three landed with content (13565/7001/6769 bytes,
25/10/18 files). The previously-failing lark-calendar now imports cleanly.
Claude-Session: https://claude.ai/code/session_01NYStwEXJFCJLokYqKVUBUg
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Why
Selecting several sub-skills in the directory-of-skills picker (#9) fired N sequential client import requests. Against throttled GitHub, one skill's many file downloads could take ~20s — long enough that the browser dropped the connection mid-import (server saw
context canceled→ 500) and that skill was lost.What
POST /api/skills/import/batch: one request carrying the selected URLs. The server imports them with bounded concurrency (4) + a single fetch retry, returning a per-URL result pluscreated/skipped/failedcounts.on_conflictdefaults toskipso one already-existing skill never fails the rest;failis rejected (meaningless for a set).importOneImportedSkill/resolveImportConflictResult) the batch aggregates — the existing single-import write path is untouched.Frontend:
api.importSkillsBatch; the picker's Import selected makes one batch call and reports created/skipped/failed. i18n en/zh/ja/ko.Verified end-to-end (real browser + real GitHub)
Picked 3 lark skills (base/calendar/doc) → one batch request → all landed with content: 13565 / 7001 / 6769 bytes, 25 / 10 / 18 files.
lark-calendar, which previouslycontext canceled-500'd on the sequential path, now imports cleanly. Alsogo build/vet,dedupeNonEmptyunit test, core+views typecheck, full views vitest (2914, incl. locale parity).🤖 Generated with Claude Code
Summary by CodeRabbit
新功能
体验优化