все источники
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-11 22:16:33 +10:00
parent 662cfa0994
commit 4405400715
2 changed files with 16 additions and 1 deletions

View File

@@ -228,7 +228,7 @@ def check_error_url(error_sources_url: str) -> bool:
finally:
pass
# Создание и работа с таблицей источников add_sources
# Создание и работа с таблицей источников sources
def create_table_add_sourse():
conn = get_connection()
try:
@@ -257,6 +257,17 @@ def add_sources(url: str, promt: str):
finally:
pass
def get_all_sources():
"""Возвращает все записи из таблицы sourse"""
conn = get_connection()
try:
with conn.cursor(cursor_factory=RealDictCursor) as cur:
cur.execute("SELECT * FROM sourse")
rows = cur.fetchall()
sources = [{"url": row["url"], "promt": row["promt"]} for row in rows]
return {"sources": sources}
finally:
pass
# Пример использования
# if __name__ == "__main__":
# # create_table_config_gpt() # <-- раскомментировать эту строку