MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / create_session

Function create_session

backend/autofigure_routes.py:269–336  ·  view source on GitHub ↗

Create a new AutoFigure session.

()

Source from the content-addressed store, hash-verified

267@autofigure_bp.route('/session/create', methods=['POST'])
268@verify_token
269def create_session():
270 """Create a new AutoFigure session."""
271 error = require_autofigure()
272 if error:
273 return error
274
275 try:
276 data = request.get_json()
277
278 config = data.get('config', {})
279 input_content = data.get('input_content', '')
280 input_type = data.get('input_type', 'text') # text or pdf
281
282 if not input_content:
283 return jsonify({'error': 'Input content is required'}), 400
284
285 # Generate session ID
286 session_id = str(uuid.uuid4())
287
288 # Create session data
289 session_data = {
290 'session_id': session_id,
291 'status': 'idle',
292 'config': {
293 'content_type': config.get('contentType', 'paper'),
294 'max_iterations': config.get('maxIterations', 5),
295 'quality_threshold': config.get('qualityThreshold', 9.0),
296 'min_improvement': config.get('minImprovement', 0.2),
297 'human_in_loop': config.get('humanInLoop', True),
298 'llm_provider': config.get('llmProvider', 'claude'),
299 'api_key': config.get('apiKey', ''),
300 'base_url': config.get('baseUrl', ''),
301 'model': config.get('model', ''),
302 'svg_width': config.get('svgWidth', 1333),
303 'svg_height': config.get('svgHeight', 750),
304 # Methodology extraction configuration
305 'enable_methodology_extraction': config.get('enableMethodologyExtraction', True),
306 'methodology_llm_provider': config.get('methodologyLlmProvider', 'bianxie'),
307 'methodology_llm_api_key': config.get('methodologyLlmApiKey', ''),
308 'methodology_llm_base_url': config.get('methodologyLlmBaseUrl', ''),
309 'methodology_llm_model': config.get('methodologyLlmModel', 'gemini-3.1-pro-preview'),
310 # Enhancement configuration
311 'enhancement_mode': config.get('enhancementMode', 'text2image_prompt'),
312 'art_style': config.get('artStyle', ''), # User must provide custom art style
313 'enhancement_count': config.get('enhancementCount', 3),
314 'enhancement_provider': config.get('enhancementProvider', 'bianxie'),
315 },
316 'input_content': input_content,
317 'input_type': input_type,
318 'current_iteration': 0,
319 'iterations': [],
320 'final_xml': None,
321 'enhanced_images': [],
322 'created_at': datetime.utcnow().isoformat(),
323 'updated_at': datetime.utcnow().isoformat(),
324 }
325
326 # Store session

Callers

nothing calls this directly

Calls 1

require_autofigureFunction · 0.85

Tested by

no test coverage detected