45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""
|
|
主路由
|
|
处理页面请求
|
|
"""
|
|
from flask import Blueprint, jsonify, current_app
|
|
|
|
main_bp = Blueprint('main', __name__)
|
|
|
|
@main_bp.route('/')
|
|
def index():
|
|
"""首页"""
|
|
return jsonify({
|
|
"message": "Welcome to DeepResearch API",
|
|
"version": "1.0.0",
|
|
"endpoints": {
|
|
"create_research": "POST /api/research",
|
|
"get_status": "GET /api/research/<session_id>/status",
|
|
"get_report": "GET /api/research/<session_id>/report",
|
|
"list_sessions": "GET /api/research/sessions"
|
|
}
|
|
})
|
|
|
|
@main_bp.route('/health')
|
|
def health_check():
|
|
"""健康检查"""
|
|
return jsonify({
|
|
"status": "healthy",
|
|
"service": "DeepResearch"
|
|
})
|
|
|
|
@main_bp.route('/config')
|
|
def get_config():
|
|
"""获取配置信息(仅开发环境)"""
|
|
if current_app.debug:
|
|
return jsonify({
|
|
"debug": current_app.debug,
|
|
"max_concurrent_subtopics": current_app.config.get('MAX_CONCURRENT_SUBTOPICS'),
|
|
"search_priorities": {
|
|
"high": current_app.config.get('MAX_SEARCHES_HIGH_PRIORITY'),
|
|
"medium": current_app.config.get('MAX_SEARCHES_MEDIUM_PRIORITY'),
|
|
"low": current_app.config.get('MAX_SEARCHES_LOW_PRIORITY')
|
|
}
|
|
})
|
|
else:
|
|
return jsonify({"error": "Not available in production"}), 403 |