Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -3445,6 +3445,22 @@ def launch_ui(demo_mode=False):
|
|
| 3445 |
outputs=[search_results_output]
|
| 3446 |
)
|
| 3447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3448 |
# Sub-tab #4 for Search / Detailed view
|
| 3449 |
with gr.Tab("Add Prompts"):
|
| 3450 |
gr.Markdown("### Add Prompt")
|
|
|
|
| 3445 |
outputs=[search_results_output]
|
| 3446 |
)
|
| 3447 |
|
| 3448 |
+
def add_prompt(name, details, system, user=None):
|
| 3449 |
+
try:
|
| 3450 |
+
conn = sqlite3.connect('prompts.db')
|
| 3451 |
+
cursor = conn.cursor()
|
| 3452 |
+
cursor.execute('''
|
| 3453 |
+
INSERT INTO Prompts (name, details, system, user)
|
| 3454 |
+
VALUES (?, ?, ?, ?)
|
| 3455 |
+
''', (name, details, system, user))
|
| 3456 |
+
conn.commit()
|
| 3457 |
+
conn.close()
|
| 3458 |
+
return "Prompt added successfully."
|
| 3459 |
+
except sqlite3.IntegrityError:
|
| 3460 |
+
return "Prompt with this name already exists."
|
| 3461 |
+
except sqlite3.Error as e:
|
| 3462 |
+
return f"Database error: {e}"
|
| 3463 |
+
|
| 3464 |
# Sub-tab #4 for Search / Detailed view
|
| 3465 |
with gr.Tab("Add Prompts"):
|
| 3466 |
gr.Markdown("### Add Prompt")
|