feat: 知识库文件夹/模板、技能压缩设置与摘要窗口调优

- 知识库新增文件夹与模板支持(模型/仓储/服务/迁移),前端知识管理组件
- 岗位管理模型与接口完善
- 技能新增压缩设置页与相关存储/工具能力
- 系统设置扩展配置项
- 摘要中间件 keep 窗口改用 token 预算(16000),减少重复压缩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Opus 4.8 committed 2026-06-16 15:23:54 +08:00
1 parent e6662cf673
commit 5ebbb82d66
54 files changed
+2658 -100

No files matched your search

@@ -110,6 +110,10 @@ class PositionUsersResponse(BaseModel):
users: list[PositionUserResponse]
class MyPositionResponse(BaseModel):
position: PositionResponse | None = None
# ----------------------------------------------------------------- position CRUD
@@ -127,6 +131,28 @@ async def list_position_users(request: Request, store: PositionStore = Depends(g
return PositionUsersResponse(users=[PositionUserResponse(**u) for u in users])
@router.get("/me", response_model=MyPositionResponse, summary="Get My Effective Position")
async def get_my_position(request: Request, store: PositionStore = Depends(get_position_store)) -> MyPositionResponse:
"""The caller's own position — open to any authenticated user (not admin).
Returns the explicitly-assigned position, falling back to the default
position (which unassigned users inherit). ``null`` when neither exists or
the caller is anonymous. Powers the top-bar 岗位 label.
"""
user = await get_optional_user_from_request(request)
if user is None:
return MyPositionResponse(position=None)
record = None
pid = await store.get_user_position_id(str(user.id))
if pid:
record = await store.get_position(pid)
if record is None:
default_id = await store.get_default_position_id()
if default_id:
record = await store.get_position(default_id)
return MyPositionResponse(position=PositionResponse(**record) if record else None)
@router.post("", response_model=PositionResponse, status_code=201, summary="Create Position")
async def create_position(request: Request, body: PositionCreateRequest, store: PositionStore = Depends(get_position_store)) -> PositionResponse:
await _require_admin(request)