Huge change, removed Status class and all "alert" messages are now shown as BS toast() and are via the DB and handled async in the F/E in jscript via Ajax. Fixed BUG-113 where toasts() were repeating. Removed many of the explicit alert messages (other than errors) and hooked {New|Finish}Job to consistently send messages to the F/E. Other messages (F/E without a job, like save settings) now use this model as well. Finally converted most of the older POST responses to formal json
This commit is contained in:
10
ai.py
10
ai.py
@@ -4,7 +4,6 @@ from flask import request, render_template, redirect
|
||||
from main import db, app, ma
|
||||
from sqlalchemy import Sequence
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from status import st, Status
|
||||
from path import Path, PathType
|
||||
from files import Entry, Dir, File, PathDirLink
|
||||
from person import Refimg, Person, PersonRefimgLink
|
||||
@@ -52,8 +51,7 @@ def run_ai_on():
|
||||
jex=[]
|
||||
for el in request.form:
|
||||
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
||||
job=NewJob( "run_ai_on", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in selected file(s)")
|
||||
job=NewJob( "run_ai_on", num_files=0, wait_for=None, jex=jex, desc="Look for face(s) in selected file(s)" )
|
||||
return redirect("/jobs")
|
||||
|
||||
@app.route("/run_ai_on_import", methods=["GET"])
|
||||
@@ -64,8 +62,7 @@ def run_ai_on_import():
|
||||
ptype=PathType.query.filter(PathType.name=='Import').first()
|
||||
jex.append( JobExtra( name=f"person", value="all" ) )
|
||||
jex.append( JobExtra( name=f"path_type", value=ptype.id ) )
|
||||
job=NewJob( "run_ai_on_path", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in import path(s)")
|
||||
job=NewJob( "run_ai_on_path", num_files=0, wait_for=None, jex=jex, desc="Look for face(s) in import path(s)")
|
||||
return redirect("/jobs")
|
||||
|
||||
@app.route("/run_ai_on_storage", methods=["GET"])
|
||||
@@ -75,8 +72,7 @@ def run_ai_on_storage():
|
||||
ptype=PathType.query.filter(PathType.name=='Storage').first()
|
||||
jex.append( JobExtra( name=f"person", value="all" ) )
|
||||
jex.append( JobExtra( name=f"path_type", value=ptype.id ) )
|
||||
job=NewJob( "run_ai_on_path", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to Look for face(s) in storage path(s)")
|
||||
job=NewJob( "run_ai_on_path", num_files=0, wait_for=None, jex=jex, desc="Look for face(s) in storage path(s)")
|
||||
return redirect("/jobs")
|
||||
|
||||
@app.route("/unmatched_faces", methods=["GET"])
|
||||
|
||||
Reference in New Issue
Block a user