- 在主应用路由中添加 /ocr 页面路由渲染 ocr.html - 菜单中新增“验光单助手”入口,图标为 scan-eye,便于访问 - 在生成文本接口中支持聊天模型,处理 messages 内图片链接为 Base64 - 兼容 messages 为空场景,重构 payload 结构支持图片 Base64 传输 - 解析验光单请求不保存生成记录,避免污染历史数据 - 获取历史记录时过滤掉“解读验光单”的操作记录 - AI 接口配置新增 CHAT_API 地址,支持聊天模型调用 style(frontend): 优化首页图片展示与交互样式 - 缩小加载动画高度,调整提示文字为“AI 构思中...” - 图片展示容器增加阴影和悬停放大效果,提升视觉体验 - 结果区域改为flex布局,支持滚动区域和固定底部操作栏 - 按钮圆角加大,阴影色调调整,增强交互反馈 - 引入 Tailwind typography 插件,提升排版一致性 - 静态资源由 CDN 改为本地引用避免外部依赖 docs(ui): 补充首页联系方式提示,优化用户导航 - 在用户个人信息区域新增客服 QQ 联系方式悬浮提示 - 调整首页初始占位状态布局,提升视觉层次感 - 细化按钮标签与图标增强可用性提示
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from flask import Flask, render_template
|
|
from config import Config
|
|
from extensions import db, redis_client
|
|
from blueprints.auth import auth_bp
|
|
from blueprints.api import api_bp
|
|
from blueprints.admin import admin_bp
|
|
import threading
|
|
import time
|
|
|
|
# 导入模型(必须在 db.create_all() 之前导入)
|
|
import models
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
# 初始化扩展
|
|
db.init_app(app)
|
|
redis_client.init_app(app)
|
|
|
|
# 注册蓝图
|
|
app.register_blueprint(auth_bp)
|
|
app.register_blueprint(api_bp)
|
|
app.register_blueprint(admin_bp)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/ocr')
|
|
def ocr():
|
|
return render_template('ocr.html')
|
|
|
|
# 自动创建数据库表
|
|
with app.app_context():
|
|
print("🔧 正在检查并创建数据库表...")
|
|
db.create_all()
|
|
print("✅ 数据库表已就绪")
|
|
|
|
return app
|
|
|
|
app = create_app()
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5000, debug=True)
|