Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): Library v2 Agents and Presets #9258

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented Jan 13, 2025

This re-introduces changes from the following PRs with fixes:

Changes 🏗️

Fixes:

  • Fix Prisma query statements in v2.library.db

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • Create & run a new agent
    • Update & run an existing agent

Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit a8ac410
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/67879ccf2bcde300098ef1fb

@github-actions github-actions bot added platform/backend AutoGPT Platform - Back end size/xl labels Jan 13, 2025
Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit a8ac410
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67879ccf40e3a200088d1653

…nto pwuts/open-2314-fix-up-and-re-introduce-library-v2-back-end-work
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Jan 13, 2025
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@Pwuts Pwuts force-pushed the pwuts/open-2314-fix-up-and-re-introduce-library-v2-back-end-work branch from a8ac410 to 85180e1 Compare January 15, 2025 11:03
Comment on lines -428 to -465
########################################################
##################### Templates ########################
########################################################


@v1_router.get(
path="/templates",
tags=["graphs", "templates"],
dependencies=[Depends(auth_middleware)],
)
async def get_templates(
user_id: Annotated[str, Depends(get_user_id)]
) -> Sequence[graph_db.GraphModel]:
return await graph_db.get_graphs(filter_by="template", user_id=user_id)


@v1_router.get(
path="/templates/{graph_id}",
tags=["templates", "graphs"],
dependencies=[Depends(auth_middleware)],
)
async def get_template(
graph_id: str, version: int | None = None
) -> graph_db.GraphModel:
graph = await graph_db.get_graph(graph_id, version)
if not graph:
raise HTTPException(status_code=404, detail=f"Template #{graph_id} not found.")
return graph


@v1_router.post(
path="/templates",
tags=["templates", "graphs"],
dependencies=[Depends(auth_middleware)],
)
async def create_new_template(
create_graph: CreateGraph, user_id: Annotated[str, Depends(get_user_id)]
) -> graph_db.GraphModel:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used anywhere on the frontend and is removed from it's clients correct?

Comment on lines +37 to +51
where_clause["OR"] = [
{
"Agent": {
"is": {"name": {"contains": search_query, "mode": "insensitive"}}
}
},
{
"Agent": {
"is": {
"description": {"contains": search_query, "mode": "insensitive"}
}
}
},
]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably do a full-text search or vector here

) from e


async def create_or_update_preset(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upsert plz i beg you

logger = logging.getLogger(__name__)

router = fastapi.APIRouter()
integration_creds_manager = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts platform/backend AutoGPT Platform - Back end size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants