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

design(frontend): AGE-513 Implement Overview and App management view #1986

Merged
merged 127 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
274ba56
design(frontend): added antd theme config tokens
bekossy Aug 1, 2024
57ab4da
feat(frontend): installed phosphor-icons package
bekossy Aug 1, 2024
657af2d
feat(frontend): setup font family and antd tokens
bekossy Aug 1, 2024
47a8d02
design(frontend): implement sidebar design
bekossy Aug 1, 2024
d6fd55d
fix(frontend): modified logo size and improved sidebar in oss
bekossy Aug 1, 2024
f872795
minor improvements
bekossy Aug 1, 2024
c87473b
design(frontend): added menu item header
bekossy Aug 2, 2024
034e460
fix(frontend): changed submenu icons
bekossy Aug 2, 2024
c8b0c6c
design(frontend): added overview route
bekossy Aug 3, 2024
00cda03
fix(frontend): revert logo image width and height
bekossy Aug 3, 2024
63bfd00
fix(frontend): modified endpoint from apps page to overview
bekossy Aug 3, 2024
594f38a
fix(frontend): export createParams Func for reusability
bekossy Aug 3, 2024
5a4e839
design(frontend): minor layout
bekossy Aug 3, 2024
b6501d0
design(frontend): style deployment section in overview page
bekossy Aug 3, 2024
67e7adf
fix(frontend): implemented api logic and minor improvements
bekossy Aug 3, 2024
12b97ac
design(frontend): added variants overview section
bekossy Aug 3, 2024
de4bc40
fix(frontend): modified invite modal query param value
bekossy Aug 4, 2024
588ba1f
design(frontend): added all overview sections
bekossy Aug 4, 2024
e2b069a
design(frontend): added query param key value to open evaluation moda…
bekossy Aug 4, 2024
193798e
design(frontend): drafted variants overview
bekossy Aug 4, 2024
d59c7d1
fix(frontend): dynamically imported Observability overview
bekossy Aug 4, 2024
f9024f9
fix(frontend): added transformer function to human eval response
bekossy Aug 4, 2024
a880b50
fix(frontend): added settings option in evaluation table
bekossy Aug 4, 2024
25259c3
fix(frontend): improved logic and added card loaders
bekossy Aug 4, 2024
03124b2
fix(frontend): improved ab testing eval overview table
bekossy Aug 4, 2024
6005089
fix(frontend): improved single model eval overview table
bekossy Aug 4, 2024
e533e3c
fix(frontend): removed query human eval modal
bekossy Aug 5, 2024
82e12bd
design(frontend): modified deployment overview drawer width and added…
bekossy Aug 5, 2024
8404d63
minor changes
bekossy Aug 5, 2024
2bac31d
fix(frontend): added day format for human eval table
bekossy Aug 5, 2024
041761c
fix(frontend): updated Variant type to add revision, fixed agenta ver…
bekossy Aug 6, 2024
50f52f2
design(frontend): improved overview layout
bekossy Aug 6, 2024
8074743
design(frontend): revamped app management view
bekossy Aug 6, 2024
7d67e22
design(frontend): updated overview section title
bekossy Aug 6, 2024
79877aa
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 6, 2024
c1d54a4
fix(frontend): added status component for auto eval result in overvie…
bekossy Aug 6, 2024
f5a1345
Merge branch 'prototype-design/-project-revamp' of https://github.com…
bekossy Aug 6, 2024
e1b1490
fix(frontend): overall design improvements
bekossy Aug 7, 2024
6cb3d0b
minor fix
bekossy Aug 7, 2024
9f530b0
fix(frontend): updated design
bekossy Aug 7, 2024
8337e9c
minor improvement
bekossy Aug 7, 2024
5306209
fix(frontend): removed rerun action button
bekossy Aug 8, 2024
3087f62
temporarily disabled ts warning
bekossy Aug 8, 2024
ebea35f
fix(frontend): improved loading state in deployment overview section
bekossy Aug 9, 2024
f5559f2
minor ui improvement
bekossy Aug 9, 2024
6917528
fix(frontend): moved fetch variants request to parent level to avoid …
bekossy Aug 9, 2024
c4d51a5
design(frontend): added change variant modal
bekossy Aug 9, 2024
05445eb
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 10, 2024
40cd3ba
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 11, 2024
aafac10
design(frontend): added evaluation delete modal
bekossy Aug 12, 2024
79d2d2e
commented out deployment and variant overview sections
bekossy Aug 12, 2024
e22aa61
updated antd theme config
bekossy Aug 12, 2024
04330cb
fix(frontend): added unfinished feature flag and remove deployment se…
bekossy Aug 13, 2024
8353f11
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 13, 2024
2651d42
fix(frontend): updated antd theme config and improved ui
bekossy Aug 13, 2024
d5652b5
fix(frontend): made delete app modal generic and added delete app fun…
bekossy Aug 14, 2024
59088fe
fix(frontend): sorted table by createdAt and sliced array to length o…
bekossy Aug 14, 2024
a2881cf
lint and build fix(frontend)
bekossy Aug 14, 2024
8c35ff9
feat(frontend): added recently visited feature for sidebar
bekossy Aug 14, 2024
30a99a3
fix(frontend): improve logic for recently visited app feature
bekossy Aug 14, 2024
007795e
test(frontend): improve logic of the createVariant function
ashrafchowdury Aug 14, 2024
fc3d6b0
test(frontend): adjusted the test according to new changes
ashrafchowdury Aug 14, 2024
a8143c6
fix(frontend): moved deployment view from sidebar to overview page
bekossy Aug 14, 2024
306c433
fix(frontend): added deployment section and publish variant func
bekossy Aug 14, 2024
a6dd40f
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 14, 2024
e8998c5
feat (backend): add ModifiedBy API model and update app_variant_db_to…
aybruhm Aug 15, 2024
c530aa5
perf (backend): optimize 3 DB functions using joinedload to reduce qu…
aybruhm Aug 15, 2024
adfd487
fix(frontend): added filterVariantParameters helper
bekossy Aug 15, 2024
364f441
fix(frontend): on row click triggers primary action
bekossy Aug 15, 2024
dfe26da
perf (backend): optimize db function 'get_app_variant_instance_by_id'…
aybruhm Aug 15, 2024
d98ecd1
refactor (cli): extend AppVariantResponse in agenta-cli client backend
aybruhm Aug 15, 2024
360a2b2
Merge pull request #1991 from Agenta-AI/feature/endpoint-modification…
mmabrouk Aug 15, 2024
bb34e14
fix(frontend): updated Variant type
bekossy Aug 15, 2024
b530ff3
fix(backend): added date_created to Variant model
bekossy Aug 15, 2024
56a7798
updated Variant types
bekossy Aug 15, 2024
09be4ad
fix(frontend): moved fetch environments to parent level
bekossy Aug 15, 2024
323835f
updated variant table values
bekossy Aug 15, 2024
7267650
added variant drawer content
bekossy Aug 15, 2024
92b5569
fixed prettier(frontend)
bekossy Aug 15, 2024
9b6598c
increased delete evaluation modal z-index
bekossy Aug 15, 2024
d95b5d5
fix(frontend): improved variant drawer
bekossy Aug 15, 2024
951004a
fix(frontend): disabled sidebar collapse feature
bekossy Aug 16, 2024
fb5a749
fix(frontend): updated confirm deployment modal helper text
bekossy Aug 16, 2024
294ee18
fix(frontend): on click func for no deployment drawer
bekossy Aug 16, 2024
2228e32
design(frontend): added deploy variant modal
bekossy Aug 16, 2024
6ff1a8a
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 16, 2024
94806ae
minor fix
bekossy Aug 16, 2024
585aee6
fix(frontend): added func to deploy button in variant drawer
bekossy Aug 16, 2024
237d5ed
fix(frontend): prompt variable input size
bekossy Aug 16, 2024
51ecf5a
fix(frontend): added helper func to split and display variant id
bekossy Aug 17, 2024
0fbba6b
design(frontend): variant popover to display variant info
bekossy Aug 17, 2024
bed8b1f
fix(frontend): replaced tag in deployment drawer with variant popover
bekossy Aug 17, 2024
ffb66fc
fix(frontend): passed prop and updated ui
bekossy Aug 18, 2024
3f2ffa5
fix(frontend): confirm deployment modal helper text
bekossy Aug 18, 2024
c86e2d5
design(frontend): added Editor diff to compare variants
bekossy Aug 18, 2024
f503430
updated antd theme tokens
bekossy Aug 19, 2024
8a34939
changed variant overview table font weight to 500
bekossy Aug 19, 2024
9129240
commented out variant clone feature
bekossy Aug 19, 2024
bd70fff
fix(frontend): updated antd theme tokens, removed variant table in ov…
bekossy Aug 19, 2024
f013dd5
updated antd tokens
bekossy Aug 19, 2024
ac7a031
fix(frontend): replaced hardcoded color with antd useToken hook
bekossy Aug 19, 2024
431dc7b
fix(frontend): removed variants prop from Obervability component
bekossy Aug 19, 2024
07f9c96
test(frontend): modify cypress test base url
bekossy Aug 20, 2024
5f1fbcb
minor test modifications(frontend)
bekossy Aug 20, 2024
312bc25
test(frontend): excluded smoke test
bekossy Aug 20, 2024
c014032
revert test changes
bekossy Aug 20, 2024
a415247
Merge branch 'main' into prototype-design/-project-revamp
bekossy Aug 20, 2024
671fb37
increased test timeout
bekossy Aug 20, 2024
2af916e
test(frontend): solo run
bekossy Aug 20, 2024
1def09b
test(frontend): increased timeouts
bekossy Aug 20, 2024
9b00508
test(frontend): manual timeout
bekossy Aug 20, 2024
a8a37ca
test(frontend): added more timeouts
bekossy Aug 20, 2024
14e0f86
test(frontend): increased timeout to 2mins
bekossy Aug 20, 2024
f0314cf
test(frontend): removed solo run
bekossy Aug 20, 2024
1c14dd2
fix(frontend): updated antd tokens and modified Layout header style
bekossy Aug 20, 2024
c16e694
fix(frontend): bug fix
bekossy Aug 20, 2024
743de17
fix(frontend): ui fixes and improvements
bekossy Aug 20, 2024
e10c73f
refactor (backend): replace ModifiedBy API model with 'modified_by_id'
aybruhm Aug 20, 2024
b967e52
refactor (backend): update user_profile endpoint to allow optional 'u…
aybruhm Aug 20, 2024
e4f67a2
feat (tests): add tests for fetching profile with user_id and handle …
aybruhm Aug 20, 2024
64d787b
chore (style): format codebase with [email protected]
aybruhm Aug 20, 2024
ae4b9e4
fix(frontend): renamed helper func to get first index of variant id, …
bekossy Aug 21, 2024
f9d01e1
bug fix(frontend)
bekossy Aug 21, 2024
03d2f2e
fix(cli client) modified_by (pydantic) to modified_by_id (str)
jp-agenta Aug 21, 2024
53f5c8c
fix(frontend): asynchronous fetch for user profile
bekossy Aug 21, 2024
31d3a70
make new field optional
jp-agenta Aug 21, 2024
426e61b
Merge branch 'prototype-design/-project-revamp' of github.com:Agenta-…
jp-agenta Aug 21, 2024
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
3 changes: 3 additions & 0 deletions agenta-backend/agenta_backend/models/api/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class AppVariantResponse(BaseModel):
config_name: str
uri: Optional[str]
revision: int
created_at: Optional[str] = None
updated_at: Optional[str] = None
modified_by_id: Optional[str] = None


