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

chore: bring ui into monorepo #349

Merged
merged 12 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/src/leapfrogai_ui' # Location of package manifests
schedule:
interval: 'weekly'
24 changes: 24 additions & 0 deletions packages/ui/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: leapfrogai-ui
description: UI to interact with LFAI tools

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: '0.1.7'
4 changes: 4 additions & 0 deletions packages/ui/chart/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: leapfrogai
26 changes: 26 additions & 0 deletions packages/ui/chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: uds.dev/v1alpha1
kind: Package
metadata:
name: leapfrogai-ui
namespace: {{ .Release.Namespace }}
spec:
network:
expose:
- service: leapfrogai-ui
podLabels:
app: leapfrogai-ui
host: {{ .Values.package.host }}
gateway: tenant
port: 3000

allow:
- direction: Ingress
remoteGenerated: Anywhere

- direction: Egress
remoteGenerated: Anywhere

- direction: Egress
podLabels:
app: leapfrogai-ui
remoteGenerated: Anywhere
45 changes: 45 additions & 0 deletions packages/ui/chart/templates/ui/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: leapfrogai-ui
namespace: leapfrogai
spec:
selector:
matchLabels:
app: leapfrogai-ui
replicas: 1
template:
metadata:
labels:
app: leapfrogai-ui
spec:
containers:
- name: leapfrogai-ui
image: 'ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui:###ZARF_CONST_IMAGE_VERSION###'
ports:
- containerPort: 3000
env:
- name: PUBLIC_LEAPFROGAI_API_BASE_URL
value: '###ZARF_VAR_LEAPFROGAI_API_BASE_URL###'
- name: ORIGIN
value: '###ZARF_VAR_DOMAIN###'
- name: PUBLIC_DEFAULT_MODEL
value: '###ZARF_VAR_MODEL###'
- name: PUBLIC_DEFAULT_SYSTEM_PROMPT
value: '###ZARF_VAR_SYSTEM_PROMPT###'
- name: PUBLIC_DEFAULT_TEMPERATURE
value: '###ZARF_VAR_TEMPERATURE###'
- name: LEAPFROGAI_API_KEY
value: '###ZARF_VAR_LEAPFROGAI_API_KEY###'
- name: PUBLIC_SUPABASE_URL
value: '###ZARF_VAR_SUPABASE_URL###'
- name: PUBLIC_SUPABASE_ANON_KEY
value: '###ZARF_VAR_SUPABASE_ANON_KEY###'

resources:
requests:
memory: '0'
cpu: '0'
limits:
memory: '0'
cpu: '0'
19 changes: 19 additions & 0 deletions packages/ui/chart/templates/ui/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: leapfrogai-ui
namespace: leapfrogai
labels:
app: leapfrogai-ui
service: leapfrogai-ui
zarf.dev/connect-name: leapfrogai-ui
annotations:
zarf.dev/connect-description: 'The LeapfrogAI UI'
spec:
selector:
app: leapfrogai-ui
ports:
- name: http
port: 3000
targetPort: 3000
protocol: TCP
2 changes: 2 additions & 0 deletions packages/ui/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package:
host: lfaiui
7 changes: 7 additions & 0 deletions packages/ui/zarf-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package:
create:
set:
image_repository: 'ghcr.io/defenseunicorns/leapfrogai/leapfrogai-ui'
image_version: 0.1.7
name: leapfrogai-ui
max_package_size: '1000000000'
74 changes: 74 additions & 0 deletions packages/ui/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
kind: ZarfPackageConfig
metadata:
name: '###ZARF_PKG_TMPL_NAME###'
version: '###ZARF_PKG_TMPL_IMAGE_VERSION###'
description: >
A UI for LeapfrogAI

constants:
- name: IMAGE_VERSION
value: '###ZARF_PKG_TMPL_IMAGE_VERSION###'
- name: NAME
value: '###ZARF_PKG_TMPL_NAME###'

