-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f5a2b4
commit 814f97c
Showing
19 changed files
with
413 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Milestone | ||
Revision ID: 91a0a4d62b14 | ||
Revises: dab04867cd88 | ||
Create Date: 2024-12-13 19:03:30.947551 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
import fastapi_users_db_sqlalchemy | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "91a0a4d62b14" | ||
down_revision = "dab04867cd88" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"milestone", | ||
sa.Column("id", sa.UUID(), nullable=False), | ||
sa.Column("tenant_id", sa.String(), nullable=True), | ||
sa.Column( | ||
"user_id", | ||
fastapi_users_db_sqlalchemy.generics.GUID(), | ||
nullable=True, | ||
), | ||
sa.Column("event_type", sa.String(), nullable=False), | ||
sa.Column( | ||
"time_created", | ||
sa.DateTime(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column("event_tracker", postgresql.JSONB(), nullable=True), | ||
sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("event_type", name="uq_milestone_event_type"), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table("milestone") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from posthog import Posthog | ||
|
||
from ee.onyx.configs.app_configs import POSTHOG_API_KEY | ||
from ee.onyx.configs.app_configs import POSTHOG_HOST | ||
|
||
posthog = Posthog(project_api_key=POSTHOG_API_KEY, host=POSTHOG_HOST) | ||
|
||
|
||
def event_telemetry( | ||
distinct_id: str, | ||
event: str, | ||
properties: dict | None = None, | ||
) -> None: | ||
posthog.capture(distinct_id, event, properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
from onyx.auth.schemas import UserRole | ||
from onyx.configs.constants import KV_NO_AUTH_USER_PREFERENCES_KEY | ||
from onyx.configs.constants import NO_AUTH_USER_EMAIL | ||
from onyx.configs.constants import NO_AUTH_USER_ID | ||
from onyx.key_value_store.store import KeyValueStore | ||
from onyx.key_value_store.store import KvKeyNotFoundError | ||
from onyx.server.manage.models import UserInfo | ||
|
@@ -30,8 +32,8 @@ def load_no_auth_user_preferences(store: KeyValueStore) -> UserPreferences: | |
|
||
def fetch_no_auth_user(store: KeyValueStore) -> UserInfo: | ||
return UserInfo( | ||
id="__no_auth_user__", | ||
email="[email protected]", | ||
id=NO_AUTH_USER_ID, | ||
email=NO_AUTH_USER_EMAIL, | ||
is_active=True, | ||
is_superuser=False, | ||
is_verified=True, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
DEFAULT_BOOST = 0 | ||
SESSION_KEY = "session" | ||
|
||
NO_AUTH_USER_ID = "__no_auth_user__" | ||
NO_AUTH_USER_EMAIL = "[email protected]" | ||
|
||
# For chunking/processing chunks | ||
RETURN_SEPARATOR = "\n\r\n" | ||
SECTION_SEPARATOR = "\n\n" | ||
|
@@ -210,6 +213,19 @@ class FileOrigin(str, Enum): | |
OTHER = "other" | ||
|
||
|
||
class MilestoneRecordType(str, Enum): | ||
TENANT_CREATED = "tenant_created" | ||
USER_SIGNED_UP = "user_signed_up" | ||
MULTIPLE_USERS = "multiple_users" | ||
VISITED_ADMIN_PAGE = "visited_admin_page" | ||
CREATED_CONNECTOR = "created_connector" | ||
CONNECTOR_SUCCEEDED = "connector_succeeded" | ||
RAN_QUERY = "ran_query" | ||
MULTIPLE_ASSISTANTS = "multiple_assistants" | ||
CREATED_ASSISTANT = "created_assistant" | ||
CREATED_ONYX_BOT = "created_onyx_bot" | ||
|
||
|
||
class PostgresAdvisoryLocks(Enum): | ||
KOMBU_MESSAGE_CLEANUP_LOCK_ID = auto() | ||
|
||
|
Oops, something went wrong.