Skip to content

Commit

Permalink
350 install llm on app service (#370)
Browse files Browse the repository at this point in the history
- Refactored application domain exports
- Azure OpenAI integration
- Implemented initial Workbox page
- Created WorkboxDataView component
- XDataTable refactoring
- Fixed AppRole reference in users page
- Integrated workbox with database w/ proper entities instead of JSON
- Extended statement field size
- updated bicep+pipeline env vars
- updated workbox schema for display
- added API defaults for priorities
  • Loading branch information
mlhaufe authored Oct 1, 2024
1 parent 27ed61f commit 4f1a7f3
Show file tree
Hide file tree
Showing 185 changed files with 13,432 additions and 13,078 deletions.
51 changes: 37 additions & 14 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
NODE_TLS_REJECT_UNAUTHORIZED=0
NODE_ENV=development
NUXT_ORIGIN: https://localhost:3000
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_DB: cathedral
NUXT_SESSION_PASSWORD: ###generate a random string###
NUXT_AUTH_CLIENT_ID: ###contact the team for the client id###
NUXT_AUTH_CLIENT_SECRET: ###contact the team for the client secret###
NUXT_AUTH_TENANT_NAME: cathedralfinalhillb2c
NUXT_AUTH_TENANT_ID: ###contact the team for the tenant id###
NUXT_AUTH_AUTHORITY_DOMAIN: cathedralfinalhillb2c.b2clogin.com
NUXT_AUTH_PRIMARY_USER_FLOW: B2C_1_signupsignin2
# NUXT_HOSTNAME=cathedral.local
NUXT_HOSTNAME=localhost
# NUXT_ORIGIN=https://cathedral.local
NUXT_ORIGIN=https://localhost:3000
NUXT_HOST=0.0.0.0
NUXT_PORT=3000

# Used for local self-signed SSL certificate
NODE_TLS_REJECT_UNAUTHORIZED=0
NUXT_ORIGIN_SSL_PASSPHRASE=<random string>

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=cathedral

NUXT_SESSION_PASSWORD=<random string>
NUXT_AUTH_CLIENT_ID=...
NUXT_AUTH_CLIENT_SECRET=...
NUXT_AUTH_TENANT_NAME=...
NUXT_AUTH_TENANT_ID=...
NUXT_AUTH_AUTHORITY_DOMAIN=...
NUXT_AUTH_PRIMARY_USER_FLOW=...

NUXT_SLACK_APP_ID=...
NUXT_SLACK_SIGNING_SECRET=...
NUXT_SLACK_CLIENT_ID=...
NUXT_SLACK_CLIENT_SECRET=...
NUXT_SLACK_BOT_TOKEN=xoxb-...
# Below is the Socket Mode token
NUXT_SLACK_APP_TOKEN=xapp-1-...

AZURE_OPENAI_ENDPOINT=...
AZURE_OPENAI_DEPLOYMENT_ID=...
AZURE_OPENAI_API_VERSION=...
AZURE_OPENAI_API_KEY=...
16 changes: 16 additions & 0 deletions .github/workflows/azure-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
nuxtAuthTenantId="${{ secrets.NUXT_AUTH_TENANT_ID }}"
nuxtAuthAuthorityDomain="${{ secrets.NUXT_AUTH_AUTHORITY_DOMAIN }}"
nuxtAuthPrimaryUserFlow="${{ secrets.NUXT_AUTH_PRIMARY_USER_FLOW }}"
nuxtAzureOpenaiApiKey="${{ secrets.NUXT_AZURE_OPENAI_API_KEY }}"
nuxtAzureOpenaiApiVersion="${{ secrets.NUXT_AZURE_OPENAI_API_VERSION }}",
nuxtAzureOpenaiEndpoint="${{ secrets.NUXT_AZURE_OPENAI_ENDPOINT }}",
nuxtAzureOpenaiDeploymentId="${{ secrets.NUXT_AZURE_OPENAI_DEPLOYMENT_ID }}"
scope: 'resourcegroup'
deploymentMode: 'Incremental'
failOnStdErr: false
Expand Down Expand Up @@ -99,6 +103,10 @@ jobs:
echo "SLACK_ADMIN_MEMBER_ID=${{secrets.SLACK_ADMIN_MEMBER_ID}}" >> .env
echo "SLACK_BOT_TOKEN=${{secrets.SLACK_BOT_TOKEN}}" >> .env
echo "SLACK_SIGNING_SECRET=${{secrets.SLACK_SIGNING_SECRET}}" >> .env
echo "NUXT_AZURE_OPENAI_API_KEY=${{secrets.NUXT_AZURE_OPENAI_API_KEY}}" >> .env
echo "NUXT_AZURE_OPENAI_API_VERSION=${{secrets.NUXT_AZURE_OPENAI_API_VERSION}}" >> .env
echo "NUXT_AZURE_OPENAI_ENDPOINT=${{secrets.NUXT_AZURE_OPENAI_ENDPOINT}}" >> .env
echo "NUXT_AZURE_OPENAI_DEPLOYMENT_ID=${{secrets.NUXT_AZURE_OPENAI_DEPLOYMENT_ID}}" >> .env
- name: Build Application
run: npm run build
- name: Generate PWA Assets
Expand Down Expand Up @@ -152,6 +160,10 @@ jobs:
nuxtAuthTenantId="${{ secrets.NUXT_AUTH_TENANT_ID }}"
nuxtAuthAuthorityDomain="${{ secrets.NUXT_AUTH_AUTHORITY_DOMAIN }}"
nuxtAuthPrimaryUserFlow="${{ secrets.NUXT_AUTH_PRIMARY_USER_FLOW }}"
nuxtAzureOpenaiApiKey="${{ secrets.NUXT_AZURE_OPENAI_API_KEY }}"
nuxtAzureOpenaiApiVersion="${{ secrets.NUXT_AZURE_OPENAI_API_VERSION }}",
nuxtAzureOpenaiEndpoint="${{ secrets.NUXT_AZURE_OPENAI_ENDPOINT }}",
nuxtAzureOpenaiDeploymentId="${{ secrets.NUXT_AZURE_OPENAI_DEPLOYMENT_ID }}"
scope: 'resourcegroup'
failOnStdErr: false
- name: logout
Expand Down Expand Up @@ -220,6 +232,10 @@ jobs:
echo "SLACK_ADMIN_MEMBER_ID=${{secrets.SLACK_ADMIN_MEMBER_ID}}" >> .env
echo "SLACK_BOT_TOKEN=${{secrets.SLACK_BOT_TOKEN}}" >> .env
echo "SLACK_SIGNING_SECRET=${{secrets.SLACK_SIGNING_SECRET}}" >> .env
echo "NUXT_AZURE_OPENAI_API_KEY=${{secrets.NUXT_AZURE_OPENAI_API_KEY}}" >> .env
echo "NUXT_AZURE_OPENAI_API_VERSION=${{secrets.NUXT_AZURE_OPENAI_API_VERSION}}" >> .env
echo "NUXT_AZURE_OPENAI_ENDPOINT=${{secrets.NUXT_AZURE_OPENAI_ENDPOINT}}" >> .env
echo "NUXT_AZURE_OPENAI_DEPLOYMENT_ID=${{secrets.NUXT_AZURE_OPENAI_DEPLOYMENT_ID}}" >> .env
- name: Login to Azure
uses: azure/login@v2
with:
Expand Down
12 changes: 12 additions & 0 deletions azure/bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ param nuxtAuthTenantId string
param nuxtAuthAuthorityDomain string
@secure()
param nuxtAuthPrimaryUserFlow string
@secure()
param nuxtAzureOpenaiApiKey string
@secure()
param nuxtAzureOpenaiApiVersion string
@secure()
param nuxtAzureOpenaiEndpoint string
@secure()
param nuxtAzureOpenaiDeploymentId string

module appInsights './modules/appInsights.bicep' = {
name: 'appInsights'
Expand Down Expand Up @@ -91,5 +99,9 @@ module appService './modules/appService.bicep' = {
nuxtAuthTenantName: nuxtAuthTenantName
nuxtOrigin: nuxtOrigin
nuxtSessionPassword: nuxtSessionPassword
nuxtAzureOpenaiApiKey: nuxtAzureOpenaiApiKey
nuxtAzureOpenaiApiVersion: nuxtAzureOpenaiApiVersion
nuxtAzureOpenaiEndpoint: nuxtAzureOpenaiEndpoint
nuxtAzureOpenaiDeploymentId: nuxtAzureOpenaiDeploymentId
}
}
24 changes: 24 additions & 0 deletions azure/bicep/modules/appService.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ param nuxtAuthTenantId string
param nuxtAuthAuthorityDomain string
@secure()
param nuxtAuthPrimaryUserFlow string
@secure()
param nuxtAzureOpenaiApiKey string
@secure()
param nuxtAzureOpenaiApiVersion string
@secure()
param nuxtAzureOpenaiEndpoint string
@secure()
param nuxtAzureOpenaiDeploymentId string

resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = {
name: toLower('plan-${name}')
Expand Down Expand Up @@ -179,6 +187,22 @@ resource appService 'Microsoft.Web/sites@2023-12-01' = {
name: 'NUXT_AUTH_PRIMARY_USER_FLOW'
value: nuxtAuthPrimaryUserFlow
}
{
name: 'NUXT_AZURE_OPENAI_API_KEY'
value: nuxtAzureOpenaiApiKey
}
{
name: 'NUXT_AZURE_OPENAI_API_VERSION'
value: nuxtAzureOpenaiApiVersion
}
{
name: 'NUXT_AZURE_OPENAI_ENDPOINT'
value: nuxtAzureOpenaiEndpoint
}
{
name: 'NUXT_AZURE_OPENAI_DEPLOYMENT_ID'
value: nuxtAzureOpenaiDeploymentId
}
]
}
}
Expand Down
61 changes: 61 additions & 0 deletions components/WorkboxDataView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<script lang="ts" setup>
import type { Requirement } from '~/server/domain/requirements/Requirement';
import type { ParsedRequirement } from '~/server/domain/requirements/ParsedRequirement';
type RowType = { id: string; name: string; }
const props = defineProps<{
parsedRequirement: ParsedRequirement,
onApprove: (parentId: string, itemId: string) => Promise<void>,
onReject: (parentId: string, itemId: string) => Promise<void>
}>()
const confirm = useConfirm()
type RequirementType = { type: string, items: Requirement[] }
const requirements: RequirementType[] = Object.entries(props.parsedRequirement)
.filter(([_, value]) => Array.isArray(value) && value.length > 0)
.map(([key, value]) => ({ type: key, items: value as Requirement[] }))
const onReject = (parentId: string, item: RowType) => new Promise<void>((resolve, _reject) => {
confirm.require({
message: `Are you sure you want to reject ${item.name}?`,
header: 'Delete Confirmation',
icon: 'pi pi-exclamation-triangle',
rejectLabel: 'Cancel',
acceptLabel: 'Reject',
accept: async () => {
await props.onReject(parentId, item.id)
resolve()
},
reject: () => { }
})
})
</script>
<template>
<ConfirmDialog></ConfirmDialog>
<DataView :value="requirements" :data-key="undefined">
<template #list="{ items }: { items: RequirementType[] }">
<div v-for="(requirements, index) in items" :key="index" :value="requirements">
<DataTable :value="requirements.items">
<template #header>
<div class="flex flex-wrap align-items-center justify-content-between gap-2">
<span class="text-xl text-900 font-bold">{{ requirements.type }}</span>
</div>
</template>
<Column v-for="col of Object.keys(requirements.items[0])" :key="col" :field="col" :header="col">
</Column>
<!--
<Column header="Actions" frozen align-frozen="right">
<template #body="{ data }">
<Button icon="pi pi-eye" class="text rounded mr-2" />
<Button icon="pi pi-trash" text rounded severity="danger" />
</template>
</Column>
-->
</DataTable>
</div>
</template>
</DataView>
</template>
Loading

0 comments on commit 4f1a7f3

Please sign in to comment.