From e142223ed14e8ba7448f99f4d7cf8a5e28ee14b7 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Mon, 20 May 2024 20:05:53 +0100 Subject: [PATCH 1/5] feat: cache docker layers to registry --- .github/workflows/docker-build.yaml | 44 ++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index e14a5d8e6..b5dd72192 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -63,6 +63,16 @@ jobs: flavor: | latest=${{ github.ref == 'refs/heads/main' }} + - name: Extract metadata for Docker cache + id: cache-meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.FULL_IMAGE_NAME }} + tags: | + type=ref,event=branch + flavor: | + prefix=cache-${{ matrix.platform }}- + - name: Build Docker image (latest) uses: docker/build-push-action@v5 id: build @@ -72,8 +82,8 @@ jobs: platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.FULL_IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=${{ steps.cache-meta.outputs.tags }} + cache-to: type=registry,ref=${{ steps.cache-meta.outputs.tags }},mode=max - name: Export digest run: | @@ -123,7 +133,7 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata for Docker images (default latest tag) + - name: Extract metadata for Docker images (cuda tag) id: meta uses: docker/metadata-action@v5 with: @@ -139,6 +149,16 @@ jobs: latest=${{ github.ref == 'refs/heads/main' }} suffix=-cuda,onlatest=true + - name: Extract metadata for Docker cache + id: cache-meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.FULL_IMAGE_NAME }} + tags: | + type=ref,event=branch + flavor: | + prefix=cache-cuda-${{ matrix.platform }}- + - name: Build Docker image (cuda) uses: docker/build-push-action@v5 id: build @@ -148,8 +168,8 @@ jobs: platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.FULL_IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=${{ steps.cache-meta.outputs.tags }} + cache-to: type=registry,ref=${{ steps.cache-meta.outputs.tags }},mode=max build-args: USE_CUDA=true - name: Export digest @@ -216,6 +236,16 @@ jobs: latest=${{ github.ref == 'refs/heads/main' }} suffix=-ollama,onlatest=true + - name: Extract metadata for Docker cache + id: cache-meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.FULL_IMAGE_NAME }} + tags: | + type=ref,event=branch + flavor: | + prefix=cache-ollama-${{ matrix.platform }}- + - name: Build Docker image (ollama) uses: docker/build-push-action@v5 id: build @@ -225,8 +255,8 @@ jobs: platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.FULL_IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=${{ steps.cache-meta.outputs.tags }} + cache-to: type=registry,ref=${{ steps.cache-meta.outputs.tags }},mode=max build-args: USE_OLLAMA=true - name: Export digest From 8116b04338716b97f8496a8213022e26c21b8f07 Mon Sep 17 00:00:00 2001 From: Aly Mobarak <147055589+AlyMobarak@users.noreply.github.com> Date: Tue, 21 May 2024 12:07:01 +0300 Subject: [PATCH 2/5] Filter message and don't send over any message that has empty contents to OpenAI's API. --- src/routes/(app)/c/[id]/+page.svelte | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 668cbba3e..ce9686fbd 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -1,25 +1,24 @@