class AppVariantRevision(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion agenta-backend/agenta_backend/models/api/user_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class TimestampModel(BaseModel):
class User(TimestampModel):
id: Optional[str] = None
uid: str
username: str
email: str
username: str
profile_picture: Optional[str] = None
organizations: Optional[List[str]] = None


Expand Down
3 changes: 3 additions & 0 deletions agenta-backend/agenta_backend/models/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ async def app_variant_db_to_output(app_variant_db: AppVariantDB) -> AppVariantRe
config_name=app_variant_db.config_name, # type: ignore
uri=uri,
revision=app_variant_db.revision, # type: ignore
created_at=str(app_variant_db.updated_at),
updated_at=str(app_variant_db.created_at),
modified_by_id=str(app_variant_db.modified_by_id),
)

if isCloudEE():
Expand Down
23 changes: 15 additions & 8 deletions agenta-backend/agenta_backend/routers/user_profile.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import os
from typing import Optional

from fastapi import HTTPException, Request

from agenta_backend.services import db_manager
from agenta_backend.utils.common import APIRouter
from agenta_backend.models.api.user_models import User

router = APIRouter()


@router.get("/", operation_id="user_profile")
async def user_profile(
request: Request,
):
@router.get("/", operation_id="fetch_user_profile")
async def user_profile(request: Request, user_id: Optional[str] = None):
try:
user = await db_manager.get_user(request.state.user_id)
if user_id is not None:
user = await db_manager.get_user_with_id(user_id=user_id)
else:
user = await db_manager.get_user(request.state.user_id)

