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(ui): Make CaraML AI placeholder app generic #110

Conversation

deadlycoconuts
Copy link
Contributor

@deadlycoconuts deadlycoconuts commented Jul 25, 2024

Context

This PR is a follow up from #109, which makes the CaraML AI placeholder app generic enough to support all forms of apps that need to be rendered as a page with an embedded Streamlit app by the MLP UI. It also consolidates all the configuration needed to render this page into a single location (the Applications.PlaceholderPageConfig struct).

Essentially, while the CaraML AI placeholder app was previously hardcoded into existence in the MLP server/UI through various fragmented pieces like the CaramlAIStreamlitHomepage config or the hardcoded CaraMLAIPage.js page's title, setting up new streamlit placeholder apps now simply requires specifying these in the Applications config file that is read by the MLP server:

mlp:
  config:
    applications:
      # ...
      - name: CaraML AI
        description: Gateway for accessing LLM models
        homepage: /caraml-ai
        isProjectAgnostic: true
        configuration:
          iconName: timelionApp
        placeholderPageConfig:
          URL: https://30days.streamlit.app?embed=true
      - name: Dummy App
        description: Dummy app for testing MLP-hosted streamlit apps
        homepage: /dummy-app
        isProjectAgnostic: true
        configuration:
          iconName: canvasApp
        placeholderPageConfig:
          streamlitURL: https://8days.streamlit.app?embed=true

Changes

Fundamentally, the changes to this PR are relatively straightforward, we simply remove the hardcoded streamlit app and conditionally generate React routes only after the list of apps have been retrieved from the v2/applications endpoint on the MLP API server. The React AppRoutes are also made to intentionally not render until that happens (this is because React routes are rendered synchronously, meaning we can't add routes on-the-fly without re-rendering all the routes again).

The isLoaded context value has also been added to ApplicationsContext as a useful flag to determine when the response from the applications endpoint has been returned.

@deadlycoconuts deadlycoconuts self-assigned this Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.14%. Comparing base (09c363a) to head (ccc92d6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage   57.14%   57.14%           
=======================================
  Files          47       47           
  Lines        2443     2443           
=======================================
  Hits         1396     1396           
  Misses        851      851           
  Partials      196      196           
Flag Coverage Δ
api-test 57.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@deadlycoconuts deadlycoconuts force-pushed the make_place_holder_app_configurable branch from b071d63 to 7247035 Compare July 25, 2024 18:47
@deadlycoconuts deadlycoconuts added the enhancement New feature or request label Jul 26, 2024
@deadlycoconuts deadlycoconuts force-pushed the make_place_holder_app_configurable branch from 7247035 to b5afa85 Compare July 27, 2024 04:53
@deadlycoconuts deadlycoconuts marked this pull request as ready for review July 27, 2024 05:05
api/models/v2/application.go Outdated Show resolved Hide resolved
api/models/v2/application.go Outdated Show resolved Hide resolved
Copy link

@leonlnj leonlnj left a comment

Choose a reason for hiding this comment

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

LGTM

@deadlycoconuts
Copy link
Contributor Author

Thanks for the quick review and the comments everyone! Merging this now! 🙏🏼

@deadlycoconuts deadlycoconuts merged commit 6c3023d into caraml-dev:main Jul 29, 2024
10 checks passed
@deadlycoconuts deadlycoconuts deleted the make_place_holder_app_configurable branch July 29, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants