forked from JointCloud/pcm-coordinator
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package textInference
|
|
|
|
import (
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/database"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/strategy"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
|
|
)
|
|
|
|
const (
|
|
TEXTTOIMAGE = "generate_image"
|
|
TEXTTOIMAGE_AiTYPE = "14"
|
|
)
|
|
|
|
type TextToImage struct {
|
|
clusters []*strategy.AssignedCluster
|
|
storage *database.AiStorage
|
|
opt *option.InferOption
|
|
}
|
|
|
|
func (t *TextToImage) SaveAiTask(id int64, adapterName string) error {
|
|
for _, c := range t.clusters {
|
|
clusterName, _ := t.storage.GetClusterNameById(c.ClusterId)
|
|
t.opt.Replica = c.Replicas
|
|
err := t.storage.SaveAiTask(id, t.opt, adapterName, c.ClusterId, clusterName, "", constants.Saved, "")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (t *TextToImage) UpdateStatus(aiTaskList []*models.TaskAi, adapterName string) error {
|
|
return nil
|
|
}
|
|
|
|
func (t *TextToImage) GetAiType() string {
|
|
return TEXTTOIMAGE_AiTYPE
|
|
}
|