feat(db/llm/ui): настроена работа кнопок подтверждающих изменения внеcенные инструментом и финальные для выхода из инструмента и очистки сессии.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
FILE: modules/web_api/llm/db/db_prompts.py
|
||||
"""
|
||||
import json
|
||||
import logging
|
||||
from typing import List, Dict, Any, Optional
|
||||
from .connection import get_db_connection
|
||||
@@ -15,6 +16,25 @@ def db_get_active_system_prompt() -> str:
|
||||
conn.close()
|
||||
return row["prompt_text"] if row else "Ты — ИИ-ассистент SCUD Orion AI."
|
||||
|
||||
def db_get_tool_action(tool_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Получение шаблона и кнопок действия для инструмента из SQLite."""
|
||||
conn = get_db_connection()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
SELECT tool_name, category, bypass_llm, success_template,
|
||||
follow_up_question, action_type, buttons_json
|
||||
FROM tool_action_registry
|
||||
WHERE tool_name = ? AND is_active = 1
|
||||
""", (tool_name,))
|
||||
row = cursor.fetchone()
|
||||
conn.close()
|
||||
|
||||
if row:
|
||||
res = dict(row)
|
||||
res["buttons"] = json.loads(res["buttons_json"]) if res.get("buttons_json") else []
|
||||
return res
|
||||
return None
|
||||
|
||||
def db_add_system_prompt(name: str, prompt_text: str) -> Dict[str, Any]:
|
||||
try:
|
||||
with get_db_connection() as conn:
|
||||
|
||||
Reference in New Issue
Block a user