main
HuangHai 2 weeks ago
parent 04f79f86db
commit 7f94cb2cc2

@ -273,5 +273,28 @@ async def update_knowledge(request: fastapi.Request):
return {"code": 1, "msg": str(e)}
@app.route('/api/render_html', methods=['POST'])
def render_html():
html_content = request.json.get('html_content')
if not html_content:
return jsonify({'success': False, 'error': 'No HTML content provided'})
# 创建临时文件
filename = f"relation_{uuid.uuid4().hex}.html"
filepath = os.path.join('static/temp', filename)
# 确保temp目录存在
os.makedirs('static/temp', exist_ok=True)
# 写入文件
with open(filepath, 'w', encoding='utf-8') as f:
f.write(html_content)
return jsonify({
'success': True,
'url': f'/static/temp/{filename}'
})
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)

@ -350,7 +350,7 @@
function generateRelation() {
const answerArea = document.getElementById('answerArea');
answerArea.innerHTML = '<div class="loading-animation"><div class="spinner"></div><div>正在生成人物关系图...</div></div>';
fetch('/api/rag', {
method: 'POST',
headers: {

Loading…
Cancel
Save