Files
happy-life-star/docs/superpowers/plans/2026-05-23-ai-routing-admin-runtime-fix.md
peanut 89fc42819d feat: AI 场景路由、ASR 服务及前后端全链路同步
- 新增 AI 场景路由控制器和管理接口
- 新增 ASR 语音识别服务及前后端集成
- 同步 AI Runtime 客户端到 Web/小程序/Life-Script
- 完善 AI 配置测试修复和管理后台路由配置
- 新增数据库迁移脚本

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 13:25:21 +08:00

2.9 KiB

AI Routing Admin Runtime Fix Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Make the AI configuration center match the existing admin theme, use Chinese copy everywhere, show existing provider/workflow bindings from the database, and expose a single user-facing streaming runtime entry point driven by scene code plus JSON inputs.

Architecture: Keep the existing provider/endpoint/scene/log model. The admin page uses the current Element Plus dark glass theme and existing list-page conventions. Runtime calls accept sceneCode and inputs JSON, enrich inputs with the logged-in user context on the backend, resolve the scene binding from the database, then stream provider output back to the user.

Tech Stack: Spring Boot, MyBatis-Plus, FastJSON, Vue 3, Element Plus, uni-app chunked streaming.


Task 1: Admin Page Theme And Chinese Copy

Files:

  • Modify: web-admin/src/views/aiconfig/AiRoutingList.vue

  • Replace English page title, tabs, table columns, dialogs, buttons, alerts, empty states, and confirm text with Chinese.

  • Replace the standalone white panel styles with the project page-header, glass card, table card, and dark Element Plus table styles.

  • Add summary cards for providers, endpoints, scenes, and logs so the page matches existing management pages.

Task 2: User Runtime Request Shape

Files:

  • Modify: backend-single/src/main/java/com/emotion/dto/request/ai/AiRuntimeRequest.java

  • Modify: backend-single/src/main/java/com/emotion/controller/AiRoutingController.java

  • Modify: backend-single/src/main/java/com/emotion/service/impl/AiRuntimeServiceImpl.java

  • Accept user calls as sceneCode plus inputs JSON.

  • Keep user identity server-side by reading UserContextHolder.

  • Enrich runtime inputs with safe user context keys before provider invocation.

  • Keep SSE stream events as the only formal output path for user-facing AI calls.

Task 3: Seed Existing Configurations Into Routing Tables

Files:

  • Modify: sql/2026-05-22-ai-scene-routing.sql

  • Insert a Coze provider from existing t_ai_config rows when missing.

  • Insert endpoint rows from current enabled Coze workflow configurations.

  • Bind existing scenes to known workflow configs where a safe mapping exists.

  • Keep unknown scenes visible but disabled until explicitly bound in the admin page.

Task 4: Verify End To End

Commands:

  • mvn test

  • mvn -DskipTests clean package

  • npm run build

  • npm run build:mp-weixin

  • Remote SQL migration execution.

  • Remote health checks for backend and ASR.

  • Backend tests pass.

  • Backend package succeeds.

  • Admin build succeeds.

  • Mini program build succeeds.

  • Remote routing tables contain provider, endpoints, and scene bindings.