mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
feat: add posthog events (#231)
* feat: add posthog events * fix: workflow_duplicated event * chore: add events to enum
This commit is contained in:
parent
bb5f56bfb7
commit
3f19a16e7f
24 changed files with 450 additions and 93 deletions
|
|
@ -7,6 +7,7 @@ from fastapi import APIRouter, Depends, HTTPException, Query
|
|||
from loguru import logger
|
||||
|
||||
from api.db import db_client
|
||||
from api.enums import PostHogEvent
|
||||
from api.schemas.knowledge_base import (
|
||||
ChunkSearchRequestSchema,
|
||||
ChunkSearchResponseSchema,
|
||||
|
|
@ -17,6 +18,7 @@ from api.schemas.knowledge_base import (
|
|||
ProcessDocumentRequestSchema,
|
||||
)
|
||||
from api.services.auth.depends import get_user
|
||||
from api.services.posthog_client import capture_event
|
||||
from api.services.storage import storage_fs
|
||||
from api.tasks.arq import enqueue_job
|
||||
from api.tasks.function_names import FunctionNames
|
||||
|
|
@ -142,6 +144,18 @@ async def process_document(
|
|||
f"with OpenAI embeddings, org {user.selected_organization_id}"
|
||||
)
|
||||
|
||||
capture_event(
|
||||
distinct_id=str(user.provider_id),
|
||||
event=PostHogEvent.KNOWLEDGE_BASE_CREATED,
|
||||
properties={
|
||||
"document_id": document.id,
|
||||
"document_uuid": str(request.document_uuid),
|
||||
"filename": filename,
|
||||
"retrieval_mode": request.retrieval_mode,
|
||||
"organization_id": user.selected_organization_id,
|
||||
},
|
||||
)
|
||||
|
||||
return DocumentResponseSchema(
|
||||
id=document.id,
|
||||
document_uuid=request.document_uuid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue