Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/chore-update-registry1-weekly-bu…
Browse files Browse the repository at this point in the history
…ndle-0.13.0' into 835-upgrade-vllm-for-gptq-bfloat16-inferencing
  • Loading branch information
justinthelaw committed Oct 1, 2024
2 parents af8c971 + d22439e commit 5c493ea
Show file tree
Hide file tree
Showing 60 changed files with 969 additions and 637 deletions.
76 changes: 45 additions & 31 deletions .github/workflows/nightly-snapshot-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
workflow_dispatch: # trigger manually as needed
pull_request:
types:
- opened # default trigger
- reopened # default trigger
- synchronize # default trigger
- ready_for_review # don't run on draft PRs
- milestoned # allows us to trigger on bot PRs
- opened # default trigger
- reopened # default trigger
- synchronize # default trigger
- ready_for_review # don't run on draft PRs
- milestoned # allows us to trigger on bot PRs
paths:
- .github/workflows/nightly-snapshot-release.yaml

Expand All @@ -23,10 +23,8 @@ defaults:
shell: bash

env:
# x-release-please-start-version
LEAPFROGAI_VERSION: 0.13.0
# x-release-please-end
SNAPSHOT_VERSION: snapshot-latest
SNAPSHOT_SUB_REPOSITORY: /uds/snapshots

permissions:
contents: read
Expand All @@ -47,7 +45,7 @@ jobs:
uses: ./.github/actions/release
with:
releaseTag: ${{ env.SNAPSHOT_VERSION }}
subRepository: /uds/snapshots/
subRepository: ${{ env.SNAPSHOT_SUB_REPOSITORY }}
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -65,73 +63,89 @@ jobs:
id-token: write # This is needed for OIDC federation.

steps:
- name: Checkout Repo (v${{ env.LEAPFROGAI_VERSION }})
# Checkout main just to see the latest release in the release-please manifest
- name: Checkout Repo (main)
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: v${{ env.LEAPFROGAI_VERSION }}

- name: Setup Python (v${{ env.LEAPFROGAI_VERSION }})
uses: ./.github/actions/python
ref: main

- name: Install Dev Dependencies
- name: Get Latest Release Version
id: get_version
run: |
python -m pip install ".[dev]" ".[dev-vllm]" ".[dev-whisper]"
LFAI_VERSION=$(jq -r '.["."]' .github/.release-please-manifest.json)
echo "LFAI_VERSION=$LFAI_VERSION" >> $GITHUB_OUTPUT
################
# LATEST RELEASE
################

# Checkout the latest release in the release-please manifest
- name: Checkout Repo (v${{ steps.get_version.outputs.LFAI_VERSION }})
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: v${{ steps.get_version.outputs.LFAI_VERSION }}

- name: Setup UDS Cluster
- name: Setup UDS Cluster (v${{ steps.get_version.outputs.LFAI_VERSION }})
uses: ./.github/actions/uds-cluster
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
chainguardIdentity: ${{ secrets.CHAINGUARD_IDENTITY }}

# This is needed due to delay in tagged release versus
# package publishing and the latest versions of each package in the UDS bundle
- name: Mutation of the UDS Bundle
# This is needed due to delay in tagged releases versus the version refs within the UDS bundles
- name: Mutation of the UDS Bundle (v${{ steps.get_version.outputs.LFAI_VERSION }})
run: |
uds zarf tools yq -i '.metadata.version = "v${{ env.LEAPFROGAI_VERSION }}"' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.metadata.version = "v${{ steps.get_version.outputs.LFAI_VERSION }}"' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.packages[].ref |= sub("^[^ ]+-upstream$", "${{ env.LEAPFROGAI_VERSION }}-upstream")' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.packages[].ref |= sub("^[^ ]+-upstream$", "${{ steps.get_version.outputs.LFAI_VERSION }}-upstream")' bundles/latest/cpu/uds-bundle.yaml
- name: Create and Deploy UDS Bundle (v${{ env.LEAPFROGAI_VERSION }})
- name: Create and Deploy UDS Bundle (v${{ steps.get_version.outputs.LFAI_VERSION }})
run: |
cd bundles/latest/cpu
uds create . --confirm && \
uds deploy uds-bundle-leapfrogai-amd64-v${{ env.LEAPFROGAI_VERSION }}.tar.zst --confirm --no-progress && \
rm -rf uds-bundle-leapfrogai-amd64-v${{ env.LEAPFROGAI_VERSION }}.tar.zst && \
uds deploy uds-bundle-leapfrogai-amd64-v${{ steps.get_version.outputs.LFAI_VERSION }}.tar.zst --confirm --no-progress && \
rm -rf uds-bundle-leapfrogai-amd64-v${{ steps.get_version.outputs.LFAI_VERSION }}.tar.zst && \
docker system prune -af
#################
# MAIN (SNAPSHOT)
#################

