mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-20 13:05:49 +02:00
@@ -111,6 +111,7 @@ async def login_as_anonymous_user(
|
|||||||
token = generate_anonymous_user_jwt_token(tenant_id)
|
token = generate_anonymous_user_jwt_token(tenant_id)
|
||||||
|
|
||||||
response = Response()
|
response = Response()
|
||||||
|
response.delete_cookie("fastapiusersauth")
|
||||||
response.set_cookie(
|
response.set_cookie(
|
||||||
key=ANONYMOUS_USER_COOKIE_NAME,
|
key=ANONYMOUS_USER_COOKIE_NAME,
|
||||||
value=token,
|
value=token,
|
||||||
|
@@ -11,7 +11,7 @@ from sqlalchemy import Select
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy import update
|
from sqlalchemy import update
|
||||||
from sqlalchemy.orm import aliased
|
from sqlalchemy.orm import aliased
|
||||||
from sqlalchemy.orm import joinedload
|
from sqlalchemy.orm import selectinload
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from onyx.auth.schemas import UserRole
|
from onyx.auth.schemas import UserRole
|
||||||
@@ -291,8 +291,9 @@ def get_personas_for_user(
|
|||||||
include_deleted: bool = False,
|
include_deleted: bool = False,
|
||||||
joinedload_all: bool = False,
|
joinedload_all: bool = False,
|
||||||
) -> Sequence[Persona]:
|
) -> Sequence[Persona]:
|
||||||
stmt = select(Persona).distinct()
|
stmt = select(Persona)
|
||||||
stmt = _add_user_filters(stmt=stmt, user=user, get_editable=get_editable)
|
stmt = _add_user_filters(stmt, user, get_editable)
|
||||||
|
|
||||||
if not include_default:
|
if not include_default:
|
||||||
stmt = stmt.where(Persona.builtin_persona.is_(False))
|
stmt = stmt.where(Persona.builtin_persona.is_(False))
|
||||||
if not include_slack_bot_personas:
|
if not include_slack_bot_personas:
|
||||||
@@ -302,14 +303,16 @@ def get_personas_for_user(
|
|||||||
|
|
||||||
if joinedload_all:
|
if joinedload_all:
|
||||||
stmt = stmt.options(
|
stmt = stmt.options(
|
||||||
joinedload(Persona.prompts),
|
selectinload(Persona.prompts),
|
||||||
joinedload(Persona.tools),
|
selectinload(Persona.tools),
|
||||||
joinedload(Persona.document_sets),
|
selectinload(Persona.document_sets),
|
||||||
joinedload(Persona.groups),
|
selectinload(Persona.groups),
|
||||||
joinedload(Persona.users),
|
selectinload(Persona.users),
|
||||||
|
selectinload(Persona.labels),
|
||||||
)
|
)
|
||||||
|
|
||||||
return db_session.execute(stmt).unique().scalars().all()
|
results = db_session.execute(stmt).scalars().all()
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def get_personas(db_session: Session) -> Sequence[Persona]:
|
def get_personas(db_session: Session) -> Sequence[Persona]:
|
||||||
|
Reference in New Issue
Block a user