feat: AI 场景路由、ASR 服务及前后端全链路同步

- 新增 AI 场景路由控制器和管理接口
- 新增 ASR 语音识别服务及前后端集成
- 同步 AI Runtime 客户端到 Web/小程序/Life-Script
- 完善 AI 配置测试修复和管理后台路由配置
- 新增数据库迁移脚本

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 13:25:21 +08:00
parent d77090aa5e
commit 89fc42819d
72 changed files with 4584 additions and 383 deletions
@@ -0,0 +1,59 @@
package com.emotion.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.emotion.entity.AiEndpointConfig;
import com.emotion.mapper.AiEndpointConfigMapper;
import com.emotion.service.AiEndpointConfigService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class AiEndpointConfigServiceImpl extends ServiceImpl<AiEndpointConfigMapper, AiEndpointConfig> implements AiEndpointConfigService {
@Override
public List<AiEndpointConfig> listVisible() {
return list(new LambdaQueryWrapper<AiEndpointConfig>()
.eq(AiEndpointConfig::getIsDeleted, 0)
.orderByDesc(AiEndpointConfig::getCreateTime));
}
@Override
public AiEndpointConfig saveEndpoint(AiEndpointConfig endpoint) {
applyDefaults(endpoint);
save(endpoint);
return endpoint;
}
@Override
public AiEndpointConfig updateEndpoint(AiEndpointConfig endpoint) {
updateById(endpoint);
return getById(endpoint.getId());
}
@Override
public AiEndpointConfig getEnabledById(String id) {
AiEndpointConfig endpoint = getById(id);
if (endpoint == null || endpoint.getIsEnabled() == null || endpoint.getIsEnabled() != 1) {
return null;
}
return endpoint;
}
private void applyDefaults(AiEndpointConfig endpoint) {
if (!StringUtils.hasText(endpoint.getResponseMode())) {
endpoint.setResponseMode("streaming");
}
if (endpoint.getSupportStream() == null) {
endpoint.setSupportStream(1);
}
if (endpoint.getIsEnabled() == null) {
endpoint.setIsEnabled(1);
}
if (endpoint.getTimeoutMs() == null) {
endpoint.setTimeoutMs(60000);
}
}
}