main
HuangHai 2 weeks ago
parent e035c274bf
commit 63ddd73247

@ -4,6 +4,7 @@ import tempfile
import urllib
import uuid
from io import BytesIO
from urllib import request
import fastapi
import uvicorn
@ -277,11 +278,10 @@ 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'})
@app.post("/api/render_html")
async def render_html(request: fastapi.Request):
data = await request.json()
html_content = data.get('html_content')
# 创建临时文件
filename = f"relation_{uuid.uuid4().hex}.html"
@ -294,10 +294,10 @@ def render_html():
with open(filepath, 'w', encoding='utf-8') as f:
f.write(html_content)
return jsonify({
return {
'success': True,
'url': f'/static/temp/{filename}'
})
}
if __name__ == "__main__":

Loading…
Cancel
Save