diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 38730ca..7d4d3a6 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -8,9 +8,13 @@ ENV PUBLIC_CONVEX_URL=$PUBLIC_CONVEX_URL WORKDIR /app +COPY package.json bun.lock* ./ + +RUN bun install --frozen-lockfile + COPY . . -RUN bun i -RUN bun run build +RUN bun --bun svelte-kit sync +RUN bun --bun run build ENTRYPOINT ["bun"] diff --git a/frontend/bun.lock b/frontend/bun.lock index 8f6e8b2..e772d16 100644 --- a/frontend/bun.lock +++ b/frontend/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "frontend", diff --git a/frontend/src/lib/components/ChatInput.svelte b/frontend/src/lib/components/ChatInput.svelte index 2e64560..0bdbde1 100644 --- a/frontend/src/lib/components/ChatInput.svelte +++ b/frontend/src/lib/components/ChatInput.svelte @@ -17,19 +17,19 @@ } -
diff --git a/frontend/src/lib/convex-polling.svelte.ts b/frontend/src/lib/convex-polling.svelte.ts new file mode 100644 index 0000000..627e4ae --- /dev/null +++ b/frontend/src/lib/convex-polling.svelte.ts @@ -0,0 +1,109 @@ +import { ConvexHttpClient } from 'convex/browser'; +import { getContext, setContext } from 'svelte'; +import type { FunctionReference, FunctionArgs, FunctionReturnType } from 'convex/server'; + +const POLLING_CONTEXT_KEY = 'convex-polling'; +const POLL_INTERVAL = 1000; + +type PollingContext = { + client: ConvexHttpClient; +}; + +export function hasWebSocketSupport(): boolean { + if (typeof window === 'undefined') return true; + try { + return 'WebSocket' in window && typeof WebSocket !== 'undefined'; + } catch { + return false; + } +} + +export function setupPollingConvex(url: string): void { + const client = new ConvexHttpClient(url); + setContext