Fixes for site
This commit is contained in:
@@ -166,6 +166,19 @@ def init_models(force=False):
|
||||
|
||||
img_source = "Gemini API" if model_image else "None"
|
||||
|
||||
# Auto-detect GCP Project from credentials if not set (Fix for Image Model)
|
||||
if HAS_VERTEX and not config.GCP_PROJECT and config.GOOGLE_CREDS and os.path.exists(config.GOOGLE_CREDS):
|
||||
try:
|
||||
with open(config.GOOGLE_CREDS, 'r') as f:
|
||||
cdata = json.load(f)
|
||||
# Check common OAuth structures
|
||||
for k in ['installed', 'web']:
|
||||
if k in cdata and 'project_id' in cdata[k]:
|
||||
config.GCP_PROJECT = cdata[k]['project_id']
|
||||
utils.log("SYSTEM", f"Auto-detected GCP Project ID: {config.GCP_PROJECT}")
|
||||
break
|
||||
except: pass
|
||||
|
||||
if HAS_VERTEX and config.GCP_PROJECT:
|
||||
creds = None
|
||||
# Handle OAuth Client ID (credentials.json) if provided instead of Service Account
|
||||
|
||||
Reference in New Issue
Block a user