- 后端:新增 /api/audio/transcribe 接口,调用 Ollama whisper 进行语音识别 - 前端:新增 AudioTranscribePage.vue 页面,支持 MP3/WAV/M4A/OGG/FLAC 等格式 - 注册路由、工具卡片、智能助手欢迎语更新 Co-Authored-By: Claude Code <noreply@anthropic.com>
20 lines
428 B
Go
20 lines
428 B
Go
package api
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"eai_agentplatform/backend/internal/web"
|
|
)
|
|
|
|
// parseID 解析路径中的 uint id,失败返回 false 并已写入错误响应
|
|
func parseID(c *gin.Context, name string) (uint, bool) {
|
|
id, err := strconv.ParseUint(c.Param(name), 10, 64)
|
|
if err != nil || id == 0 {
|
|
web.Fail(c, web.NewBadRequest("无效的 "+name))
|
|
return 0, false
|
|
}
|
|
return uint(id), true
|
|
}
|