mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-24 06:20:20 -05:00
Scanned PDFs often store their pages as JPEG2000 images, which many scanning and OCR tools do by default. Opening such a file showed those pages and their thumbnails as blank white pages. The app now ships the image decoder the PDF viewer needs for that format, so those pages show up as they should. Fixes #33905
83 lines
1.7 KiB
TypeScript
83 lines
1.7 KiB
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vite';
|
|
import { resolveBuildInfo } from './scripts/build-info.js';
|
|
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
|
|
const backendTarget = process.env.WEBUI_BACKEND_URL || 'http://localhost:8080';
|
|
const buildInfo = resolveBuildInfo();
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
conditions: ['onnxruntime-web-use-extern-wasm']
|
|
},
|
|
plugins: [
|
|
sveltekit(),
|
|
viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: 'src/lib/encryption/vendor/THIRD_PARTY_LICENSES.txt',
|
|
dest: 'licenses/encryption'
|
|
},
|
|
{
|
|
src: ['node_modules/@novnc/novnc/docs/LICENSE*', 'node_modules/@novnc/novnc/AUTHORS'],
|
|
dest: 'licenses/novnc'
|
|
},
|
|
{
|
|
src: 'node_modules/onnxruntime-web/dist/*.jsep.*',
|
|
|
|
dest: 'wasm'
|
|
},
|
|
{
|
|
src: 'node_modules/pdfjs-dist/wasm/*',
|
|
dest: 'wasm'
|
|
}
|
|
]
|
|
})
|
|
],
|
|
define: {
|
|
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
|
APP_BUILD_HASH: JSON.stringify(buildInfo.hash),
|
|
APP_BUILD_CHANNEL: JSON.stringify(buildInfo.channel)
|
|
},
|
|
build: {
|
|
target: 'es2022',
|
|
sourcemap: true
|
|
},
|
|
optimizeDeps: {
|
|
esbuildOptions: { target: 'es2022' }
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: backendTarget,
|
|
changeOrigin: true,
|
|
ws: true
|
|
},
|
|
'/ollama': {
|
|
target: backendTarget,
|
|
changeOrigin: true
|
|
},
|
|
'/openai': {
|
|
target: backendTarget,
|
|
changeOrigin: true
|
|
},
|
|
'/oauth': {
|
|
target: backendTarget,
|
|
changeOrigin: true
|
|
},
|
|
'/ws': {
|
|
target: backendTarget,
|
|
changeOrigin: true,
|
|
ws: true
|
|
}
|
|
}
|
|
},
|
|
worker: {
|
|
format: 'es'
|
|
},
|
|
esbuild: {
|
|
pure: process.env.ENV === 'dev' ? [] : ['console.log', 'console.debug', 'console.error']
|
|
}
|
|
});
|