Refactor AI Agent configuration and workflow handling
- Removed runtime mode handling from AIAgentConfigWorkbench and related components. - Updated tests to reflect changes in AI Agent policy copy and configuration. - Changed terminology from "workflow" to "revision" in various components and API responses. - Simplified agent binding logic in channel editing. - Cleaned up unused variables and types related to runtime modes. - Updated localization files for consistency with new terminology.
This commit is contained in:
@@ -43,14 +43,3 @@ func (r *agentRevisionRepository) MaxRevisionByAgentID(db *gorm.DB, agentID int6
|
||||
db.Model(&models.AgentRevision{}).Where("agent_id = ?", agentID).Select("COALESCE(MAX(revision), 0)").Scan(&ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
func (r *agentRevisionRepository) TakeByAgentIDAndWorkflowVersionID(db *gorm.DB, agentID int64, workflowVersionID int64) *models.AgentRevision {
|
||||
if agentID <= 0 || workflowVersionID <= 0 {
|
||||
return nil
|
||||
}
|
||||
ret := &models.AgentRevision{}
|
||||
if err := db.Where("agent_id = ? AND workflow_version_id = ?", agentID, workflowVersionID).Order("id DESC").First(ret).Error; err != nil {
|
||||
return nil
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ func (r *dashboardRepository) CountKnowledgeRetrieveLogs(db *gorm.DB, query func
|
||||
return count
|
||||
}
|
||||
|
||||
func (r *dashboardRepository) CountSkillRunLogs(db *gorm.DB, query func(tx *gorm.DB) *gorm.DB) int64 {
|
||||
func (r *dashboardRepository) CountAgentRuns(db *gorm.DB, query func(tx *gorm.DB) *gorm.DB) int64 {
|
||||
var count int64
|
||||
tx := db.Model(&models.SkillRunLog{})
|
||||
tx := db.Model(&models.AgentRun{})
|
||||
if query != nil {
|
||||
tx = query(tx)
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"agent-desk/internal/models"
|
||||
|
||||
"agent-desk/internal/pkg/httpx/params"
|
||||
|
||||
"github.com/mlogclub/simple/sqls"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var SkillRunLogRepository = newSkillRunLogRepository()
|
||||
|
||||
func newSkillRunLogRepository() *skillRunLogRepository {
|
||||
return &skillRunLogRepository{}
|
||||
}
|
||||
|
||||
type skillRunLogRepository struct {
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Get(db *gorm.DB, id int64) *models.SkillRunLog {
|
||||
ret := &models.SkillRunLog{}
|
||||
if err := db.First(ret, "id = ?", id).Error; err != nil {
|
||||
return nil
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Take(db *gorm.DB, where ...interface{}) *models.SkillRunLog {
|
||||
ret := &models.SkillRunLog{}
|
||||
if err := db.Take(ret, where...).Error; err != nil {
|
||||
return nil
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Find(db *gorm.DB, cnd *sqls.Cnd) (list []models.SkillRunLog) {
|
||||
cnd.Find(db, &list)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) FindOne(db *gorm.DB, cnd *sqls.Cnd) *models.SkillRunLog {
|
||||
ret := &models.SkillRunLog{}
|
||||
if err := cnd.FindOne(db, &ret); err != nil {
|
||||
return nil
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) FindPageByParams(db *gorm.DB, params *params.QueryParams) (list []models.SkillRunLog, paging *sqls.Paging) {
|
||||
return r.FindPageByCnd(db, ¶ms.Cnd)
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) FindPageByCnd(db *gorm.DB, cnd *sqls.Cnd) (list []models.SkillRunLog, paging *sqls.Paging) {
|
||||
cnd.Find(db, &list)
|
||||
count := cnd.Count(db, &models.SkillRunLog{})
|
||||
|
||||
paging = &sqls.Paging{
|
||||
Page: cnd.Paging.Page,
|
||||
Limit: cnd.Paging.Limit,
|
||||
Total: count,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) FindBySql(db *gorm.DB, sqlStr string, paramArr ...interface{}) (list []models.SkillRunLog) {
|
||||
db.Raw(sqlStr, paramArr...).Scan(&list)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) CountBySql(db *gorm.DB, sqlStr string, paramArr ...interface{}) (count int64) {
|
||||
db.Raw(sqlStr, paramArr...).Count(&count)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Count(db *gorm.DB, cnd *sqls.Cnd) int64 {
|
||||
return cnd.Count(db, &models.SkillRunLog{})
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Create(db *gorm.DB, t *models.SkillRunLog) (err error) {
|
||||
err = db.Create(t).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Update(db *gorm.DB, t *models.SkillRunLog) (err error) {
|
||||
err = db.Save(t).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Updates(db *gorm.DB, id int64, columns map[string]interface{}) (err error) {
|
||||
err = db.Model(&models.SkillRunLog{}).Where("id = ?", id).Updates(columns).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) UpdateColumn(db *gorm.DB, id int64, name string, value interface{}) (err error) {
|
||||
err = db.Model(&models.SkillRunLog{}).Where("id = ?", id).UpdateColumn(name, value).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (r *skillRunLogRepository) Delete(db *gorm.DB, id int64) {
|
||||
db.Delete(&models.SkillRunLog{}, "id = ?", id)
|
||||
}
|
||||
Reference in New Issue
Block a user