syntaxmatrix 3.0.2__tar.gz → 3.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/PKG-INFO +1 -1
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/SyntaxMatrix.egg-info/PKG-INFO +1 -1
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/SyntaxMatrix.egg-info/SOURCES.txt +1 -6
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/setup.py +1 -1
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/agents.py +15 -17
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/core.py +31 -60
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/page_builder_generation.py +6 -1
- syntaxmatrix-3.0.4/syntaxmatrix/premium/__init__.py +10 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/premium/gate.py +3 -15
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/profiles.py +1 -1
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/routes.py +9267 -9847
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/settings/model_map.py +65 -50
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/settings/prompts.py +128 -295
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/themes.py +17 -17
- syntaxmatrix-3.0.2/syntaxmatrix/premium/__init__.py +0 -18
- syntaxmatrix-3.0.2/syntaxmatrix/premium/catalogue/__init__.py +0 -121
- syntaxmatrix-3.0.2/syntaxmatrix/premium/state.py +0 -507
- syntaxmatrix-3.0.2/syntaxmatrix/premium/verify.py +0 -222
- syntaxmatrix-3.0.2/syntaxmatrix/static/icons/bot_icon.png +0 -0
- syntaxmatrix-3.0.2/syntaxmatrix/vectordb/adapters/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/MANIFEST.in +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/README.md +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/SyntaxMatrix.egg-info/dependency_links.txt +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/SyntaxMatrix.egg-info/requires.txt +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/SyntaxMatrix.egg-info/top_level.txt +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/pyproject.toml +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/setup.cfg +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/agent_tools.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/agents_orchestrer.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/code_tools_registry.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/agentic/model_templates.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/auth.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/bootstrap.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/client_docs.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/commentary.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/dataset_preprocessing.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/db.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/db_backends/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/db_backends/postgres_backend.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/db_backends/sqlite_backend.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/db_contract.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/display_html.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/emailer.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/file_processor.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/gpt_models_latest.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/history_store.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/kernel_manager.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/llm_store.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/media/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/media/media_pixabay.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/models.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/page_builder_defaults.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/page_layout_contract.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/page_patch_publish.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/plottings.py +0 -0
- {syntaxmatrix-3.0.2/syntaxmatrix/plugins → syntaxmatrix-3.0.4/syntaxmatrix}/plugin_manager.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/preface.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/project_root.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/selftest_page_templates.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/session.py +0 -0
- {syntaxmatrix-3.0.2/syntaxmatrix/plugins → syntaxmatrix-3.0.4/syntaxmatrix/settings}/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/settings/client_items.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/settings/logging.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/settings/string_navbar.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/smiv.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/smpv.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/assets/hero-default.svg +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/css/style.css +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/docs.md +0 -0
- /syntaxmatrix-3.0.2/syntaxmatrix/static/icons/bot_icon2.png → /syntaxmatrix-3.0.4/syntaxmatrix/static/icons/bot_icon.png +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/icons/favicon.png +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/icons/logo.png +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/icons/logo2.png +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/icons/svg_497526.svg +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/icons/svg_497528.svg +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/js/chat.js +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/js/sidebar.js +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/static/js/widgets.js +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/admin_billing.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/admin_branding.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/admin_features.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/admin_secretes.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/change_password.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/code_cell.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/dashboard.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/dataset_resize.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/docs.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/edit_page.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/error.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/login.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/templates/register.html +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/ui_modes.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/utils.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vector_db.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/__init__.py +0 -0
- {syntaxmatrix-3.0.2/syntaxmatrix/settings → syntaxmatrix-3.0.4/syntaxmatrix/vectordb/adapters}/__init__.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/adapters/milvus_adapter.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/adapters/pgvector_adapter.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/adapters/sqlite_adapter.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/base.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectordb/registry.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/vectorizer.py +0 -0
- {syntaxmatrix-3.0.2 → syntaxmatrix-3.0.4}/syntaxmatrix/workspace_db.py +0 -0
|
@@ -29,6 +29,7 @@ syntaxmatrix/page_builder_generation.py
|
|
|
29
29
|
syntaxmatrix/page_layout_contract.py
|
|
30
30
|
syntaxmatrix/page_patch_publish.py
|
|
31
31
|
syntaxmatrix/plottings.py
|
|
32
|
+
syntaxmatrix/plugin_manager.py
|
|
32
33
|
syntaxmatrix/preface.py
|
|
33
34
|
syntaxmatrix/profiles.py
|
|
34
35
|
syntaxmatrix/project_root.py
|
|
@@ -59,13 +60,8 @@ syntaxmatrix/db_backends/postgres_backend.py
|
|
|
59
60
|
syntaxmatrix/db_backends/sqlite_backend.py
|
|
60
61
|
syntaxmatrix/media/__init__.py
|
|
61
62
|
syntaxmatrix/media/media_pixabay.py
|
|
62
|
-
syntaxmatrix/plugins/__init__.py
|
|
63
|
-
syntaxmatrix/plugins/plugin_manager.py
|
|
64
63
|
syntaxmatrix/premium/__init__.py
|
|
65
64
|
syntaxmatrix/premium/gate.py
|
|
66
|
-
syntaxmatrix/premium/state.py
|
|
67
|
-
syntaxmatrix/premium/verify.py
|
|
68
|
-
syntaxmatrix/premium/catalogue/__init__.py
|
|
69
65
|
syntaxmatrix/settings/__init__.py
|
|
70
66
|
syntaxmatrix/settings/client_items.py
|
|
71
67
|
syntaxmatrix/settings/logging.py
|
|
@@ -76,7 +72,6 @@ syntaxmatrix/static/docs.md
|
|
|
76
72
|
syntaxmatrix/static/assets/hero-default.svg
|
|
77
73
|
syntaxmatrix/static/css/style.css
|
|
78
74
|
syntaxmatrix/static/icons/bot_icon.png
|
|
79
|
-
syntaxmatrix/static/icons/bot_icon2.png
|
|
80
75
|
syntaxmatrix/static/icons/favicon.png
|
|
81
76
|
syntaxmatrix/static/icons/logo.png
|
|
82
77
|
syntaxmatrix/static/icons/logo2.png
|
|
@@ -597,8 +597,8 @@ def classify_ml_job_agent(refined_question, dataset_profile):
|
|
|
597
597
|
def agentic_generate_page(*,
|
|
598
598
|
page_slug: str,
|
|
599
599
|
website_description: str,
|
|
600
|
-
page_instructions: str = "",
|
|
601
600
|
client_dir: str,
|
|
601
|
+
page_instructions: str = "",
|
|
602
602
|
pixabay_api_key: str = "",
|
|
603
603
|
llm_profile: dict | None = None,
|
|
604
604
|
max_retries: int = 2,
|
|
@@ -753,7 +753,7 @@ def agentic_generate_page(*,
|
|
|
753
753
|
return json.loads(m.group(0))
|
|
754
754
|
|
|
755
755
|
|
|
756
|
-
if provider == "google":
|
|
756
|
+
if provider.lower() == "google":
|
|
757
757
|
cfg = types.GenerateContentConfig(
|
|
758
758
|
system_instruction=system_prompt,
|
|
759
759
|
response_mime_type="application/json",
|
|
@@ -1478,21 +1478,21 @@ def agentic_generate_page(*,
|
|
|
1478
1478
|
css = f"""
|
|
1479
1479
|
<style>
|
|
1480
1480
|
#{page_id} {{
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1481
|
+
--r: 18px;
|
|
1482
|
+
--bd: rgba(148,163,184,.25);
|
|
1483
|
+
--fg: #0f172a;
|
|
1484
|
+
--mut: #475569;
|
|
1485
|
+
--card: rgba(255,255,255,.78);
|
|
1486
|
+
--bg: #f8fafc;
|
|
1487
|
+
font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
|
|
1488
|
+
background: var(--bg);
|
|
1489
|
+
color: var(--fg);
|
|
1490
|
+
overflow-x: clip;
|
|
1491
1491
|
}}
|
|
1492
1492
|
@media (prefers-color-scheme: dark){{
|
|
1493
1493
|
#{page_id} {{
|
|
1494
1494
|
--fg: #e2e8f0;
|
|
1495
|
-
--mut: #
|
|
1495
|
+
--mut: #a7b3c6;
|
|
1496
1496
|
--card: rgba(2,6,23,.45);
|
|
1497
1497
|
--bg: radial-gradient(circle at 20% 10%, rgba(30,64,175,.25), rgba(2,6,23,.95) 55%);
|
|
1498
1498
|
--bd: rgba(148,163,184,.18);
|
|
@@ -1555,15 +1555,13 @@ def agentic_generate_page(*,
|
|
|
1555
1555
|
#{page_id} .hero-panel{{
|
|
1556
1556
|
max-width:700px;
|
|
1557
1557
|
border:1px solid rgba(148,163,184,.30);
|
|
1558
|
+
background:rgba(2,6,23,.24);
|
|
1558
1559
|
border-radius:var(--r);
|
|
1559
1560
|
padding:18px;
|
|
1561
|
+
backdrop-filter: blur(4px);
|
|
1560
1562
|
-webkit-backdrop-filter: blur(4px);
|
|
1561
1563
|
box-shadow: 0 18px 40px rgba(2,6,23,.18);
|
|
1562
1564
|
color:#e2e8f0;
|
|
1563
|
-
background:rgba(2,6,23,.13); /* more transparent */
|
|
1564
|
-
backdrop-filter: blur(18px) saturate(155%);
|
|
1565
|
-
-webkit-backdrop-filter: blur(18px) saturate(155%);
|
|
1566
|
-
|
|
1567
1565
|
}}
|
|
1568
1566
|
#{page_id} .hero-panel p{{ color:rgba(226,232,240,.84); }}
|
|
1569
1567
|
#{page_id} .hero-panel h1{{ text-shadow:0 10px 30px rgba(2,6,23,.45); }}
|
|
@@ -16,7 +16,7 @@ from .file_processor import process_admin_pdf_files
|
|
|
16
16
|
from google.genai import types
|
|
17
17
|
from .vector_db import query_embeddings
|
|
18
18
|
from .vectorizer import embed_text
|
|
19
|
-
from typing import List, Generator
|
|
19
|
+
from typing import List, Generator
|
|
20
20
|
from .auth import init_auth_db
|
|
21
21
|
from . import profiles as _prof
|
|
22
22
|
from syntaxmatrix.smiv import SMIV
|
|
@@ -27,15 +27,16 @@ from html import unescape
|
|
|
27
27
|
from .plottings import render_plotly, pyplot, describe_plotly, describe_matplotlib
|
|
28
28
|
from threading import RLock
|
|
29
29
|
from syntaxmatrix.settings.model_map import GPT_MODELS_LATEST
|
|
30
|
-
from syntaxmatrix.settings.client_items import read_client_file, getenv_api_key
|
|
31
|
-
from syntaxmatrix.plugins.plugin_manager import PluginManager
|
|
32
|
-
from .premium import FeatureGate, ensure_premium_state
|
|
33
|
-
from pathlib import Path
|
|
34
30
|
from syntaxmatrix.settings.prompts import(
|
|
35
31
|
SMXAI_CHAT_IDENTITY,
|
|
36
32
|
SMXAI_CHAT_INSTRUCTIONS,
|
|
37
33
|
SMXAI_WEBSITE_DESCRIPTION,
|
|
38
34
|
)
|
|
35
|
+
from syntaxmatrix.settings.client_items import read_client_file, getenv_api_key
|
|
36
|
+
|
|
37
|
+
from .premium import FeatureGate
|
|
38
|
+
from .plugin_manager import PluginManager
|
|
39
|
+
from pathlib import Path
|
|
39
40
|
|
|
40
41
|
# ──────── framework‐local storage paths ────────
|
|
41
42
|
# this ensures the key & data always live under the package dir,
|
|
@@ -58,15 +59,15 @@ EDA_OUTPUT = {} # global buffer for EDA output by session
|
|
|
58
59
|
|
|
59
60
|
class SyntaxMUI:
|
|
60
61
|
def __init__(self,
|
|
61
|
-
|
|
62
|
+
host="127.0.0.1",
|
|
62
63
|
port="5080",
|
|
63
64
|
user_icon="👩🏿🦲",
|
|
64
65
|
bot_icon="<img src='/static/icons/bot_icon.png' width=20' alt='bot'/>",
|
|
65
66
|
favicon="/static/icons/favicon.png",
|
|
66
|
-
site_logo="<img src='/static/icons/logo.png' width='
|
|
67
|
+
site_logo="<img src='/static/icons/logo.png' width='25' alt='logo'/>",
|
|
67
68
|
site_title="SyntaxMatrix",
|
|
68
69
|
project_name="smxAI",
|
|
69
|
-
theme_name="
|
|
70
|
+
theme_name="light",
|
|
70
71
|
ui_mode = "default"
|
|
71
72
|
):
|
|
72
73
|
self.app = Flask(__name__)
|
|
@@ -111,16 +112,11 @@ class SyntaxMUI:
|
|
|
111
112
|
self.db = db
|
|
112
113
|
self.page = ""
|
|
113
114
|
self.pages = db.get_pages()
|
|
114
|
-
|
|
115
115
|
init_auth_db()
|
|
116
|
-
try:
|
|
117
|
-
ensure_premium_state(db=db, client_dir=str(_CLIENT_DIR), trial_days=7)
|
|
118
|
-
except Exception:
|
|
119
|
-
pass
|
|
120
116
|
|
|
121
117
|
self.widgets = OrderedDict()
|
|
122
|
-
self.theme = DEFAULT_THEMES.get(theme_name, DEFAULT_THEMES["
|
|
123
|
-
self.system_output_buffer = "" # Ephemeral buffer
|
|
118
|
+
self.theme = DEFAULT_THEMES.get(theme_name, DEFAULT_THEMES["light"])
|
|
119
|
+
self.system_output_buffer = "" # Ephemeral buffer initialized
|
|
124
120
|
self.app_token = str(uuid.uuid4()) # NEW: Unique token for each app launch.
|
|
125
121
|
self.admin_pdf_chunks = {} # In-memory store for admin PDF chunks
|
|
126
122
|
self.user_file_chunks = {} # In-memory store of user‑uploaded chunks, scoped per chat
|
|
@@ -202,7 +198,7 @@ class SyntaxMUI:
|
|
|
202
198
|
if not hasattr(self, "_recent_visual_summaries"):
|
|
203
199
|
self._recent_visual_summaries = []
|
|
204
200
|
# keep last 6
|
|
205
|
-
self._recent_visual_summaries = (self._recent_visual_summaries + [summary])
|
|
201
|
+
self._recent_visual_summaries = (self._recent_visual_summaries + [summary])[-6:]
|
|
206
202
|
|
|
207
203
|
def set_plottings(self, fig_or_html, note=None):
|
|
208
204
|
# prefer current chat id; fall back to per-browser sid; finally "default"
|
|
@@ -333,7 +329,7 @@ class SyntaxMUI:
|
|
|
333
329
|
- 'score': cosine similarity score (0–1)
|
|
334
330
|
- 'metadata': dict, e.g. {'file_name': ..., 'chunk_index': ...}
|
|
335
331
|
"""
|
|
336
|
-
# 2) Fetch nearest neighbors from
|
|
332
|
+
# 2) Fetch nearest neighbors from the sqlite vector store
|
|
337
333
|
results = query_embeddings(q_vec, top_k=top_k)
|
|
338
334
|
return results
|
|
339
335
|
|
|
@@ -360,8 +356,8 @@ class SyntaxMUI:
|
|
|
360
356
|
DEFAULT_THEMES[theme_name] = theme
|
|
361
357
|
self.theme = DEFAULT_THEMES[theme_name]
|
|
362
358
|
else:
|
|
363
|
-
self.theme = DEFAULT_THEMES["
|
|
364
|
-
self.error("Theme must be '
|
|
359
|
+
self.theme = DEFAULT_THEMES["light"]
|
|
360
|
+
self.error("Theme must be 'light', 'dark', or a custom dict.")
|
|
365
361
|
|
|
366
362
|
def enable_theme_toggle(self, bul: bool = True):
|
|
367
363
|
self.theme_toggle_enabled = bool(bul)
|
|
@@ -447,31 +443,6 @@ class SyntaxMUI:
|
|
|
447
443
|
use it; otherwise keep the framework defaults.
|
|
448
444
|
Also pulls site_title and project_name from app_settings.
|
|
449
445
|
"""
|
|
450
|
-
|
|
451
|
-
# Premium gating: ignore custom branding unless entitled.
|
|
452
|
-
try:
|
|
453
|
-
if hasattr(self, "feature_gate") and self.feature_gate and (not self.feature_gate.enabled("branding_controls")):
|
|
454
|
-
self.site_logo = getattr(self, "_default_site_logo", self.site_logo)
|
|
455
|
-
self.favicon = getattr(self, "_default_favicon", self.favicon)
|
|
456
|
-
self.bot_icon = getattr(self, "_default_bot_icon", self.bot_icon)
|
|
457
|
-
try:
|
|
458
|
-
self.set_smxai_identity("")
|
|
459
|
-
self.set_smxai_instructions("")
|
|
460
|
-
self.set_website_description(getattr(self, "_default_website_description", self.website_description))
|
|
461
|
-
except Exception:
|
|
462
|
-
pass
|
|
463
|
-
self.site_title = getattr(self, "_default_site_title", self.site_title)
|
|
464
|
-
self.project_name = getattr(self, "_default_project_name", self.project_name)
|
|
465
|
-
return
|
|
466
|
-
except Exception:
|
|
467
|
-
# Fail closed: if we cannot resolve entitlements, do not apply custom branding.
|
|
468
|
-
self.site_logo = getattr(self, "_default_site_logo", self.site_logo)
|
|
469
|
-
self.favicon = getattr(self, "_default_favicon", self.favicon)
|
|
470
|
-
self.bot_icon = getattr(self, "_default_bot_icon", self.bot_icon)
|
|
471
|
-
self.site_title = getattr(self, "_default_site_title", self.site_title)
|
|
472
|
-
self.project_name = getattr(self, "_default_project_name", self.project_name)
|
|
473
|
-
return
|
|
474
|
-
|
|
475
446
|
branding_dir = os.path.join(_CLIENT_DIR, "branding")
|
|
476
447
|
|
|
477
448
|
def _pick_any(*basenames: str):
|
|
@@ -917,7 +888,7 @@ class SyntaxMUI:
|
|
|
917
888
|
)
|
|
918
889
|
return response.text.strip()
|
|
919
890
|
except Exception as e:
|
|
920
|
-
return f"Google Summary agent error
|
|
891
|
+
return f"Google Summary agent error!"
|
|
921
892
|
|
|
922
893
|
def gpt_models_latest_generated_title():
|
|
923
894
|
try:
|
|
@@ -1014,14 +985,19 @@ class SyntaxMUI:
|
|
|
1014
985
|
"""
|
|
1015
986
|
|
|
1016
987
|
try:
|
|
1017
|
-
if _provider == "google":
|
|
1018
|
-
|
|
988
|
+
if _provider == "google": # Google, non openai skd series
|
|
989
|
+
|
|
990
|
+
for chunk in _client.models.generate_content_stream(
|
|
1019
991
|
model=_model,
|
|
1020
992
|
contents=_contents,
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
993
|
+
config=types.GenerateContentConfig(
|
|
994
|
+
system_instruction=self.smxai_identity,
|
|
995
|
+
temperature=0.3,
|
|
996
|
+
max_output_tokens=1024,
|
|
997
|
+
),
|
|
998
|
+
):
|
|
999
|
+
|
|
1000
|
+
yield chunk.text
|
|
1025
1001
|
|
|
1026
1002
|
elif _provider == "openai" and _model in self.get_gpt_models_latest(): # GPt 5 series
|
|
1027
1003
|
input_prompt = (
|
|
@@ -1068,7 +1044,7 @@ class SyntaxMUI:
|
|
|
1068
1044
|
if token:
|
|
1069
1045
|
yield token
|
|
1070
1046
|
except Exception as e:
|
|
1071
|
-
yield f"Error during streaming:
|
|
1047
|
+
yield f"Error during streaming: {type(e).__name__}: {e}"
|
|
1072
1048
|
|
|
1073
1049
|
|
|
1074
1050
|
def process_query(self, query, context, history, stream=False):
|
|
@@ -1082,7 +1058,7 @@ class SyntaxMUI:
|
|
|
1082
1058
|
Login to the admin panel and add the LLM profile for chatting or contact your administrator.
|
|
1083
1059
|
</p>
|
|
1084
1060
|
"""
|
|
1085
|
-
|
|
1061
|
+
return None
|
|
1086
1062
|
|
|
1087
1063
|
self.chat_profile = chat_profile
|
|
1088
1064
|
self.chat_profile['client'] = _prof.get_client(chat_profile)
|
|
@@ -1638,12 +1614,7 @@ class SyntaxMUI:
|
|
|
1638
1614
|
current_profile['client'] = _prof.get_client(current_profile)
|
|
1639
1615
|
return current_profile
|
|
1640
1616
|
|
|
1641
|
-
def run(self
|
|
1617
|
+
def run(self):
|
|
1642
1618
|
url = f"http://{self.host}:{self.port}/"
|
|
1643
|
-
|
|
1644
|
-
if browser:
|
|
1645
|
-
webbrowser.get(browser).open(url)
|
|
1646
|
-
else:
|
|
1647
|
-
webbrowser.open(url)
|
|
1648
|
-
|
|
1619
|
+
webbrowser.open(url)
|
|
1649
1620
|
self.app.run(host=self.host, port=self.port, debug=False)
|
|
@@ -870,6 +870,12 @@ def compile_layout_to_html(layout: Dict[str, Any], *, page_slug: str) -> str:
|
|
|
870
870
|
border:1px solid var(--bd);text-decoration:none;background:rgba(99,102,241,.12)}
|
|
871
871
|
.smxp .btn:hover{transform:translateY(-1px)}
|
|
872
872
|
.smxp .grid{display:grid;gap:12px}
|
|
873
|
+
/* Mobile: force single-column grids (Page Studio pages only) */
|
|
874
|
+
@media (max-width: 720px){
|
|
875
|
+
.smxp section:not([data-section-type="gallery"]) .grid{
|
|
876
|
+
grid-template-columns: 1fr !important;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
873
879
|
.smxp .card{border:1px solid var(--bd);border-radius:var(--r);background:var(--card);padding:14px;min-width:0}
|
|
874
880
|
.smxp .card h3{
|
|
875
881
|
margin:10px 0 6px;
|
|
@@ -1459,7 +1465,6 @@ def compile_layout_to_html(layout: Dict[str, Any], *, page_slug: str) -> str:
|
|
|
1459
1465
|
<div class="hero-overlay"></div>
|
|
1460
1466
|
<div class="wrap hero-content">
|
|
1461
1467
|
<div class="hero-panel reveal">
|
|
1462
|
-
<p class="kicker">Generated page</p>
|
|
1463
1468
|
<h1>{title}</h1>
|
|
1464
1469
|
<p class="lead">{text}</p>
|
|
1465
1470
|
{btn_row_html}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Premium support.
|
|
2
|
+
|
|
3
|
+
This package contains runtime plumbing for premium features (entitlements +
|
|
4
|
+
plugin loading). The actual premium implementations should live in separate,
|
|
5
|
+
private distributions.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .gate import FeatureGate
|
|
9
|
+
|
|
10
|
+
__all__ = ["FeatureGate"]
|
|
@@ -47,24 +47,12 @@ class FeatureGate:
|
|
|
47
47
|
self._sources = sources or GateSources()
|
|
48
48
|
self._cache: Optional[Dict[str, Any]] = None
|
|
49
49
|
|
|
50
|
-
def _normalise(self, data: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
|
|
51
|
-
if not isinstance(data, dict):
|
|
52
|
-
return None
|
|
53
|
-
if isinstance(data.get("entitlements"), dict):
|
|
54
|
-
ent = dict(data.get("entitlements") or {})
|
|
55
|
-
if data.get("plan") and not ent.get("plan"):
|
|
56
|
-
ent["plan"] = data.get("plan")
|
|
57
|
-
return ent
|
|
58
|
-
return data
|
|
59
|
-
|
|
60
|
-
|
|
61
50
|
def _load_from_env(self) -> Optional[Dict[str, Any]]:
|
|
62
51
|
raw = os.environ.get(self._sources.env_json)
|
|
63
52
|
if not raw:
|
|
64
53
|
return None
|
|
65
54
|
data = _safe_json_loads(raw, default=None)
|
|
66
|
-
return
|
|
67
|
-
|
|
55
|
+
return data if isinstance(data, dict) else None
|
|
68
56
|
|
|
69
57
|
def _load_from_db(self) -> Optional[Dict[str, Any]]:
|
|
70
58
|
if not self._db:
|
|
@@ -75,7 +63,7 @@ class FeatureGate:
|
|
|
75
63
|
|
|
76
64
|
raw = get_setting(self._sources.db_setting_key, "{}")
|
|
77
65
|
data = _safe_json_loads(str(raw or "{}"), default={})
|
|
78
|
-
return
|
|
66
|
+
return data if isinstance(data, dict) else None
|
|
79
67
|
|
|
80
68
|
def _load_from_file(self) -> Optional[Dict[str, Any]]:
|
|
81
69
|
p = os.path.join(self._client_dir, self._sources.licence_file_relpath)
|
|
@@ -84,7 +72,7 @@ class FeatureGate:
|
|
|
84
72
|
try:
|
|
85
73
|
with open(p, "r", encoding="utf-8") as f:
|
|
86
74
|
data = json.load(f)
|
|
87
|
-
return
|
|
75
|
+
return data if isinstance(data, dict) else None
|
|
88
76
|
except Exception:
|
|
89
77
|
return None
|
|
90
78
|
|