Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sqlalchemy import Column, String, Text, ForeignKey, TIMESTAMP, text
from sqlalchemy.orm import relationship
from sqlalchemy.types import UUID as PG_UUID
from database import Base
from db_postgres import Base
from sqlalchemy.orm import relationship

class User(Base):
Expand Down Expand Up @@ -70,4 +70,4 @@ class TopicInstruction(Base):
id = Column(PG_UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
topic_id = Column(PG_UUID(as_uuid=True), ForeignKey("topics.id"), nullable=False)
instruction = Column(Text, nullable=False)
topic = relationship("Topic", back_populates="topic_instructions")
topic = relationship("Topic", back_populates="topic_instructions")
4 changes: 4 additions & 0 deletions routers/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def get_agents(
db: Session = Depends(get_db),
current_user: models.User = Depends(get_current_user)
):
agents = crud.get_agents(db)
# Populate creator information if not already done
for agent in agents:
agent.creator_name = f"{agent.user.first_name} {agent.user.last_name}"
return crud.get_agents(db)

@router.get("/agents/{agent_id}", response_model=agent_schemas.AgentResponse)
Expand Down
5 changes: 4 additions & 1 deletion schemas/agent_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class AgentResponse(AgentBase):
user_id: UUID
modified_by: Optional[UUID] = None
topics: List[TopicResponse] = []


# New field to include creator's name
creator_name: Optional[str] = None

class Config:
from_attributes = True

Expand Down