variables:
- name: LEAPFROGAI_API_BASE_URL #LEAPFROGAI_API_BASE_URL
description: The base URL for the LeapfrogAI API
default: http://api.leapfrogai.svc.cluster.local:8080/openai/v1
prompt: true
sensitive: true
- name: LEAPFROGAI_API_KEY
description: The api key the LeapfrogAI API (can be left default for local development)
default: my-test-key
prompt: true
sensitive: true
- name: DOMAIN
description: The domain to use for the application, Istio-ingress configuration
default: https://lfaiui.uds.dev
prompt: true
sensitive: true
- name: MODEL
description: The default LLM model to use for chat and summarization
default: vllm
prompt: true
sensitive: false
- name: SYSTEM_PROMPT
description: The default system prompt to use for the LLM
default: 'You are a helpful AI assistant created by Defense Unicorns.'
prompt: true
sensitive: false
- name: TEMPERATURE
description: The default temperature for the LLM
default: '0.1'
prompt: true
sensitive: false
- name: SUPABASE_URL
description: URL for supabase
default: 'http://supabase.leapfrogai.svc.cluster.local:8080'
prompt: true
sensitive: false
- name: SUPABASE_ANON_KEY
description: Public key for Supabase
default: ''
prompt: true
sensitive: false

components:
- name: leapfrogai-ui
required: true
charts:
- name: leapfrogai-ui
namespace: leapfrogai
localPath: chart
version: '###ZARF_PKG_TMPL_IMAGE_VERSION###'
images:
- '###ZARF_PKG_TMPL_IMAGE_REPOSITORY###:###ZARF_PKG_TMPL_IMAGE_VERSION###'
actions:
onDeploy:
after:
- wait:
cluster:
kind: Deployment
name: leapfrogai-ui
namespace: leapfrogai
condition: Available
34 changes: 34 additions & 0 deletions src/leapfrogai_ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DS_Store
node_modules
/.svelte-kit
/build
/package
**/.env
!.env.public
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

Dockerfile
.dockerignore
.git
.gitignore
.gitattributes
README.md
.npmrc
.prettierrc
.eslintrc.cjs
.editorconfig
.vscode
.idea
build
package


*.tar.zst
zarf-sbom/


playwright/.auth


supabase/
21 changes: 21 additions & 0 deletions src/leapfrogai_ui/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# PUBLIC STATIC
PUBLIC_DEFAULT_TEMPERATURE=0.1
PUBLIC_DEFAULT_SYSTEM_PROMPT="You are a helpful AI assistant created by Defense Unicorns."
PUBLIC_DEFAULT_MODEL=vllm
PUBLIC_LEAPFROGAI_API_BASE_URL=https://leapfrogai-api.uds.dev/openai/v1

# PUBLIC DYNAMIC
PUBLIC_SUPABASE_URL=http://localhost:54321
PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0

# PRIVATE DYNAMIC
LEAPFROGAI_API_KEY=my-test-key

# PLAYWRIGHT
USERNAME=user1@test.com
PASSWORD=<password>

# SUPABASE AUTH (when running Supabase Locally)
SUPABASE_AUTH_KEYCLOAK_CLIENT_ID=lfaiui
SUPABASE_AUTH_KEYCLOAK_SECRET=<secret>
SUPABASE_AUTH_EXTERNAL_KEYCLOAK_URL=https://keycloak.admin.uds.dev/realms/uds
9 changes: 9 additions & 0 deletions src/leapfrogai_ui/.env.public
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# THESE VARIABLES ARE PUBLIC STATIC VARIABLES COPIED INTO THE DOCKERFILE AT BUILD TIME
# THIS FILE IS COMMITTED TO GIT
# !!!!!! DO NOT INCLUDE PRIVATE VARIABLES IN THIS FILE !!!!!
PUBLIC_DEFAULT_TEMPERATURE=0.1
PUBLIC_DEFAULT_SYSTEM_PROMPT="You are a helpful AI assistant created by Defense Unicorns."
PUBLIC_DEFAULT_MODEL=vllm
PUBLIC_LEAPFROGAI_API_BASE_URL=http://api.leapfrogai.svc.cluster.local:8080/openai/v1

# DO NOT INCLUDE PRIVATE VARIABLES IN THIS FILE
13 changes: 13 additions & 0 deletions src/leapfrogai_ui/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
31 changes: 31 additions & 0 deletions src/leapfrogai_ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/** @type { import("eslint").Linter.Config } */
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
};
23 changes: 23 additions & 0 deletions src/leapfrogai_ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
!.env.public
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

*.tar.zst
zarf-sbom/

# IntelliJ
.idea/workspace.xml
.idea/statistics.xml
.idea/shelf/


playwright/.auth
test-results/
1 change: 1 addition & 0 deletions src/leapfrogai_ui/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
6 changes: 6 additions & 0 deletions src/leapfrogai_ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

../../packages/ui/chart/
8 changes: 8 additions & 0 deletions src/leapfrogai_ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
Loading