Skip to content

Commit

Permalink
Merge branch 'main' into fix315
Browse files Browse the repository at this point in the history
  • Loading branch information
freelerobot authored Oct 17, 2023
2 parents af71a89 + 57de702 commit 8d004ff
Show file tree
Hide file tree
Showing 72 changed files with 11,209 additions and 7,370 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/linter-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
rm -rf ~/Library/Application\ Support/jan
- name: Getting the repo
uses: actions/checkout@v3

Expand All @@ -58,6 +59,7 @@ jobs:
- name: Clean workspace
run: |
Remove-Item -Path .\* -Force -Recurse
Remove-Item -Path "$Env:APPDATA\jan" -Force -Recurse
- name: Getting the repo
uses: actions/checkout@v3

Expand Down Expand Up @@ -85,6 +87,7 @@ jobs:
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
rm -rf ~/.config/jan
- name: Getting the repo
uses: actions/checkout@v3

Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/publish-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish plugins/$dir Package to npmjs
on:
push:
branches:
- main
paths:
- "plugins/**"
- ".github/workflows/publish-plugins.yml"
- "!plugins/*/package.json"
jobs:
build:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
token: ${{ secrets.PAT_SERVICE_ACCOUNT }}

- name: Install jq
uses: dcarbone/[email protected]

- name: Check Path Change
run: |
git config --global user.email "[email protected]"
git config --global user.name "Service Account"
echo "Changes in these directories trigger the build:"
changed_dirs=$(git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.GITHUB_TOKEN }}" diff --name-only HEAD HEAD~1 | grep '^plugins/' | awk -F/ '{print $2}' | uniq)
echo $changed_dirs > /tmp/change_dir.txt
- name: "Auto Increase package Version"
run: |
cd plugins
for dir in $(cat /tmp/change_dir.txt)
do
echo "$dir"
# Extract current version
current_version=$(jq -r '.version' $dir/package.json)
# Break the version into its components
major_version=$(echo $current_version | cut -d "." -f 1)
minor_version=$(echo $current_version | cut -d "." -f 2)
patch_version=$(echo $current_version | cut -d "." -f 3)
# Increment the patch version by one
new_patch_version=$((patch_version+1))
# Construct the new version
new_version="$major_version.$minor_version.$new_patch_version"
# Replace the old version with the new version in package.json
jq --arg version "$new_version" '.version = $version' $dir/package.json > /tmp/package.json && mv /tmp/package.json $dir/package.json
# Print the new version
echo "Updated $dir package.json version to: $new_version"
done
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Publish npm packages
run: |
cd plugins
for dir in $(cat /tmp/change_dir.txt)
do
echo $dir
cd $dir
npm install && npm run build
npm publish --access public
cd ..
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: "Commit new version to main and create tag"
run: |
for dir in $(cat /tmp/change_dir.txt)
do
echo "$dir"
version=$(jq -r '.version' plugins/$dir/package.json)
git config --global user.email "[email protected]"
git config --global user.name "Service Account"
git add plugins/$dir/package.json
git commit -m "${GITHUB_REPOSITORY}: Update tag build $version for $dir"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main
git tag -a $dir-$version -m "${GITHUB_REPOSITORY}: Update tag build $version for $dir"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin $dir-$version
done
54 changes: 54 additions & 0 deletions adr/adr-001-jan-deployable-cloud-native.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ADR #001: Jan deployable cloud-native

## Changelog

- 23.10.03: Initial unfinished draft
- 23.10.16: Remove authentication

## Authors

- @nam-john-ho
- @louis

## Context

### Status Quo

* User doesn't have a local GPU machine but wants to run Jan on a rented server
* User wants a quick, fast way to experiment with Jan on a rented GPU
* https://github.com/janhq/jan/issues/255

## Decision

* This ADR aims to outline design decisions for deploying Jan in cloud native environments such as: Runpod, AWS, Azure, GCP in a fast and simple way.
* The current code-base should not change too much.
* The current plugins must be reusable across enviroments (Desktop, Cloud-native).


### Key Design Decisions
![Key Design](images/adr-001-02.png "Key Design")
#### Why middleware
* The /web codebase needs to operate in both browser and electron environments
* The /web codebase needs to route plugin routes accordingly, either to /server or /electron
* Middleware takes care of this
* We will have a /server codebase that takes care of routing to plugins
#### Unsuitable Alternatives
* Not possible to just run electron headless
* /web is on a different chromium window
* Does not have all the electron handlers
* Does not have the IPC handler

## Alternative Approaches
Separated server process runs along side with electron. https://github.com/janhq/jan/pull/184/commits/6005409a945bb0e80a61132b9eb77f47f19d0aa6

## Considerations
* Due to the limitation of accessing the file system in web browsers, the first version of the web app will load all the current plugins by default, and users will not be able to add, remove, or update plugins.
* Simple authentication will be implemented as a plugin.

## References

- https://www.runpod.io/console/templates
- https://repost.aws/articles/ARQ0Tz9eorSL6EAus7XPMG-Q/how-to-install-textgen-webui-on-aws
- https://www.youtube.com/watch?v=_59AsSyMERQ
- https://gpus.llm-utils.org/running-llama-2-on-runpod-with-oobaboogas-text-generation-webui/
- https://medium.com/@jarimh1984/installing-oobabooga-and-oobabooga-api-to-runpod-cloud-step-by-step-tutorial-47457974dfa5
7 changes: 6 additions & 1 deletion adr/adr-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Changelog
- {date}: {changelog}

## Authors
- @usernames

## Status

What is the status, such as proposed, accepted, rejected, deprecated, superseded, etc.?
Expand All @@ -21,4 +24,6 @@ What is the change that we're proposing and/or doing?

What becomes easier or more difficult to do because of this change?

## Reference
## Alternatives

## Reference
Binary file added adr/images/adr-001-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added adr/images/adr-001-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ const config = {
additionalLanguages: ["python"],
},
colorMode: {
defaultMode: "dark",
disableSwitch: false,
respectPrefersColorScheme: false,
},
Expand Down
11 changes: 2 additions & 9 deletions docs/src/components/Homepage/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ export default function HomepageHero() {
Run your own AI
</h1>
<p className="mt-6 text-lg leading-8 text-gray-600 dark:text-gray-300">
Jan lets you run AI on your own hardware. 1-click to install the
latest open-source models. Monitor and manage software-hardware
performance.
<br></br>
Jan is
<strong> free and open core</strong> with a Sustainable Use
License.
Run Large Language Models locally on Mac, Windows or Linux.
</p>
<div className="mt-10 flex items-center justify-center gap-x-6">
{/* TODO: handle mobile model download app instead */}
Expand All @@ -78,8 +72,7 @@ export default function HomepageHero() {
<img
src={
colorMode === "dark"
? // TODO replace with darkmode image
require("@site/static/img/desktop-llm-chat-dark.png")
? require("@site/static/img/desktop-llm-chat-dark.png")
.default
: require("@site/static/img/desktop-llm-chat-light.png")
.default
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Home() {
title={`${siteConfig.tagline}`}
description="Description will go into a meta tag in <head />"
>
<HomepageBanner />
{/* <HomepageBanner /> */}
<main className={styles.main}>
<HomepageHero />
<HomepageSectionOne />
Expand Down
Loading

0 comments on commit 8d004ff

Please sign in to comment.