Spaces:
Running
Running
fix: skip UNIQUE/FK constraints in DDL parser; restrict prompt log + user mgmt to admins
Browse files- parse_ddl was treating UNIQUE/FOREIGN KEY/CHECK/INDEX table constraints as column
definitions, producing a phantom UNIQUE column that caused table creation to fail
- Prompt Log and User Management tabs now default to hidden, revealed by
check_admin_visibility on load (same pattern as Admin Settings tab)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- chat_interface.py +7 -3
- thoughtspot_deployer.py +1 -1
chat_interface.py
CHANGED
|
@@ -4395,7 +4395,7 @@ def create_chat_interface():
|
|
| 4395 |
interactive=False
|
| 4396 |
)
|
| 4397 |
|
| 4398 |
-
with gr.Tab("π Prompt Log"):
|
| 4399 |
gr.Markdown("### Prompt Log β What We Send to LLMs")
|
| 4400 |
gr.Markdown("*Every prompt and response is logged here for review. Updates every 5 seconds.*")
|
| 4401 |
prompt_log_display = gr.Markdown(
|
|
@@ -4421,7 +4421,7 @@ def create_chat_interface():
|
|
| 4421 |
outputs=[prompt_log_display]
|
| 4422 |
)
|
| 4423 |
|
| 4424 |
-
with gr.Tab("π€ User Management"):
|
| 4425 |
gr.Markdown("### User Management (Admin Only)")
|
| 4426 |
gr.Markdown("*Add, deactivate, or reset passwords for DemoPrep users.*")
|
| 4427 |
|
|
@@ -4732,12 +4732,16 @@ def create_chat_interface():
|
|
| 4732 |
gr.update(visible=is_admin), # admin_ai_accordion
|
| 4733 |
gr.update(visible=is_admin), # admin_db_accordion
|
| 4734 |
gr.update(visible=is_admin), # admin_settings_tab
|
|
|
|
|
|
|
| 4735 |
)
|
| 4736 |
-
|
| 4737 |
admin_outputs = [
|
| 4738 |
settings_components['_admin_ai_accordion'],
|
| 4739 |
settings_components['_admin_db_accordion'],
|
| 4740 |
admin_settings_tab,
|
|
|
|
|
|
|
| 4741 |
]
|
| 4742 |
|
| 4743 |
interface.load(
|
|
|
|
| 4395 |
interactive=False
|
| 4396 |
)
|
| 4397 |
|
| 4398 |
+
with gr.Tab("π Prompt Log", visible=False) as prompt_log_tab:
|
| 4399 |
gr.Markdown("### Prompt Log β What We Send to LLMs")
|
| 4400 |
gr.Markdown("*Every prompt and response is logged here for review. Updates every 5 seconds.*")
|
| 4401 |
prompt_log_display = gr.Markdown(
|
|
|
|
| 4421 |
outputs=[prompt_log_display]
|
| 4422 |
)
|
| 4423 |
|
| 4424 |
+
with gr.Tab("π€ User Management", visible=False) as user_mgmt_tab:
|
| 4425 |
gr.Markdown("### User Management (Admin Only)")
|
| 4426 |
gr.Markdown("*Add, deactivate, or reset passwords for DemoPrep users.*")
|
| 4427 |
|
|
|
|
| 4732 |
gr.update(visible=is_admin), # admin_ai_accordion
|
| 4733 |
gr.update(visible=is_admin), # admin_db_accordion
|
| 4734 |
gr.update(visible=is_admin), # admin_settings_tab
|
| 4735 |
+
gr.update(visible=is_admin), # prompt_log_tab
|
| 4736 |
+
gr.update(visible=is_admin), # user_mgmt_tab
|
| 4737 |
)
|
| 4738 |
+
|
| 4739 |
admin_outputs = [
|
| 4740 |
settings_components['_admin_ai_accordion'],
|
| 4741 |
settings_components['_admin_db_accordion'],
|
| 4742 |
admin_settings_tab,
|
| 4743 |
+
prompt_log_tab,
|
| 4744 |
+
user_mgmt_tab,
|
| 4745 |
]
|
| 4746 |
|
| 4747 |
interface.load(
|
thoughtspot_deployer.py
CHANGED
|
@@ -523,7 +523,7 @@ class ThoughtSpotDeployer:
|
|
| 523 |
})
|
| 524 |
print(f" π Found inline FK: {table_name}.{from_col} -> {to_table}.{to_col}")
|
| 525 |
|
| 526 |
-
if not line_upper.startswith(('PRIMARY KEY', 'CONSTRAINT')):
|
| 527 |
# Parse: COLUMNNAME DATATYPE(params) [IDENTITY] [NOT NULL]
|
| 528 |
parts = line.split()
|
| 529 |
if len(parts) >= 2:
|
|
|
|
| 523 |
})
|
| 524 |
print(f" π Found inline FK: {table_name}.{from_col} -> {to_table}.{to_col}")
|
| 525 |
|
| 526 |
+
if not line_upper.startswith(('PRIMARY KEY', 'CONSTRAINT', 'FOREIGN KEY', 'UNIQUE', 'CHECK', 'INDEX')):
|
| 527 |
# Parse: COLUMNNAME DATATYPE(params) [IDENTITY] [NOT NULL]
|
| 528 |
parts = line.split()
|
| 529 |
if len(parts) >= 2:
|