Fetch the 'parent' information

Allows us to track Tags, as well as the propper description, since
CivitAI doesn't seem to want to roll it overto the Version API...
pull/135/head
midcoastal 2023-05-03 11:44:03 -04:00
parent fcf5a27aef
commit e819dbe137
1 changed files with 14 additions and 1 deletions

View File

@ -70,12 +70,25 @@ def get_model_info_by_hash(hash:str):
util.printD("error, content from civitai is None")
return
util.printD("Fetching Parent Model Information")
parent_model = get_model_info_by_id(content['modelId'])
# this is VERY un-safe, as CivitAI returns full HTML in this, and the
# version's, description, but we haven't been filtering it so far, so
# I guess we'll get to it later...
content['model']['description'] = parent_model['description']
content['model']['tags'] = parent_model['tags']
content['model']['allowNoCredit'] = parent_model['allowNoCredit']
content['model']['allowCommercialUse'] = parent_model['allowCommercialUse']
content['model']['allowDerivatives'] = parent_model['allowDerivatives']
content['model']['allowDifferentLicense'] = parent_model['allowDifferentLicense']
return content
def get_model_info_by_id(id:str) -> dict:
util.printD("Request model info from civitai")
util.printD("Request model info from civitai: "+str(id))
if not id:
util.printD("id is empty")