mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-28 08:49:42 +02:00
fix: changes to update pipecat version to 0.0.100 (#122)
* feat: add stt evals * add smart turn as provider * chore: remove deprecations * chore: format files * fix: remove deprecated UserIdleProcessor * fix: remove deprecated TranscriptProcessor * chore: update pipecat submodule * feat: add evals visualisation * fix: trigger llm generation on client connected and pipeline started * chore: update pipecat * chore: update pipecat submodule * Add tests * fix: slow loading of workflow page * chore: update pipecat submodule * Show version after release * Fixes #99 * fix: provider check for websocket connection * Fixes #107 * Fix #96 * chore: fix documentation * fix: cloudonix campaign call error --------- Co-authored-by: Sabiha Khan <sabihak89@gmail.com>
This commit is contained in:
parent
a4367bd83b
commit
911c5ed416
104 changed files with 16919 additions and 597 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
|
|
@ -414,3 +415,56 @@ class WorkflowRunClient(BaseDBClient):
|
|||
|
||||
organization_id = workflow_run.workflow.user.selected_organization_id
|
||||
return workflow_run, organization_id
|
||||
|
||||
async def ensure_public_access_token(self, workflow_run_id: int) -> Optional[str]:
|
||||
"""Generate a public access token if not exists, return existing if present (idempotent).
|
||||
|
||||
Args:
|
||||
workflow_run_id: The ID of the workflow run
|
||||
|
||||
Returns:
|
||||
The public access token string, or None if workflow run not found
|
||||
"""
|
||||
async with self.async_session() as session:
|
||||
result = await session.execute(
|
||||
select(WorkflowRunModel).where(WorkflowRunModel.id == workflow_run_id)
|
||||
)
|
||||
run = result.scalars().first()
|
||||
if not run:
|
||||
return None
|
||||
|
||||
# Return existing token if present
|
||||
if run.public_access_token:
|
||||
return run.public_access_token
|
||||
|
||||
# Generate and persist new token
|
||||
token = str(uuid.uuid4())
|
||||
run.public_access_token = token
|
||||
|
||||
try:
|
||||
await session.commit()
|
||||
except Exception as e:
|
||||
await session.rollback()
|
||||
raise e
|
||||
await session.refresh(run)
|
||||
|
||||
return run.public_access_token
|
||||
|
||||
async def get_workflow_run_by_public_token(
|
||||
self, token: str
|
||||
) -> Optional[WorkflowRunModel]:
|
||||
"""Lookup workflow run by public access token.
|
||||
|
||||
Args:
|
||||
token: The public access token
|
||||
|
||||
Returns:
|
||||
The WorkflowRunModel if found, None otherwise
|
||||
"""
|
||||
async with self.async_session() as session:
|
||||
result = await session.execute(
|
||||
select(WorkflowRunModel).where(
|
||||
WorkflowRunModel.public_access_token == token
|
||||
)
|
||||
)
|
||||
return result.scalars().first()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue