pyc • Lines: 328�
�m�j�$ � �� � d Z ddlZddlZddlZddlZddlZddlmZ ddlmZ ej � Z
dd�Zdd�Zdd�Z
d� Zdd �Z dd
�Zd� Zdd�Zdd
�Zdd�Zd� Zy)uI SQLite-backed theme & combination tracker (``track_theme`` tool, /api/themes).
A dedicated ledger that guarantees creative variety across generated content
without polluting per-user contexts or the to-do (``manage_tasks``) system.
Two dimensions are tracked:
* ``scope`` — the user whose content is being generated. Records inside one
scope are that user's *combination* history: every already-used combination
of detail fields + mood + genre + role + persona.
* global — the union of ALL scopes ("vastly keep track of all the users"),
used to avoid cross-user repetition and to see overall output.
Within a self-chat window every participant (kolpo, kaya, editor, moderator)
shares a single scope (``"self-chat"``) so the theme stays coordinated between
the users of that window while regular per-user chats stay isolated.
� N)�datetime)�Mc �( � t 5 t j t j � } |j | |� }|j
� |j |j � cd d d � S # |j � w xY w# 1 sw Y y xY w�N) �_themes_db_lock�sqlite3�connectr � THEMES_DB�execute�commit�rowcount�close)�query�params�conn�curs �6/home/palash/git/local-ai/server/features/themes_db.py�_db_runr sl � � � ����q�{�{�+�� ��,�,�u�f�-�C��K�K�M��<�<��J�J�L�� ��
�J�J�L��� �s"