mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-03-14 17:47:34 +00:00
WIP usage info table
Might get replaced with gradio depending on how well it works
This commit is contained in:
@@ -634,7 +634,7 @@ def api_tac(_: gr.Blocks, app: FastAPI):
|
||||
db_request(lambda: db.reset_tag_count(tagname, ttype, pos, neg))
|
||||
|
||||
@app.get("/tacapi/v1/get-all-use-counts")
|
||||
async def get_all_tag_counts(neg: bool = False):
|
||||
return db_request(lambda: db.get_all_tags(neg), get=True)
|
||||
async def get_all_tag_counts():
|
||||
return db_request(lambda: db.get_all_tags(), get=True)
|
||||
|
||||
script_callbacks.on_app_started(api_tac)
|
||||
|
||||
@@ -86,14 +86,14 @@ class TagFrequencyDb:
|
||||
|
||||
return db_version[0] if db_version else 0
|
||||
|
||||
def get_all_tags(self, negative=False):
|
||||
count_str = "count_neg" if negative else "count_pos"
|
||||
def get_all_tags(self):
|
||||
with transaction() as cursor:
|
||||
cursor.execute(
|
||||
f"""
|
||||
SELECT name, type, {count_str}, last_used
|
||||
SELECT name, type, count_pos, count_neg, last_used
|
||||
FROM tag_frequency
|
||||
ORDER BY {count_str} DESC
|
||||
WHERE count_pos > 0 OR count_neg > 0
|
||||
ORDER BY count_pos + count_neg DESC
|
||||
"""
|
||||
)
|
||||
tags = cursor.fetchall()
|
||||
|
||||
Reference in New Issue
Block a user