Skip to content

Commit

Permalink
rename id to finic_id and user_defined_id to id
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwcfan committed Sep 11, 2024
1 parent 120b7e7 commit eee6f1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions server/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ async def upsert_agent(self, agent: Agent) -> Optional[Agent]:
return None

async def get_agent(
self, config: AppConfig, user_defined_id: str
self, config: AppConfig, id: str
) -> Optional[Agent]:
response = (
self.supabase.table("agent")
.select("*")
.filter("app_id", "eq", config.app_id)
.filter("id", "eq", user_defined_id)
.filter("id", "eq", id)
.execute()
)
if len(response.data) > 0:
Expand Down
2 changes: 1 addition & 1 deletion server/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ExecutionStatus(str, Enum):


class Agent(BaseModel):
finic_id: str
id: str
user_defined_id: str
app_id: str
name: str
status: AgentStatus
Expand Down
16 changes: 8 additions & 8 deletions server/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def deploy_agent(
config: AppConfig = Depends(validate_token),
):
try:
agent = await db.get_agent(config=config, user_defined_id=request.agent_id)
agent = await db.get_agent(config=config, id=request.agent_id)
agent.status = AgentStatus.deploying
await db.upsert_agent(agent)
deployer = AgentDeployer(db=db, config=config)
Expand All @@ -130,12 +130,12 @@ async def get_agent_upload_link(
):
try:
deployer = AgentDeployer(db=db, config=config)
agent = await db.get_agent(config=config, user_defined_id=request.agent_id)
agent = await db.get_agent(config=config, id=request.agent_id)
if agent is None:
agent = Agent(
id=str(uuid.uuid4()),
finic_id=str(uuid.uuid4()),
app_id=config.app_id,
user_defined_id=request.agent_id,
id=request.agent_id,
name=request.agent_name,
num_retries=request.num_retries,
status="deploying",
Expand All @@ -155,7 +155,7 @@ async def run_agent(
):
try:
runner = AgentRunner(db=db, config=config)
agent = await db.get_agent(config=config, user_defined_id=request.agent_id)
agent = await db.get_agent(config=config, id=request.agent_id)
if agent is None:
raise HTTPException(
status_code=404, detail=f"Agent {request.agent_id} not found"
Expand All @@ -174,7 +174,7 @@ async def get_agent(
config: AppConfig = Depends(validate_token),
):
try:
agent = await db.get_agent(config=config, user_defined_id=agent_id)
agent = await db.get_agent(config=config, id=agent_id)
return agent
except Exception as e:
print(e)
Expand All @@ -200,7 +200,7 @@ async def get_execution(
config: AppConfig = Depends(validate_token),
):
try:
agent = await db.get_agent(config=config, user_defined_id=agent_id)
agent = await db.get_agent(config=config, id=agent_id)
execution = await db.get_execution(
config=config, agent_id=agent.id, execution_id=execution_id
)
Expand All @@ -216,7 +216,7 @@ async def list_executions(
config: AppConfig = Depends(validate_token),
):
try:
agent = await db.get_agent(config=config, user_defined_id=agent_id)
agent = await db.get_agent(config=config, id=agent_id)
executions = await db.list_executions(config=config, agent_id=agent.id)
return executions
except Exception as e:
Expand Down

0 comments on commit eee6f1f

Please sign in to comment.