Skip to content

Commit

Permalink
Merge pull request open-webui#2465 from open-webui/dev
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
tjbck authored May 21, 2024
2 parents 3355577 + 6b57d8d commit d43ee0f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 38 deletions.
44 changes: 37 additions & 7 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
37 changes: 21 additions & 16 deletions src/routes/(app)/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<script lang="ts">
import { v4 as uuidv4 } from 'uuid';
import { toast } from 'svelte-sonner';
import { v4 as uuidv4 } from 'uuid';
import { onMount, tick, getContext } from 'svelte';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { getContext, onMount, tick } from 'svelte';
import {
models,
modelfiles,
user,
settings,
chats,
chatId,
config,
WEBUI_NAME,
tags as _tags,
showSidebar
chatId,
chats,
config,
modelfiles,
models,
settings,
showSidebar,
user
} from '$lib/stores';
import { copyToClipboard, splitStream } from '$lib/utils';
import { generateChatCompletion, cancelOllamaRequest } from '$lib/apis/ollama';
import {
addTagById,
createNewChat,
Expand All @@ -30,18 +29,23 @@
getTagsById,
updateChatById
} from '$lib/apis/chats';
import { queryCollection, queryDoc } from '$lib/apis/rag';
import { cancelOllamaRequest, generateChatCompletion } from '$lib/apis/ollama';
import { generateOpenAIChatCompletion, generateTitle } from '$lib/apis/openai';
import { queryCollection, queryDoc } from '$lib/apis/rag';
import { queryMemory } from '$lib/apis/memories';
import { createOpenAITextStream } from '$lib/apis/streaming';
import MessageInput from '$lib/components/chat/MessageInput.svelte';
import Messages from '$lib/components/chat/Messages.svelte';
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import {
LITELLM_API_BASE_URL,
OLLAMA_API_BASE_URL,
OPENAI_API_BASE_URL,
WEBUI_BASE_URL
} from '$lib/constants';
import { RAGTemplate } from '$lib/utils/rag';
import { LITELLM_API_BASE_URL, OLLAMA_API_BASE_URL, OPENAI_API_BASE_URL } from '$lib/constants';
import { WEBUI_BASE_URL } from '$lib/constants';
import { createOpenAITextStream } from '$lib/apis/streaming';
import { queryMemory } from '$lib/apis/memories';
const i18n = getContext('i18n');
Expand Down Expand Up @@ -614,6 +618,7 @@
...messages
]
.filter((message) => message)
.filter((message) => message.content != '')
.map((message, idx, arr) => ({
role: message.role,
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
Expand Down
31 changes: 16 additions & 15 deletions src/routes/(app)/c/[id]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<script lang="ts">
import { v4 as uuidv4 } from 'uuid';
import { toast } from 'svelte-sonner';
import { v4 as uuidv4 } from 'uuid';
import { onMount, tick, getContext } from 'svelte';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import {
models,
modelfiles,
user,
settings,
chats,
chatId,
config,
WEBUI_NAME,
tags as _tags,
showSidebar
chatId,
chats,
config,
modelfiles,
models,
settings,
showSidebar,
user
} from '$lib/stores';
import { copyToClipboard, splitStream, convertMessagesToHistory } from '$lib/utils';
import { convertMessagesToHistory, copyToClipboard, splitStream } from '$lib/utils';
import { getContext, onMount, tick } from 'svelte';
import { generateChatCompletion, cancelOllamaRequest } from '$lib/apis/ollama';
import {
addTagById,
createNewChat,
Expand All @@ -30,20 +29,21 @@
getTagsById,
updateChatById
} from '$lib/apis/chats';
import { cancelOllamaRequest, generateChatCompletion } from '$lib/apis/ollama';
import { generateOpenAIChatCompletion, generateTitle } from '$lib/apis/openai';
import MessageInput from '$lib/components/chat/MessageInput.svelte';
import Messages from '$lib/components/chat/Messages.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { queryMemory } from '$lib/apis/memories';
import { createOpenAITextStream } from '$lib/apis/streaming';
import {
LITELLM_API_BASE_URL,
OPENAI_API_BASE_URL,
OLLAMA_API_BASE_URL,
OPENAI_API_BASE_URL,
WEBUI_BASE_URL
} from '$lib/constants';
import { createOpenAITextStream } from '$lib/apis/streaming';
import { queryMemory } from '$lib/apis/memories';
const i18n = getContext('i18n');
Expand Down Expand Up @@ -620,6 +620,7 @@
...messages
]
.filter((message) => message)
.filter((message) => message.content != '')
.map((message, idx, arr) => ({
role: message.role,
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
Expand Down

0 comments on commit d43ee0f

Please sign in to comment.