This commit is contained in:
tzwang 2024-09-18 17:37:39 +08:00
commit 185f548b36
2 changed files with 29 additions and 2 deletions

View File

@ -2,7 +2,7 @@ name: Sync Mirror Repository
on:
schedule:
- cron: '0 * * * *' # 每小时同步一次
- cron: '0 */8 * * *' # 每小时同步一次
workflow_dispatch: # 允许手动触发
jobs:

View File

@ -812,10 +812,37 @@ func (m *ModelArtsLink) CheckModelExistence(ctx context.Context, name string, mt
ModelName: name,
ModelType: mtype,
}
err := m.GetModelId(ctx, ifoption)
err := m.CheckImageExist(ctx, ifoption)
if err != nil {
return false
}
return true
}
func (m *ModelArtsLink) CheckImageExist(ctx context.Context, option *option.InferOption) error {
req := &modelarts.ListImagesReq{
Limit: m.pageSize,
Offset: m.pageIndex,
}
ListImageResp, err := m.modelArtsRpc.ListImages(ctx, req)
if err != nil {
return err
}
var modelName string
if ListImageResp.Code == 200 {
//return errors.New("failed to get ModelId")
for _, ListImage := range ListImageResp.Data {
if option.ModelName == "ChatGLM-6B" {
modelName = "chatglm-6b"
} else {
modelName = option.ModelName
}
if ListImage.Name == modelName {
return nil
}
}
}
return errors.New("failed to find Image ")
}