welcome to onyx

This commit is contained in:
pablodanswer
2024-12-13 09:48:43 -08:00
parent 54dcbfa288
commit 21ec5ed795
813 changed files with 7021 additions and 6824 deletions

View File

@@ -4,18 +4,18 @@ import sys
import psycopg2
from sqlalchemy.orm import Session
from danswer.db.engine import get_sqlalchemy_engine
from onyx.db.engine import get_sqlalchemy_engine
# makes it so `PYTHONPATH=.` is not required when running this script
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
from danswer.configs.app_configs import POSTGRES_DB # noqa: E402
from danswer.configs.app_configs import POSTGRES_HOST # noqa: E402
from danswer.configs.app_configs import POSTGRES_PASSWORD # noqa: E402
from danswer.configs.app_configs import POSTGRES_PORT # noqa: E402
from danswer.configs.app_configs import POSTGRES_USER # noqa: E402
from danswer.db.credentials import create_initial_public_credential # noqa: E402
from onyx.configs.app_configs import POSTGRES_DB # noqa: E402
from onyx.configs.app_configs import POSTGRES_HOST # noqa: E402
from onyx.configs.app_configs import POSTGRES_PASSWORD # noqa: E402
from onyx.configs.app_configs import POSTGRES_PORT # noqa: E402
from onyx.configs.app_configs import POSTGRES_USER # noqa: E402
from onyx.db.credentials import create_initial_public_credential # noqa: E402
def wipe_all_rows(database: str) -> None:
@@ -62,11 +62,11 @@ def wipe_all_rows(database: str) -> None:
if __name__ == "__main__":
print("Cleaning up all Danswer tables")
print("Cleaning up all Onyx tables")
wipe_all_rows(POSTGRES_DB)
with Session(get_sqlalchemy_engine(), expire_on_commit=False) as db_session:
create_initial_public_credential(db_session)
print("To keep data consistent, it's best to wipe the document index as well.")
print(
"To be safe, it's best to restart the Danswer services (API Server and Background Tasks"
"To be safe, it's best to restart the Onyx services (API Server and Background Tasks"
)