feat(saas): industry agent template assignment system
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

Phase 1-8 of industry-agent-delivery plan:

- DB migration: accounts.assigned_template_id (ON DELETE SET NULL)
- SaaS API: 4 new endpoints (assign/get/unassign/create-agent)
- Service layer: assign_template_to_account, get_assigned_template, unassign_template, create_agent_from_template)
- Types: AssignTemplateRequest, AgentConfigFromTemplate (capabilities merged into tools)
- Frontend SaaS Client: assignTemplate, getAssignedTemplate, unassignTemplate, createAgentFromTemplate
- saasStore: assignedTemplate state + login auto-fetch + actions
- saas-relay-client: fix unused import and saasUrl reference error
- connectionStore: fix relayModel undefined error
- capabilities default to glm-4-flash

- Route registration: new template assignment routes

Cospec and handlers consolidated

Build: cargo check --workspace PASS, tsc --noEmit Pass
This commit is contained in:
iven
2026-04-03 13:31:58 +08:00
parent 5b1b747810
commit ea00c32c08
10 changed files with 618 additions and 16 deletions

View File

@@ -10,10 +10,16 @@ use crate::state::AppState;
/// Agent 模板管理路由 (需要认证)
pub fn routes() -> axum::Router<AppState> {
axum::Router::new()
// Template CRUD
.route("/api/v1/agent-templates", get(handlers::list_templates).post(handlers::create_template))
.route("/api/v1/agent-templates/available", get(handlers::list_available))
.route("/api/v1/agent-templates/:id", get(handlers::get_template))
.route("/api/v1/agent-templates/:id", post(handlers::update_template))
.route("/api/v1/agent-templates/:id", delete(handlers::archive_template))
.route("/api/v1/agent-templates/:id/full", get(handlers::get_full_template))
.route("/api/v1/agent-templates/:id/create-agent", post(handlers::create_agent_from_template))
// Template Assignment (per-account)
.route("/api/v1/accounts/me/assign-template", post(handlers::assign_template))
.route("/api/v1/accounts/me/assigned-template", get(handlers::get_assigned_template))
.route("/api/v1/accounts/me/assigned-template", delete(handlers::unassign_template))
}