Skip to content

Commit

Permalink
update models
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Sep 20, 2024
1 parent b133716 commit bbf0344
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend/danswer/configs/app_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
os.environ.get("POSTGRES_PASSWORD") or "password"
)
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432"
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433"
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"

# defaults to False
Expand Down
4 changes: 3 additions & 1 deletion backend/danswer/db/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ def update_chat_session(


def delete_all_chat_sessions_for_user(
user: User, session_type: SessionType, db_session: Session
user: User | None, session_type: SessionType, db_session: Session
) -> None:
user_id = user.id if user is not None else None
query = db_session.query(ChatSession).filter(ChatSession.user_id == user_id)

if session_type == SessionType.SLACK:
raise ValueError("Slack sessions cannot be deleted en masse")
if session_type == SessionType.CHAT:
query = query.filter(ChatSession.one_shot.is_(False)) # type: ignore
elif session_type == SessionType.SEARCH:
Expand Down
7 changes: 1 addition & 6 deletions backend/danswer/server/query_and_chat/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import datetime
from enum import Enum
from typing import Any

from pydantic import BaseModel
Expand All @@ -9,6 +8,7 @@
from danswer.configs.constants import DocumentSource
from danswer.configs.constants import MessageType
from danswer.configs.constants import SearchFeedbackType
from danswer.configs.constants import SessionType
from danswer.db.enums import ChatSessionSharedStatus
from danswer.file_store.models import FileDescriptor
from danswer.llm.override_models import LLMOverride
Expand Down Expand Up @@ -130,11 +130,6 @@ class ChatSessionUpdateRequest(BaseModel):
sharing_status: ChatSessionSharedStatus


class SessionType(str, Enum):
CHAT = "chat"
SEARCH = "search"


class DeleteAllSessionsRequest(BaseModel):
session_type: SessionType

Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432:5432"
- "5433:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.gpu-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432:5432"
- "5433:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432"
- "5433"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down

0 comments on commit bbf0344

Please sign in to comment.