import subprocess import json import time NLM_BIN = "/opt/ai-os/products/ceo/integrations/notebooklm-mcp-cli/.venv/bin/nlm" NOTEBOOK_ID = "c73f7763-e6a6-423f-bb64-f751968eab92" sources = [ {"id": "77d05ee5-698f-4bd7-ad89-99c520cee115", "name": "TAT 2025 Market Promotion Direction"}, {"id": "98997c49-abc5-4e53-8064-9fb0a94998a7", "name": "MHESI Joint Declaration on STGs 2030"}, {"id": "b9da6757-c5c5-413e-af67-55c47d7e6f0b", "name": "The New Thailand Vision at ITB Berlin 2026"}, {"id": "7ca7b95b-9926-4c76-a8b0-39bb78d85d8c", "name": "TAT Action Plan 2027"}, {"id": "589a3e6a-7024-4be0-bc8c-88bdf471dc85", "name": "THA Country Snapshot - DataGreat"}, {"id": "49aad7f6-5144-480e-8d70-a2af14897247", "name": "3rd National Tourism Development Plan 2023-2027"}, {"id": "76d5d8cc-4dd2-4ecd-a0f0-b72fc4d63633", "name": "OECD Tourism Trends and Policies 2026"}, {"id": "95dda89f-3035-42fb-8649-aace51977274", "name": "Thailand in the American Era"}, {"id": "2639c2cc-2498-4f65-a9aa-868f36b58a56", "name": "What's Really Going On in Thailand"}, {"id": "1217c543-a11d-4566-ab8a-925c3f0a399b", "name": "Why Thailand is More Successful in Tourism"} ] q = ( "Hãy phân tích chi tiết tài liệu này đối chiếu với 7 trụ cột du lịch: " "1. Chính sách & Thể chế (quyền tự chủ, cơ cấu, cơ chế tài chính), " "2. Data & Tech (hệ thống dữ liệu thời gian thực, AI), " "3. Nhân lực (số lượng, chất lượng, đào tạo), " "4. Hạ tầng (liên kết hạ tầng, tiện ích), " "5. Xúc tiến & Marketing (chiến lược tổng thể, city marketing), " "6. Cộng đồng & Bền vững (du lịch cộng đồng, carbon thấp, STG), " "7. Tài Nguyên & Bản sắc (sản phẩm du lịch, soft power). " "Trích xuất các mục tiêu định lượng (khách quốc tế, nội địa, GDP du lịch, việc làm, số phòng, chi tiêu, ngân sách xúc tiến). " "Chỉ đưa ra thông tin thực tế từ tài liệu. TUYỆT ĐỐI KHÔNG dùng dấu gạch nối trong văn xuôi tiếng Việt." ) for idx, s in enumerate(sources, 1): print(f"=== [{idx}/10] Querying: {s['name']} ({s['id']}) ===") cmd = [NLM_BIN, "notebook", "query", "--source-ids", s["id"], NOTEBOOK_ID, q] try: res = subprocess.run(cmd, capture_output=True, text=True, timeout=120) if res.returncode == 0: data = json.loads(res.stdout) answer = data.get("answer", "") with open(f"/opt/ai-os/products/ceo/content/research/tourism_benchmarking/analysis/source_{idx}_analysis.txt", "w") as f: f.write(answer) print(f"✅ Success. Saved to source_{idx}_analysis.txt") else: print(f"❌ Error code {res.returncode}: {res.stderr}") except Exception as e: print(f"❌ Exception: {e}") time.sleep(5)