assert (
user is not None
), "User not found. Please ensure that the user_id is specified correctly."
return User(
id=str(user.id),
uid=str(user.uid),
username=str(user.username),
email=str(user.email),
username=str(user.username),
created_at=str(user.created_at),
updated_at=str(user.updated_at),
).dict(exclude_unset=True)
).model_dump(exclude_unset=True)

except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
15 changes: 11 additions & 4 deletions agenta-backend/agenta_backend/services/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ async def fetch_app_variant_by_id(
assert app_variant_id is not None, "app_variant_id cannot be None"
async with db_engine.get_session() as session:
base_query = select(AppVariantDB).options(
joinedload(AppVariantDB.base), joinedload(AppVariantDB.app)
joinedload(AppVariantDB.base),
joinedload(AppVariantDB.app),
)
if isCloudEE():
query = base_query.options(
Expand Down Expand Up @@ -852,7 +853,7 @@ async def get_user_with_id(user_id: str):
user = result.scalars().first()
if user is None:
logger.error("Failed to get user with id")
raise Exception("Error while getting user")
raise NoResultFound(f"User with id {user_id} not found")
return user


Expand Down Expand Up @@ -1145,7 +1146,10 @@ async def list_app_variants(app_id: str):
async with db_engine.get_session() as session:
result = await session.execute(
select(AppVariantDB)
.options(joinedload(AppVariantDB.app), joinedload(AppVariantDB.base))
.options(
joinedload(AppVariantDB.app),
joinedload(AppVariantDB.base),
)
.filter_by(app_id=uuid.UUID(app_uuid))
)
app_variants = result.scalars().all()
Expand Down Expand Up @@ -1842,7 +1846,10 @@ async def get_app_variant_instance_by_id(variant_id: str) -> AppVariantDB:
async with db_engine.get_session() as session:
result = await session.execute(
select(AppVariantDB)
.options(joinedload(AppVariantDB.base), joinedload(AppVariantDB.app))
.options(
joinedload(AppVariantDB.base),
joinedload(AppVariantDB.app),
)
.filter_by(id=uuid.UUID(variant_id))
)
app_variant_db = result.scalars().first()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from uuid import uuid4

import httpx
import pytest
Expand All @@ -22,7 +23,7 @@


@pytest.mark.asyncio
async def test_user_profile():
async def test_fetch_user_profile_without_user_id():
async with db_engine.get_session() as session:
result = await session.execute(select(UserDB).filter_by(uid="0"))
user_db = result.scalars().first()
Expand All @@ -36,7 +37,7 @@ async def test_user_profile():
email=str(user_db.email),
created_at=str(user_db.created_at),
updated_at=str(user_db.updated_at),
).dict(exclude_unset=True)
).model_dump(exclude_unset=True)

