diff --git a/apps/web/src/index.ts b/apps/web/src/index.ts index 0b57405e..f50ba705 100644 --- a/apps/web/src/index.ts +++ b/apps/web/src/index.ts @@ -9,6 +9,8 @@ import { metadataService } from '@shumai/core/src/metadata/metadata' import { initTranscodeWorkflows } from '@shumai/transcode' import { workflowService } from '@shumai/workflow-core' import { app } from '@shumai/api' +import * as fs from 'fs' +import * as path from 'path' // Initialize workflows and activities for local executor mode initAgentWorkflows() @@ -43,17 +45,27 @@ if (process.env.WORKFLOW_EXECUTOR === 'temporal') { const server = Bun.serve({ port: 3000, - fetch: app.fetch, - routes: { - // Serve index.html for root - '/': index, + async fetch(req) { + const url = new URL(req.url) + const pathname = url.pathname - // Proxy API requests to Hono - '/api/*': app.fetch, - '/files/*': app.fetch, + if (pathname.startsWith('/api/') || pathname.startsWith('/files/')) { + return app.fetch(req) + } - // Catch-all for SPA routing (fallback to index.html) - '/*': index, + // Try serving from public folder + let publicFilePath = '' + if (pathname.startsWith('/public/')) { + publicFilePath = path.join(process.cwd(), 'packages/webui/public', pathname.substring(8)) + } else { + publicFilePath = path.join(process.cwd(), 'packages/webui/public', pathname) + } + + if (fs.existsSync(publicFilePath) && fs.statSync(publicFilePath).isFile()) { + return new Response(Bun.file(publicFilePath)) + } + + return index as unknown as Response }, development: process.env.NODE_ENV !== 'production', }) diff --git a/packages/core/src/agent/agent.test.ts b/packages/core/src/agent/agent.test.ts index c4c070ec..31dabca2 100644 --- a/packages/core/src/agent/agent.test.ts +++ b/packages/core/src/agent/agent.test.ts @@ -204,6 +204,7 @@ describe('AgentService', () => { avatar: avatarPresigned, providerId: provider.id, modelId: model.id, + thinkingLevel: 'medium', }) expect(agent?.id).toBeDefined() @@ -224,6 +225,7 @@ describe('AgentService', () => { avatar: avatarPresigned, providerId: agent.providerId!, modelId: agent.modelId!, + thinkingLevel: 'medium', }) expect(updated.user.image).toBe('files/01JK23456789ABCDEF01234567')