trace / generate_secrets.py
Ayush
Update
4156f51
Raw
History Blame Contribute Delete
1.04 kB
import base64
import os
files = {
'credentials.json': 'GCP_CREDENTIALS_B64',
'token_gmail.pkl': 'GMAIL_TOKEN_B64',
'token_sheets.pkl': 'SHEETS_TOKEN_B64',
}
out = ""
for f, name in files.items():
if os.path.exists(f):
with open(f, 'rb') as file:
encoded = base64.b64encode(file.read()).decode('utf-8')
out += f"{name}:\n{encoded}\n\n"
# Also include the ledger ID (plain text)
if os.path.exists('.ledger_id'):
with open('.ledger_id', 'r') as file:
ledger_id = file.read().strip()
out += f"SHEETS_LEDGER_ID:\n{ledger_id}\n\n"
out += "\n--- IMPORTANT ---\n"
out += "To enable natural language prompt parsing, add a new secret directly to Hugging Face:\n"
out += "Name: GROQ_API_KEY\n"
out += "Value: (Your API key from https://console.groq.com)\n"
with open('hf_secrets.txt', 'w') as f:
f.write(out)
print("Successfully created hf_secrets.txt!")
print("NOTE: For smart NLP prompt filtering, don't forget to also set GROQ_API_KEY in your Hugging Face Secrets.")