response = await test_client.get(f"{BACKEND_API_HOST}/profile/")

Expand All @@ -45,3 +46,40 @@ async def test_user_profile():
assert response.json()["uid"] == user_db_dict["uid"]
assert response.json()["email"] == user_db_dict["email"]
assert response.json()["username"] == user_db_dict["username"]


async def test_fetch_user_profile_with_valid_user_id():
async with db_engine.get_session() as session:
result = await session.execute(select(UserDB).filter_by(uid="0"))
user_db = result.scalars().first()
if not user_db:
assert False

user_db_dict = User(
id=str(user_db.id),
uid=str(user_db.uid),
username=str(user_db.username),
email=str(user_db.email),
created_at=str(user_db.created_at),
updated_at=str(user_db.updated_at),
).model_dump(exclude_unset=True)

response = await test_client.get(
f"{BACKEND_API_HOST}/profile/?user_id={str(user_db.id)}"
)

assert response.status_code == 200
assert response.json()["id"] == user_db_dict["id"]
assert response.json()["uid"] == user_db_dict["uid"]
assert response.json()["email"] == user_db_dict["email"]
assert response.json()["username"] == user_db_dict["username"]


async def test_fetch_user_profile_with_non_existent_user_id_error():
user_non_existent_id = str(uuid4())
response = await test_client.get(
f"{BACKEND_API_HOST}/profile/?user_id={user_non_existent_id}"
)

