#!/usr/bin/env python3 """Verify aichat.html rendering - S2 VERIFY""" import sys, subprocess r = subprocess.run(["curl", "-s", "http://127.0.0.1:5001/chat"], capture_output=True, text=True, timeout=15) html = r.stdout checks = [ ('loadMessages' in html, 'loadMessages function exists'), ('renderMsg' in html, 'renderMsg function exists'), ('开始对话吧' in html, 'empty state message exists'), ('msgList' in html, 'msgList element exists'), ('convList' in html, 'convList sidebar exists'), ('sendMessage' in html, 'sendMessage function exists'), ('selectConversation' in html, 'selectConversation function exists'), ] # Jinja2 escape check (simpler) backslash_bug = '\\\\' * 4 # 8 backslashes if backslash_bug in html: checks.append((False, 'no Jinja2 backslash bug')) else: checks.append((True, 'no Jinja2 backslash bug')) all_pass = True for check, label in checks: status = '✓' if check else '✗' if not check: all_pass = False print(f' {status} {label}') if all_pass: print('VERIFY PASSED') else: print('VERIFY FAILED') sys.exit(1)