Files
Zexi Li d9cf601841 feat(llm): backfill orphan LLM instances into deployments on init (#25081)
On service startup, find LLM instances without llm_deployment_id and
create a matching SLLMDeployment, then link the instance. Idempotent
across restarts; skipped on slave nodes.
2026-06-29 11:28:54 +08:00

31 lines
599 B
Go

package models
import (
"context"
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
)
func InitDB() error {
for _, manager := range []db.IModelManager{
db.Metadata,
// DifyManager,
// LLMManager,
} {
err := manager.InitializeData()
if err != nil {
log.Errorf("Manager %s initializeData fail %s", manager.Keyword(), err)
return err
} else {
log.Infof("Manager %s initializeData PASS!", manager.Keyword())
}
}
if err := BackfillOrphanLLMDeployments(context.Background()); err != nil {
log.Errorf("BackfillOrphanLLMDeployments: %s", err)
}
return nil
}