assert response.status_code == 500
assert response.json()["detail"] == f"User with id {user_non_existent_id} not found"
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class AppVariantResponse(pydantic.BaseModel):
revision: int
organization_id: typing.Optional[str]
workspace_id: typing.Optional[str]
created_at: typing.Optional[dt.datetime] = None
updated_at: typing.Optional[dt.datetime] = None
modified_by_id: typing.Optional[str] = None

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {
Expand Down
8 changes: 6 additions & 2 deletions agenta-web/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ export default defineConfig({
screenshotOnRunFailure: false,
e2e: {
baseUrl: "http://localhost:3000",
defaultCommandTimeout: 30000,
requestTimeout: 10000,
defaultCommandTimeout: 120000,
requestTimeout: 120000,
pageLoadTimeout: 120000,
responseTimeout: 120000,
taskTimeout: 120000,
execTimeout: 120000,
setupNodeEvents(on) {
on("task", {
log(message) {
Expand Down
1 change: 0 additions & 1 deletion agenta-web/cypress/e2e/eval.comparison.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe("Evaluation Comparison Test", function () {
cy.get("@app_id").then((appId) => {
app_id = appId
})
cy.get('[data-cy="playground-save-changes-button"]').eq(0).click()
})

context("When creating an app variant", () => {
Expand Down
1 change: 0 additions & 1 deletion agenta-web/cypress/e2e/eval.evaluations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe("Evaluations CRUD Operations Test", function () {
cy.get("@app_id").then((appId) => {
app_id = appId
})
cy.get('[data-cy="playground-save-changes-button"]').eq(0).click()
})

context("Executing Evaluations CRUD operations", () => {
Expand Down
1 change: 0 additions & 1 deletion agenta-web/cypress/e2e/eval.scenarios.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe("Evaluation Scenarios Test", function () {
cy.get("@app_id").then((appId) => {
app_id = appId
})
cy.get('[data-cy="playground-save-changes-button"]').eq(0).click()
})

context("Executing Evaluation Scenarios Workflow", () => {
Expand Down
8 changes: 7 additions & 1 deletion agenta-web/cypress/e2e/playground.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
describe("Playground Prompt Test", function () {
let app_id
before(() => {
cy.createVariant()
cy.get("@app_id").then((appId) => {
app_id = appId
})
})

it("Should test prompt functionality in the Playground", () => {
cy.visit(`/apps/${app_id}/playground`)
cy.url().should("include", "/playground")
cy.contains(/modify parameters/i)
cy.get('[data-cy^="testview-input-parameters"]').eq(0).type("Germany")
cy.get('[data-cy="testview-input-parameters-run-button"]').click()
cy.intercept("POST", "**/demo/app/generate", {
Expand Down
3 changes: 1 addition & 2 deletions agenta-web/cypress/support/commands/evaluations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Cypress.Commands.add("createVariant", () => {
}
})

cy.contains("Single Prompt")
cy.contains("Single Prompt OpenAI")
.parentsUntil('[data-cy^="app-template-card"]')
.last()
.contains("create app", {matchCase: false})
Expand All @@ -51,7 +51,6 @@ Cypress.Commands.add("createVariant", () => {

cy.wrap(app_id).as("app_id")
})
cy.contains(/modify parameters/i)
cy.removeLlmProviderKey()
})

Expand Down
14 changes: 14 additions & 0 deletions agenta-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions agenta-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@mdx-js/react": "^2.3.0",
"@monaco-editor/react": "^4.5.2",
"@next/mdx": "^13.4.13",
"@phosphor-icons/react": "^2.1.7",
"@remixicon/react": "^4.1.1",
"@sentry/nextjs": "^8.18.0",
"@tailwindcss/forms": "^0.5.7",
Expand Down
Binary file removed agenta-web/public/assets/slack.png
Binary file not shown.
Loading
Loading