feat: add AI workflow service foundation

This commit is contained in:
mlogclub
2026-06-22 00:11:26 +08:00
parent fa99c5bed9
commit 0127455be5
10 changed files with 807 additions and 0 deletions
@@ -0,0 +1,37 @@
package repositories
import (
"agent-desk/internal/models"
"github.com/mlogclub/simple/sqls"
"gorm.io/gorm"
)
var AIWorkflowRunRepository = newAIWorkflowRunRepository()
func newAIWorkflowRunRepository() *aiWorkflowRunRepository {
return &aiWorkflowRunRepository{}
}
type aiWorkflowRunRepository struct{}
func (r *aiWorkflowRunRepository) Get(db *gorm.DB, id int64) *models.AIWorkflowRun {
ret := &models.AIWorkflowRun{}
if err := db.First(ret, "id = ?", id).Error; err != nil {
return nil
}
return ret
}
func (r *aiWorkflowRunRepository) Find(db *gorm.DB, cnd *sqls.Cnd) (list []models.AIWorkflowRun) {
cnd.Find(db, &list)
return
}
func (r *aiWorkflowRunRepository) Create(db *gorm.DB, t *models.AIWorkflowRun) error {
return db.Create(t).Error
}
func (r *aiWorkflowRunRepository) Updates(db *gorm.DB, id int64, columns map[string]interface{}) error {
return db.Model(&models.AIWorkflowRun{}).Where("id = ?", id).Updates(columns).Error
}