feat(core): initial commit unified architecture (scud_ai v2.5 with modular web_api)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
Скрипт полной очистки истории диалогов и сессионных состояний SQLite.
|
||||
"""
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
# Рассчитываем путь к общей БД data/scud_orion_ai.db в корне проекта
|
||||
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../"))
|
||||
DB_PATH = os.path.join(BASE_DIR, "data", "scud_orion_ai.db")
|
||||
|
||||
def clear_chat_history():
|
||||
if not os.path.exists(DB_PATH):
|
||||
print(f"❌ База данных не найдена по адресу: {DB_PATH}")
|
||||
return
|
||||
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Очищаем таблицы сообщений и стейтов
|
||||
try:
|
||||
cursor.execute("DELETE FROM chat_messages;")
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
|
||||
try:
|
||||
cursor.execute("DELETE FROM session_states;")
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
|
||||
try:
|
||||
cursor.execute("DELETE FROM chat_sessions;")
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("✓ [SUCCESS] История сообщений чата и сессионные состояния успешно очищены!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
clear_chat_history()
|
||||
Reference in New Issue
Block a user