fix: delete agent 500 error + dynamic personality + deployment guide
- Fix delete agent 500: clean up FK records (agent_llm_logs, permissions, schedules, executions, team_members) and unbind goals/tasks before delete - Remove hardcoded personality templates in Android, replace with dynamic system prompt generation from name + description - Set promptSectionsEnabled=false to bypass PromptComposer for personality - Add Tencent Cloud Linux deployment guide (Docker Compose) - Accumulated backend service updates, frontend UI fixes, Android app changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,33 +65,63 @@ aiagent/
|
||||
|
||||
```
|
||||
backend/app/
|
||||
├── main.py # FastAPI 应用入口
|
||||
├── config.py # 配置管理(读取 .env)
|
||||
├── main.py # FastAPI 应用入口,路由注册,中间件配置
|
||||
├── core/
|
||||
│ ├── config.py # 配置管理(读取 .env)
|
||||
│ ├── database.py # 数据库连接、会话管理、init_db()
|
||||
│ ├── security.py # JWT 认证、密码加密
|
||||
│ ├── celery_app.py # Celery 异步任务配置
|
||||
│ ├── database.py # 数据库连接与会话管理
|
||||
│ └── exceptions.py # 全局异常处理
|
||||
├── modules/
|
||||
│ ├── user/ # 用户模块(注册、登录、个人信息)
|
||||
│ ├── agent/ # 智能体模块
|
||||
│ ├── knowledge/ # 知识库模块
|
||||
│ └── conversation/ # 对话模块
|
||||
├── models/ # SQLAlchemy ORM 模型
|
||||
│ ├── user.py
|
||||
│ ├── agent.py
|
||||
│ └── knowledge.py
|
||||
├── schemas/ # Pydantic 请求/响应模型
|
||||
│ ├── exceptions.py # 全局异常处理(BaseAPIException)
|
||||
│ ├── error_handler.py # 异常 → HTTP 响应映射
|
||||
│ ├── rate_limiter.py # Redis 滑动窗口限流中间件
|
||||
│ ├── security_headers.py# HSTS/安全头中间件
|
||||
│ ├── behavior_middleware.py # 用户行为采集中间件
|
||||
│ └── metrics.py # Prometheus 指标暴露
|
||||
├── api/ # API 路由(45 个模块,245+ 端点)
|
||||
│ ├── agents.py # Agent CRUD/执行/导入导出
|
||||
│ ├── agent_chat.py # 对话/SSE 流式/编排
|
||||
│ ├── agent_market.py # Agent 技能市场
|
||||
│ ├── agent_swarm.py # Agent 蜂群
|
||||
│ ├── workflows.py # 工作流 CRUD/执行/版本
|
||||
│ ├── knowledge_base.py # 知识库/文档/搜索/RAG
|
||||
│ ├── tools.py # 工具管理
|
||||
│ ├── scene_contracts.py # 统一 DSL 场景契约
|
||||
│ ├── template_market.py # 工作流模板市场
|
||||
│ ├── platform_templates.py # 场景模板一键创建
|
||||
│ ├── plugins.py # 插件系统
|
||||
│ ├── alert_rules.py # 告警规则
|
||||
│ ├── monitoring.py # 系统监控
|
||||
│ ├── feishu_bind.py # 飞书集成
|
||||
│ ├── auth.py # 认证(注册/登录/JWT)
|
||||
│ ├── workspaces.py # 多租户工作区
|
||||
│ ├── push.py # 浏览器推送通知
|
||||
│ ├── fcm.py # Firebase Cloud Messaging
|
||||
│ ├── voice.py # 语音/TTS
|
||||
│ ├── uploads.py # 文件上传
|
||||
│ └── ... # 更多 API 模块
|
||||
├── models/ # SQLAlchemy ORM 模型(37 个文件,50+ 张表)
|
||||
│ ├── agent.py # Agent, GlobalKnowledge, KnowledgeEntity, etc.
|
||||
│ ├── workflow.py # Workflow
|
||||
│ ├── workflow_version.py# WorkflowVersion
|
||||
│ ├── workflow_template.py # WorkflowTemplate, TemplateRating, TemplateFavorite
|
||||
│ ├── execution.py # Execution
|
||||
│ ├── execution_log.py # ExecutionLog
|
||||
│ ├── agent_llm_log.py # AgentLLMLog(LLM 调用日志)
|
||||
│ ├── agent_vector_memory.py # AgentVectorMemory(向量记忆)
|
||||
│ ├── knowledge_base.py # KnowledgeBase, Document, DocumentChunk
|
||||
│ ├── node_template.py # NodeTemplate(提示词模板)
|
||||
│ ├── scene_contract.py # SceneContract(统一 DSL 契约)
|
||||
│ ├── alert_rule.py # AlertRule, AlertLog
|
||||
│ ├── plugin.py # NodePlugin
|
||||
│ ├── workspace.py # Workspace, WorkspaceMembership
|
||||
│ └── ...
|
||||
├── api/ # API 路由
|
||||
│ ├── v1/ # API v1 路由
|
||||
│ │ ├── users.py
|
||||
│ │ ├── agents.py
|
||||
│ │ └── ...
|
||||
│ └── deps.py # 依赖注入(当前用户等)
|
||||
└── services/ # 业务逻辑层
|
||||
├── user_service.py
|
||||
└── agent_service.py
|
||||
├── services/ # 业务逻辑层
|
||||
│ ├── scene_templates.py # 11 个场景模板注册 + prompt 生成
|
||||
│ ├── scene_contract_service.py # DSL 契约服务(prompt/验收/验证)
|
||||
│ ├── workflow_validator.py # 工作流 DAG 验证
|
||||
│ ├── permission_service.py # 权限检查
|
||||
│ └── ...
|
||||
├── tests/ # 测试用例(148+ tests)
|
||||
└── alembic/ # 数据库迁移版本
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user