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

Graduate UI native mode (github detached mode) to stable feature. #412

Merged
merged 6 commits into from
Dec 12, 2024

Conversation

vishnoianil
Copy link
Member

@vishnoianil vishnoianil commented Dec 12, 2024

This PR addresses :

  • Refactor the code and move the experimental dashboard/knowledge/skill components of the native mode parallel to the github dashboard/knowledge/skill components.
  • Dev mode features (such as form auto fill) are now enabled using IL_ENABLE_DEV_MODE=true.
  • IL_UI_DEPLOYMENT flag is repurposed to define the deployment mode of the ui stack. It supports two values - github and native.
  • Based on the DEPLOYMENT type user set, UI will load the related dashboard, knowledge and skill forms.
  • Repository cloning page is removed. Native mode has it's own local taxonomy repository, where it maintains all the user contribution. UI will provide an option to publish these contribution to any other taxonomy if they want to test these contributions. This allows UI stack to have total control over it's own taxonomy instance and minimize the modification it needs to do the main taxonomy repo (for testing, merging contributions).
  • Updated the docs to provide details about native mode.
  • Enable feature to delete, and publish the contribution
  • Enable knowledge doc upload feature for the native mode
  • Update the github knowledge page to wizard based form.

Fixes #335
Fixes #325

*.* Refactor the code and move the experimental dashboard/knowledge/skill
components of the native mode parallel to the github dashboard/knowledge/skill
components.
*.* Dev mode features (such as form auto fill) are now enabled using
IL_ENABLE_DEV_MODE=true.
*.* IL_UI_DEPLOYMENT flag is repurposed to define the deploment mode of
the ui stack. It supports two values - github and native.
*.* Based on the DEPLOYMENT type user set, UI will load the related
dashboard, knowledge and skill forms.
*.* Repository cloning page is removed. Native mode has it's own local
taxonomy repository, where it maintains all the user contribution. UI
will provide an option to publish these contribution to any other
taxonomy if they want to test these contributions. This allows UI stack
to have total control over it's own taxonomy instance and minimize the
modification it needs to do the main taxonomy repo (for testing, merging
contributions).
*.* Updated the docs to provide details about native mode.

Signed-off-by: Anil Vishnoi <[email protected]>
@vishnoianil vishnoianil force-pushed the knowledge-docs branch 4 times, most recently from 989e381 to 1bf55ca Compare December 12, 2024 10:09
In Native mode, taxonomy-knowledge-docs repo is cloned
in the $HOME/.instructlab-ui/ directory and the docs are
committed to the main branch. Commit sha of that branch is
used in the knowledge contribution.

In knowledge yaml, document url points to the filepath
location of the taxonomy-knowledge-docs.

Signed-off-by: Anil Vishnoi <[email protected]>
If user deploy UI in github mode, login page shows on github login
option

If user deploy UI in native mode, login page shows only user/pass
If user enable the dev mode, it shows both the options to login.

Signed-off-by: Anil Vishnoi <[email protected]>
@vishnoianil
Copy link
Member Author

@nerdalert Tested following scenario for the patch and works fine.

Github mode:

  • Creating, editing skill and knowledge contribution
  • Yaml and attribution download and view features

Native mode:

  • Creation, publishing and deleting of skill and knowledge contribution
  • Yaml and attribution download and view features
  • Show change feature

Chat feature works fine in both the scenarios.

@nerdalert
Copy link
Member

@vishnoianil fixup lint and will merge 🎉

@vishnoianil vishnoianil marked this pull request as ready for review December 12, 2024 21:35
@nerdalert nerdalert merged commit c4be474 into instructlab:main Dec 12, 2024
6 checks passed
Copy link
Collaborator

@Gregory-Pereira Gregory-Pereira left a comment

Choose a reason for hiding this comment

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

Just some small things I found, awesome job


Set the .env in the ui directory and make sure you uncomment the `IL_UI_DEPLOYMENT=dev`. Once .env file is setup, run the following:
To enable the native mode, set the `IL_UI_DEPLOYMENT=native` in the .env file. Once the flag is set, the UI will not push the knowledge and skill contribution to the github repository. Instead, it will keep the contribution in the local machine. In the `native` mode, the UI login page will show username and password input box to authenticate the user. You can setup the username and password in the .env file through the `IL_UI_ADMIN_USERNAME` and `IL_UI_ADMIN_USERNAME` flags.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To enable the native mode, set the `IL_UI_DEPLOYMENT=native` in the .env file. Once the flag is set, the UI will not push the knowledge and skill contribution to the github repository. Instead, it will keep the contribution in the local machine. In the `native` mode, the UI login page will show username and password input box to authenticate the user. You can setup the username and password in the .env file through the `IL_UI_ADMIN_USERNAME` and `IL_UI_ADMIN_USERNAME` flags.
To enable the native mode, set the `IL_UI_DEPLOYMENT=native` in the .env file. Once the flag is set, the UI will not push the knowledge and skill contribution to the github repository. Instead, it will keep the contribution in the local machine. In the `native` mode, the UI login page will show username and password input box to authenticate the user. You can setup the username and password in the .env file through the `IL_UI_ADMIN_USERNAME` and `IL_UI_ADMIN_PASSWORD` flags.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Gregory-Pereira thanks for catching this, will fix it in follow-up PR.


async function handleDelete(branchName: string, localTaxonomyDir: string) {
try {
if (!branchName || branchName === 'main') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also check against other protected branches? Since im not sure if we care about this I will not repeat the comment for every instance in the file, but there are multiple

Copy link
Member Author

Choose a reason for hiding this comment

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

UI workflows are triggered from the contributions, and all the contributions are created using it's own branch. Ideally branchName === 'main' condition should not even hit in UI case, so we can even remove this check, but kept it as a guardrails. In local taxonomy, main is the only protected branch at this point of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants