mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-31 01:35:56 +08:00
d9cf601841
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.
31 lines
599 B
Go
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
|
|
}
|