引包目录名调整
This commit is contained in:
30
digital-human/controller/async_task_controller.go
Normal file
30
digital-human/controller/async_task_controller.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type asyncTask struct{}
|
||||
|
||||
// AsyncTask 异步任务同步控制器(供定时任务服务调用)
|
||||
var AsyncTask = new(asyncTask)
|
||||
|
||||
// SyncAsyncTasks 扫描待处理任务并同步状态/转移结果
|
||||
func (c *asyncTask) SyncAsyncTasks(ctx context.Context, req *dto.SyncAsyncTasksReq) (res *dto.SyncAsyncTasksRes, err error) {
|
||||
// 从上下文获取用户信息(gfdb Hook 会自动填充)
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.AsyncTask.Sync(ctx, req)
|
||||
}
|
||||
113
digital-human/controller/audio_controller.go
Normal file
113
digital-human/controller/audio_controller.go
Normal file
@@ -0,0 +1,113 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type audio struct{}
|
||||
|
||||
// Audio 音频控制器
|
||||
var Audio = new(audio)
|
||||
|
||||
// CreateAudio 创建音频
|
||||
func (c *audio) CreateAudio(ctx context.Context, req *dto.CreateAudioReq) (res *dto.CreateAudioRes, err error) {
|
||||
// 从上下文获取用户信息(gfdb Hook 会自动填充)
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.Audio.Create(ctx, req)
|
||||
}
|
||||
|
||||
// ListAudio 获取音频列表
|
||||
func (c *audio) ListAudio(ctx context.Context, req *dto.ListAudioReq) (res *dto.ListAudioRes, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.Audio.List(ctx, req)
|
||||
}
|
||||
|
||||
// GetAudio 获取音频详情
|
||||
func (c *audio) GetAudio(ctx context.Context, req *dto.GetAudioReq) (res *dto.GetAudioRes, err error) {
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.Audio.GetOne(ctx, req.ID)
|
||||
}
|
||||
|
||||
// UpdateAudio 更新音频
|
||||
func (c *audio) UpdateAudio(ctx context.Context, req *dto.UpdateAudioReq) (res *beans.ResponseEmpty, err error) {
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
err = service.Audio.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteAudio 删除音频
|
||||
func (c *audio) DeleteAudio(ctx context.Context, req *dto.DeleteAudioReq) (res *beans.ResponseEmpty, err error) {
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
err = service.Audio.Delete(ctx, req.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// GenerateAudio 重新生成音频
|
||||
func (c *audio) GenerateAudio(ctx context.Context, req *dto.GenerateAudioReq) (res *dto.GenerateAudioRes, err error) {
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.Audio.Generate(ctx, req)
|
||||
}
|
||||
|
||||
// TTS 文本转语音
|
||||
func (c *audio) TTS(ctx context.Context, req *dto.TTSReq) (res *dto.TTSRes, err error) {
|
||||
return service.Audio.TTS(ctx, req)
|
||||
}
|
||||
|
||||
// GetStatusOptions 获取状态选项
|
||||
func (c *audio) GetStatusOptions(ctx context.Context, req *dto.GetAudioStatusOptionsReq) (res *dto.GetAudioStatusOptionsRes, err error) {
|
||||
return service.Audio.GetStatusOptions(ctx, req)
|
||||
}
|
||||
61
digital-human/controller/custom_voice_controller.go
Normal file
61
digital-human/controller/custom_voice_controller.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type customVoice struct{}
|
||||
|
||||
// CustomVoice 自定义音色控制器
|
||||
var CustomVoice = new(customVoice)
|
||||
|
||||
// CreateCustomVoice 创建自定义音色
|
||||
func (c *customVoice) CreateCustomVoice(ctx context.Context, req *dto.CreateCustomVoiceReq) (res *dto.CreateCustomVoiceRes, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.CustomVoice.CreateCustomVoice(ctx, req)
|
||||
}
|
||||
|
||||
// ListCustomVoices 获取自定义音色列表
|
||||
func (c *customVoice) ListCustomVoices(ctx context.Context, req *dto.ListCustomVoiceReq) (res *dto.ListCustomVoiceRes, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.CustomVoice.ListCustomVoices(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteCustomVoice 删除自定义音色
|
||||
func (c *customVoice) DeleteCustomVoice(ctx context.Context, req *dto.DeleteCustomVoiceReq) (res *beans.ResponseEmpty, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
err = service.CustomVoice.DeleteCustomVoice(ctx, req)
|
||||
return
|
||||
}
|
||||
67
digital-human/controller/digitalhuman_controller.go
Normal file
67
digital-human/controller/digitalhuman_controller.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type digitalhuman struct{}
|
||||
|
||||
// DigitalHuman 数字人形象控制器
|
||||
var DigitalHuman = new(digitalhuman)
|
||||
|
||||
// CreateDigitalHuman 创建数字人形象
|
||||
func (c *digitalhuman) CreateDigitalHuman(ctx context.Context, req *dto.CreateDigitalHumanReq) (res *dto.CreateDigitalHumanRes, err error) {
|
||||
return service.DigitalHuman.Create(ctx, req)
|
||||
}
|
||||
|
||||
// ListDigitalHuman 获取数字人形象列表
|
||||
func (c *digitalhuman) ListDigitalHuman(ctx context.Context, req *dto.ListDigitalHumanReq) (res *dto.ListDigitalHumanRes, err error) {
|
||||
return service.DigitalHuman.List(ctx, req)
|
||||
}
|
||||
|
||||
// GetDigitalHuman 获取数字人形象详情
|
||||
func (c *digitalhuman) GetDigitalHuman(ctx context.Context, req *dto.GetDigitalHumanReq) (res *dto.GetDigitalHumanRes, err error) {
|
||||
return service.DigitalHuman.GetOne(ctx, req.ID)
|
||||
}
|
||||
|
||||
// UpdateDigitalHuman 更新数字人形象
|
||||
func (c *digitalhuman) UpdateDigitalHuman(ctx context.Context, req *dto.UpdateDigitalHumanReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.DigitalHuman.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateDigitalHumanStatus 更新数字人形象状态
|
||||
func (c *digitalhuman) UpdateDigitalHumanStatus(ctx context.Context, req *dto.UpdateDigitalHumanStatusReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.DigitalHuman.UpdateStatus(ctx, req.ID, req.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteDigitalHuman 删除数字人形象
|
||||
func (c *digitalhuman) DeleteDigitalHuman(ctx context.Context, req *dto.DeleteDigitalHumanReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.DigitalHuman.Delete(ctx, req.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// GetDigitalHumanStatusOptions 获取数字人状态选项
|
||||
func (c *digitalhuman) GetDigitalHumanStatusOptions(ctx context.Context, req *dto.GetDigitalHumanStatusOptionsReq) (res *dto.GetDigitalHumanStatusOptionsRes, err error) {
|
||||
return service.DigitalHuman.GetStatusOptions(ctx, req)
|
||||
}
|
||||
|
||||
// GetGenderOptions 获取性别选项
|
||||
func (c *digitalhuman) GetGenderOptions(ctx context.Context, req *dto.GetGenderOptionsReq) (res *dto.GetGenderOptionsRes, err error) {
|
||||
return service.DigitalHuman.GetGenderOptions(ctx, req)
|
||||
}
|
||||
|
||||
// GetAgeOptions 获取年龄段选项
|
||||
func (c *digitalhuman) GetAgeOptions(ctx context.Context, req *dto.GetAgeOptionsReq) (res *dto.GetAgeOptionsRes, err error) {
|
||||
return service.DigitalHuman.GetAgeOptions(ctx, req)
|
||||
}
|
||||
|
||||
// GetStyleOptions 获取风格选项
|
||||
func (c *digitalhuman) GetStyleOptions(ctx context.Context, req *dto.GetStyleOptionsReq) (res *dto.GetStyleOptionsRes, err error) {
|
||||
return service.DigitalHuman.GetStyleOptions(ctx, req)
|
||||
}
|
||||
56
digital-human/controller/video_controller.go
Normal file
56
digital-human/controller/video_controller.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
type video struct{}
|
||||
|
||||
// Video 视频控制器
|
||||
var Video = new(video)
|
||||
|
||||
// CreateVideo 创建视频
|
||||
func (c *video) CreateVideo(ctx context.Context, req *dto.CreateVideoReq) (res *dto.CreateVideoRes, err error) {
|
||||
return service.Video.Create(ctx, req)
|
||||
}
|
||||
|
||||
// ListVideo 获取视频列表
|
||||
func (c *video) ListVideo(ctx context.Context, req *dto.ListVideoReq) (res *dto.ListVideoRes, err error) {
|
||||
return service.Video.List(ctx, req)
|
||||
}
|
||||
|
||||
// GetVideo 获取视频详情
|
||||
func (c *video) GetVideo(ctx context.Context, req *dto.GetVideoReq) (res *dto.GetVideoRes, err error) {
|
||||
return service.Video.GetOne(ctx, req.ID)
|
||||
}
|
||||
|
||||
// UpdateVideo 更新视频
|
||||
func (c *video) UpdateVideo(ctx context.Context, req *dto.UpdateVideoReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Video.Update(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteVideo 删除视频
|
||||
func (c *video) DeleteVideo(ctx context.Context, req *dto.DeleteVideoReq) (res *beans.ResponseEmpty, err error) {
|
||||
err = service.Video.Delete(ctx, req.ID)
|
||||
return
|
||||
}
|
||||
|
||||
// GenerateVideo 生成视频
|
||||
func (c *video) GenerateVideo(ctx context.Context, req *dto.GenerateVideoReq) (res *dto.GenerateVideoRes, err error) {
|
||||
return service.Video.Generate(ctx, req)
|
||||
}
|
||||
|
||||
// GetVideoStatusOptions 获取视频状态选项
|
||||
func (c *video) GetVideoStatusOptions(ctx context.Context, req *dto.GetVideoStatusOptionsReq) (res *dto.GetVideoStatusOptionsRes, err error) {
|
||||
return service.Video.GetStatusOptions(ctx, req)
|
||||
}
|
||||
|
||||
// GetResolutionOptions 获取分辨率选项
|
||||
func (c *video) GetResolutionOptions(ctx context.Context, req *dto.GetResolutionOptionsReq) (res *dto.GetResolutionOptionsRes, err error) {
|
||||
return service.Video.GetResolutionOptions(ctx, req)
|
||||
}
|
||||
Reference in New Issue
Block a user