Skip to content

Commit

Permalink
fix: correct user_id access logic (langflow-ai#4595)
Browse files Browse the repository at this point in the history
fix: correct user_id access logic.
  • Loading branch information
dhlidongming authored Nov 14, 2024
1 parent 2f96dbb commit 0f5c31f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def graph(self):

@property
def user_id(self):
if hasattr(self, "_user_id"):
if hasattr(self, "_user_id") and self._user_id:
return self._user_id
return self.graph.user_id

Expand Down Expand Up @@ -477,7 +477,7 @@ async def load_flow(self, flow_id: str, tweaks: dict | None = None) -> Graph:
if not self.user_id:
msg = "Session is invalid"
raise ValueError(msg)
return await load_flow(user_id=str(self._user_id), flow_id=flow_id, tweaks=tweaks)
return await load_flow(user_id=str(self.user_id), flow_id=flow_id, tweaks=tweaks)

async def run_flow(
self,
Expand All @@ -493,7 +493,7 @@ async def run_flow(
flow_id=flow_id,
flow_name=flow_name,
tweaks=tweaks,
user_id=str(self._user_id),
user_id=str(self.user_id),
run_id=self.graph.run_id,
)

Expand All @@ -502,7 +502,7 @@ def list_flows(self) -> list[Data]:
msg = "Session is invalid"
raise ValueError(msg)
try:
return list_flows(user_id=str(self._user_id))
return list_flows(user_id=str(self.user_id))
except Exception as e:
msg = f"Error listing flows: {e}"
raise ValueError(msg) from e
Expand Down

0 comments on commit 0f5c31f

Please sign in to comment.