- name: Checkout Repo (main)
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: main

- name: Print the Commit SHA
- name: Print the Commit SHA (main)
run: |
COMMIT_SHA=$(git rev-parse HEAD)
echo "The latest commit on the main branch is: $COMMIT_SHA"
- name: Install Dev Dependencies (main)
run: |
python -m pip install ".[dev]" ".[dev-vllm]" ".[dev-whisper]" --force-reinstall --no-cache-dir
- name: Setup Python (main)
uses: ./.github/actions/python

# Set UDS CPU bundle refs and repositories to snapshot-latest
- name: Mutation of the UDS Bundle
- name: Mutation of the UDS Bundle (main)
run: |
uds zarf tools yq -i '.metadata.version = "${{ env.SNAPSHOT_VERSION }}"' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.packages[].ref |= sub("^[^ ]+-upstream$", "${{ env.SNAPSHOT_VERSION }}-upstream")' bundles/latest/cpu/uds-bundle.yaml
uds zarf tools yq -i '.packages[].repository |= sub("/uds/", "/uds/snapshots/")' bundles/latest/cpu/uds-bundle.yaml
- name: Create and Deploy UDS Bundle (${{ env.SNAPSHOT_VERSION }})
- name: Create and Deploy UDS Bundle (main)
run: |
cd bundles/latest/cpu
uds create . --confirm && \
uds deploy uds-bundle-leapfrogai-amd64-${{ env.SNAPSHOT_VERSION }}.tar.zst --confirm --no-progress && \
rm -rf uds-bundle-leapfrogai-amd64-${{ env.SNAPSHOT_VERSION }}.tar.zst && \
docker system prune -af
#########
# TESTING
#########

