diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..31669dd --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,9 @@ +# Claude Custom Instructions + +## Git Workflow +Every time you complete a task or make changes to files, you MUST automatically commit those changes to Git before waiting for the user's next prompt. + +### Instructions: +1. Always run `git add .` to stage your changes. +2. Run `git commit -m "Auto-commit: [brief description of what was changed]"` +3. Do not ask for permission to commit, just perform the git commit automatically. \ No newline at end of file diff --git a/web/routes/admin.py b/web/routes/admin.py index f652750..510f399 100644 --- a/web/routes/admin.py +++ b/web/routes/admin.py @@ -2,7 +2,7 @@ import os import json import shutil from datetime import datetime, timedelta -from flask import Blueprint, render_template, request, redirect, url_for, flash, session +from flask import Blueprint, render_template, request, redirect, url_for, flash, session, jsonify from flask_login import login_required, login_user, current_user from sqlalchemy import func from web.db import db, User, Project, Run @@ -195,14 +195,19 @@ def debug_routes(): @login_required @admin_required def optimize_models(): + is_ajax = request.headers.get('X-Requested-With') == 'XMLHttpRequest' try: ai_setup.init_models(force=True) if ai_models.model_logic: style_persona.refresh_style_guidelines(ai_models.model_logic) + if is_ajax: + return jsonify({'status': 'ok', 'message': 'AI Models refreshed and Style Guidelines updated.'}) flash("AI Models refreshed and Style Guidelines updated.") except Exception as e: + if is_ajax: + return jsonify({'status': 'error', 'message': f'Error refreshing models: {e}'}), 500 flash(f"Error refreshing models: {e}") return redirect(request.referrer or url_for('project.index'))