Skip to content

Commit

Permalink
Merge branch 'main' into feat/desi_vocal_audio_tool
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkbrnd authored Dec 20, 2024
2 parents 6efdbf5 + 3a7077b commit 4fd6562
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion phi/playground/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,13 @@ async def run_workflow(workflow_id: str, body: WorkflowRunRequest):
if workflow is None:
raise HTTPException(status_code=404, detail="Workflow not found")

if body.session_id is not None:
logger.debug(f"Continuing session: {body.session_id}")
else:
logger.debug("Creating new session")

# Create a new instance of this workflow
new_workflow_instance = workflow.deep_copy(update={"workflow_id": workflow_id})
new_workflow_instance = workflow.deep_copy(update={"workflow_id": workflow_id, "session_id": body.session_id})
new_workflow_instance.user_id = body.user_id

# Return based on the response type
Expand Down
1 change: 1 addition & 0 deletions phi/playground/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ class WorkflowRenameRequest(BaseModel):
class WorkflowRunRequest(BaseModel):
input: Dict[str, Any]
user_id: Optional[str] = None
session_id: Optional[str] = None
4 changes: 3 additions & 1 deletion phi/workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ def __init__(self, **data):
self._run_parameters = {
name: {
"name": name,
"default": param.default if param.default is not inspect.Parameter.empty else None,
"default": param.default.default
if hasattr(param.default, "__class__") and param.default.__class__.__name__ == "FieldInfo"
else (param.default if param.default is not inspect.Parameter.empty else None),
"annotation": (
param.annotation.__name__
if hasattr(param.annotation, "__name__")
Expand Down

0 comments on commit 4fd6562

Please sign in to comment.