- name: Generate Secrets
id: generate_secrets
run: |
Expand Down
1 change: 0 additions & 1 deletion src/leapfrogai_ui/src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ declare global {
profile?: Profile;
threads?: LFThread[];
assistants?: LFAssistant[];
assistant?: LFAssistant;
files?: FileObject[];
keys?: APIKeyRow[];
}
Expand Down
18 changes: 8 additions & 10 deletions src/leapfrogai_ui/src/lib/components/AssistantAvatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
ignoreLocation: true
};
$: fileNotUploaded = !$form.avatarFile; // if on upload tab, you must upload a file to enable save
$: fileNotUploaded = !$form.avatar && !$form.avatarFile; // if on upload tab, you must upload a file to enable save
$: avatarToShow = $form.avatarFile ? URL.createObjectURL($form.avatarFile) : $form.avatar;
$: fileTooBig = $form.avatarFile?.size > MAX_AVATAR_SIZE;
Expand Down Expand Up @@ -66,9 +65,7 @@
modalOpen = false;
$form.avatar = originalAvatar;
tempPictogram = selectedPictogramName; // reset to original pictogram
if ($form.avatar) {
$form.avatarFile = $form.avatar; // reset to original file
} else {
if (!$form.avatar) {
clearFileInput();
}
fileUploaderRef.value = ''; // Reset the file input value to ensure input event detection
Expand Down Expand Up @@ -102,7 +99,7 @@
}
} else {
// pictogram tab
selectedPictogramName = tempPictogram; // TODO - can we remove this line
selectedPictogramName = tempPictogram;
$form.pictogram = tempPictogram;
$form.avatar = ''; // remove saved avatar
clearFileInput();
Expand Down Expand Up @@ -197,8 +194,6 @@
>
Upload from computer
</Button>

<input type="hidden" name="avatar" bind:value={$form.avatar} />
</div>

{#if hideUploader}
Expand All @@ -222,7 +217,9 @@
</div>
</div>
</Modal>
<!-- Important! These inputs must be outside of the modal or the image will be lost when the modal closes-->
<!-- Important! These inputs must be outside of the modal or the image will be lost when the modal closes
The hidden inputs will not be nested inside the parent <form> if they are included inside the modal
-->
<input
bind:this={fileUploaderRef}
on:input={(e) => {
Expand All @@ -236,5 +233,6 @@
name="avatarFile"
class="sr-only"
/>
<input type="hidden" name="pictogram" value={selectedPictogramName} />
<input type="hidden" name="avatar" bind:value={$form.avatar} />
<input type="hidden" name="pictogram" bind:value={selectedPictogramName} />
</div>
55 changes: 30 additions & 25 deletions src/leapfrogai_ui/src/lib/components/AssistantCard.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import { fade } from 'svelte/transition';
import { goto, invalidate } from '$app/navigation';
import { goto } from '$app/navigation';
import { Avatar, Button, Card, Dropdown, DropdownItem, Modal, P } from 'flowbite-svelte';
import { DotsHorizontalOutline, ExclamationCircleOutline } from 'flowbite-svelte-icons';
import DynamicPictogram from '$components/DynamicPictogram.svelte';
import { threadsStore, toastStore } from '$stores';
import { assistantsStore, toastStore } from '$stores';
import { NO_SELECTED_ASSISTANT_ID, STANDARD_FADE_DURATION } from '$constants';
import type { LFAssistant } from '$lib/types/assistants';
Expand All @@ -13,33 +13,38 @@
let deleteModalOpen = false;
const handleDelete = async () => {
const res = await fetch('/api/assistants/delete', {
method: 'DELETE',
body: JSON.stringify({ id: assistant.id }),
headers: {
'Content-Type': 'application/json'
try {
const res = await fetch('/api/assistants/delete', {
method: 'DELETE',
body: JSON.stringify({ id: assistant.id }),
headers: {
'Content-Type': 'application/json'
}
});
if (res.ok) {
assistantsStore.removeAssistant(assistant.id);
if ($assistantsStore.selectedAssistantId === assistant.id)
assistantsStore.setSelectedAssistantId(NO_SELECTED_ASSISTANT_ID);
toastStore.addToast({
kind: 'info',
title: 'Assistant Deleted.',
subtitle: `${assistant.name} Assistant deleted.`
});
} else {
toastStore.addToast({
kind: 'error',
title: 'Error',
subtitle: 'Error deleting Assistant.'
});
}
});
if ($threadsStore.selectedAssistantId === assistant.id)
threadsStore.setSelectedAssistantId(NO_SELECTED_ASSISTANT_ID);
deleteModalOpen = false;
if (res.ok) {
await invalidate('lf:assistants');
} catch {
toastStore.addToast({
kind: 'info',
title: 'Assistant Deleted.',
subtitle: `${assistant.name} Assistant deleted.`
kind: 'error',
title: 'Error',
subtitle: 'Error deleting Assistant.'
});
return;
}
toastStore.addToast({
kind: 'error',
title: 'Error',
subtitle: 'Error deleting Assistant.'
});
deleteModalOpen = false;
};
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { fade } from 'svelte/transition';
import { filesStore } from '$stores';
import type { FilesForm } from '$lib/types/files';
import { ACCEPTED_FILE_TYPES, STANDARD_FADE_DURATION } from '$constants';
import { ACCEPTED_DOC_TYPES, STANDARD_FADE_DURATION } from '$constants';
import AssistantFileDropdown from '$components/AssistantFileDropdown.svelte';
import FileUploaderItem from '$components/FileUploaderItem.svelte';
Expand All @@ -17,7 +17,7 @@
.filter((id) => $filesStore.selectedAssistantFileIds.includes(id));
</script>

<AssistantFileDropdown accept={ACCEPTED_FILE_TYPES} {filesForm} class="mb-6" />
<AssistantFileDropdown accept={ACCEPTED_DOC_TYPES} {filesForm} class="mb-6" />

<div class="grid grid-cols-2 gap-4">
{#each filteredStoreFiles as file}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import AssistantFileSelect from '$components/AssistantFileSelect.svelte';
import { superValidate } from 'sveltekit-superforms';
import { yup } from 'sveltekit-superforms/adapters';
import { filesSchema } from '$schemas/files';
import type { FileRow } from '$lib/types/files';
import type { LFFileObject } from '$lib/types/files';
import { getUnixSeconds } from '$helpers/dates';
import userEvent from '@testing-library/user-event';

const filesForm = await superValidate({}, yup(filesSchema), { errors: false });

describe('AssistantFileSelect', () => {
const mockFiles: FileRow[] = [
const mockFiles: LFFileObject[] = [
{ id: '1', filename: 'file1.pdf', status: 'complete', created_at: getUnixSeconds(new Date()) },
{ id: '2', filename: 'file2.pdf', status: 'error', created_at: getUnixSeconds(new Date()) },
{ id: '3', filename: 'file3.txt', status: 'uploading', created_at: getUnixSeconds(new Date()) }
Expand Down
18 changes: 13 additions & 5 deletions src/leapfrogai_ui/src/lib/components/AssistantForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
} from '$lib/constants';
import { superForm } from 'sveltekit-superforms';
import { page } from '$app/stores';
import { beforeNavigate, goto, invalidate } from '$app/navigation';
import { beforeNavigate, goto } from '$app/navigation';
import { Button, Modal, P } from 'flowbite-svelte';
import Slider from '$components/Slider.svelte';
import { yup } from 'sveltekit-superforms/adapters';
import { filesStore, toastStore, uiStore } from '$stores';
import { assistantsStore, filesStore, toastStore, uiStore } from '$stores';
import { assistantInputSchema, editAssistantInputSchema } from '$lib/schemas/assistants';
import type { NavigationTarget } from '@sveltejs/kit';
import { onMount } from 'svelte';
Expand All @@ -25,6 +25,10 @@
let bypassCancelWarning = false;
$: assistant = $assistantsStore.assistants.find(
(assistant) => assistant.id === $page.params.assistantId
);
const { form, errors, enhance, submitting, isTainted, delayed } = superForm(data.form, {
invalidateAll: false,
validators: yup(isEditMode ? editAssistantInputSchema : assistantInputSchema),
Expand Down Expand Up @@ -55,8 +59,12 @@
}
bypassCancelWarning = true;
await invalidate('lf:assistants');
goto(result.data.redirectUrl);
if (isEditMode) {
assistantsStore.updateAssistant(result.data.assistant);
} else {
assistantsStore.addAssistant(result.data.assistant);
}
await goto(result.data.redirectUrl);
} else if (result.type === 'failure') {
// 400 errors will show errors for the respective fields, do not show toast
if (result.status !== 400) {
Expand Down Expand Up @@ -174,7 +182,7 @@
<input
type="hidden"
name="vectorStoreId"
value={data?.assistant?.tool_resources?.file_search?.vector_store_ids[0] || undefined}
value={assistant?.tool_resources?.file_search?.vector_store_ids[0] || undefined}
/>

<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AssistantProgressToast from '$components/AssistantProgressToast.svelte';
import { render, screen } from '@testing-library/svelte';
import filesStore from '$stores/filesStore';
import { getFakeFiles } from '$testUtils/fakeData';
import { convertFileObjectToFileRows } from '$helpers/fileHelpers';
import { convertFileObjectToLFFileObject } from '$helpers/fileHelpers';
import { delay } from 'msw';
import { vi } from 'vitest';
import { toastStore } from '$stores';
Expand All @@ -27,7 +27,7 @@ describe('AssistantProgressToast', () => {
fileIds: files.map((file) => file.id),
vectorStoreId: '123'
};
filesStore.setFiles(convertFileObjectToFileRows(files));
filesStore.setFiles(convertFileObjectToLFFileObject(files));

const timeout = 10; //10ms
render(AssistantProgressToast, { timeout, toast }); //10ms timeout
Expand Down
Loading

0 comments on commit 5c493ea

Please sign in to comment.