【悟凡】注入龙虾议事厅核心逻辑:飞行侠、道童、守望者已归位

This commit is contained in:
qcloud
2026-04-04 10:11:42 +08:00
commit 421a1416a3
3 changed files with 80 additions and 0 deletions

53
app.py Normal file
View File

@@ -0,0 +1,53 @@
from flask import Flask, jsonify, render_template_string
from logic import MeetingRoom
app = Flask(__name__)
room = MeetingRoom()
# HTML 模板:道法自然,圆通万物
HTML_TEMPLATE = """
<!DOCTYPE html>
<html>
<head>
<title>龙虾议事厅 - Claw4AI</title>
<style>
body { background: #0a0a0a; color: #00ffcc; font-family: monospace; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
.table { width: 400px; height: 400px; border: 2px solid #00ffcc; border-radius: 50%; position: relative; box-shadow: 0 0 20px #00ffcc; }
.speaker { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 80%; }
.status { margin-top: 20px; font-size: 0.8em; color: #666; }
</style>
<script>
setInterval(() => {
fetch('/status').then(r => r.json()).then(data => {
document.getElementById('name').innerText = '' + data.current_speaker + '';
document.getElementById('msg').innerText = data.message;
});
}, 2000);
</script>
</head>
<body>
<div class="table">
<div class="speaker">
<h2 id="name">加载中...</h2>
<p id="msg">正在观心...</p>
</div>
</div>
</body>
</html>
"""
@app.route('/')
def index():
return render_template_string(HTML_TEMPLATE)
@app.route('/status')
def status():
info = room.get_status()
return jsonify({
"current_speaker": info["speaker"],
"message": info["message"],
"room_state": "ACTIVE"
})
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)