- 后端: coworker 智能体框架, WS API, 文件上传, 附件处理 - 前端: Open WebUI, 文件全量走 upload API (含 MD/TXT/JSON 等文本类) - 技能: md-to-office (pandoc + wkhtmltopdf) - 修复: 上传文件路径丢失, Agent 搜索浪费, 输出文件跑到 uploads/ - 打包: PyInstaller one-dir, 预打包 pandoc/wkhtmltopdf/chromium
29 lines
931 B
Python
29 lines
931 B
Python
"""Agent registry — resolves a persona id to its runtime Agent.
|
|
|
|
Delegates to the persona registry (``coworker.personas``) so built-in surfaces and
|
|
markdown/third-party personas resolve through one path. MyHelper is a legacy personal-helper
|
|
persona resolved directly (kept for sessions that still reference it).
|
|
Imports of the persona registry are lazy to avoid an import cycle (personas → agents builders).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .base import Agent
|
|
from .myhelper import myhelper_agent
|
|
|
|
|
|
def get_agent(name: str) -> Agent:
|
|
name = name or "code"
|
|
if name == "myhelper":
|
|
return myhelper_agent()
|
|
from ..personas.registry import get_registry
|
|
|
|
return get_registry().agent(name)
|
|
|
|
|
|
def list_agents() -> list[dict]:
|
|
# Session surfaces shown in the new-session picker (enabled + surfaced personas).
|
|
from ..personas.registry import get_registry
|
|
|
|
return get_registry().sidebar()
|