#!/usr/bin/env python3
"""Update docs/index.html to add model download gate via Gitea API"""
import requests, json, base64
TOKEN = '2d924a6e19b44d14bf367f5dd1ce238510128183'
URL = 'https://guanghulab.com/code/api/v1/repos/bingshuo/guanghulab/contents/docs/index.html'
HEADERS = {'Authorization': f'Bearer {TOKEN}'}
# Get current file
resp = requests.get(URL, headers=HEADERS)
data = resp.json()
sha = data['sha']
content = base64.b64decode(data['content']).decode('utf-8')
# Add download models gate after the first gate (光湖智库)
new_gate = '''
📥模型下载
1.5B人格模型模板下载
download-models.html →
'''
# Insert after the first in the gates section
insert_pos = content.find('', content.find('