Skip to content

feat: 实现 ASR 模块完整功能#33

Open
shenenqing wants to merge 1 commit intoLianjiaTech:developfrom
shenenqing:feature/asr-implementation
Open

feat: 实现 ASR 模块完整功能#33
shenenqing wants to merge 1 commit intoLianjiaTech:developfrom
shenenqing:feature/asr-implementation

Conversation

@shenenqing
Copy link

功能概述

实现了 ASR(语音转文字)模块的完整功能

主要内容

1. 核心服务

  • 任务创建、查询、回调处理
  • 单任务和批量查询
  • 集成外部队列服务和计费系统
  • 用量自动上报

2. 数据库分片

  • 动态分片管理:自动创建和切换分片
  • 分布式锁保护:使用 MySQL GET_LOCK
  • 跨分片查询:scatter-gather 并行查询
  • 支持最多 1000 个分片

3. REST API

  • POST /asr/v1/audio/transcriptions/file - 创建转写任务
  • GET /asr/v1/audio/transcriptions/{taskId} - 查询单个任务
  • POST /asr/v1/audio/transcriptions/query - 批量查询任务
  • POST /asr/internal/callback - 接收队列回调
  • GET /asr/health - 健康检查

文件统计

  • 22 个文件修改
  • 2580 行新增代码

@shenenqing shenenqing force-pushed the feature/asr-implementation branch from e18906d to 506d1a7 Compare March 18, 2026 07:17
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shenenqing shenenqing force-pushed the feature/asr-implementation branch from 506d1a7 to 59f5bb0 Compare March 19, 2026 09:54
USE bella_asr;

-- 步骤1: 创建 queue_sharding 表
CREATE TABLE IF NOT EXISTS `queue_sharding`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

整个数据模型和代码直接用现在bella-queue的一套就行。不用重新设计数据模型。整个流程:在bella-queue注册queue, 用户投递任务到queue,对应的asr拉取任务执行,完毕后结果回调到queue。现在整套体系支持这个流程,我理解下边的数据模型、代码,是不是没必要有,直接用现成的就行?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实可以不用实现这一套,直接数据都存到 queue 里就行,queue 定期做一下 asr 数据持久化就可以;最开始单独开一个仓库实现一遍想的是为 asr 做单独的链路扭转服务,asr 的数据也需要单独存一份周期也可能比较久,而且 queue 作为队列服务定位上不应该支持像 asr 这样的存储;但是实现了一版后朱哥说可以迁移到 queue 仓库里复用分表逻辑,所以现在的实现是接口逻辑是 asr 的接口,但是底层分表逻辑用的 queue 逻辑,表现会有点含糊,感觉可以讨论下直接全部复用还是部分拆离

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,这里边我们唯一需要解决的就是数据长时间存储的问题。其他的我感觉就是queue现存的能力。把asr作为模型worker就可以,下周一起讨论下吧。

* @return 转写响应(包含task_id)
*/
@PostMapping("/transcriptions/file")
public AudioTranscriptionResponse createTranscription(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接用现在的QueueController.put接口就行

* @return 任务结果列表
*/
@PostMapping("/transcriptions/file/result")
public List<Map<String, Object>> queryTranscriptions(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接用现在的QueueController.queryTask接口就行吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants