From efdef874d7c24a9e48fdb0f96652021e96fd9f92 Mon Sep 17 00:00:00 2001 From: Developers Digest <124798203+developersdigest@users.noreply.github.com> Date: Fri, 8 Aug 2025 11:13:52 -0400 Subject: [PATCH] final updates --- app/api/generate-ai-code-stream/route.ts | 11 ++----- app/page.tsx | 42 ++++++++++++++++++++++++ config/app.config.ts | 10 ++---- package-lock.json | 4 +-- package.json | 3 +- pnpm-lock.yaml | 20 ++--------- 6 files changed, 54 insertions(+), 36 deletions(-) diff --git a/app/api/generate-ai-code-stream/route.ts b/app/api/generate-ai-code-stream/route.ts index c3fa83e..002723b 100644 --- a/app/api/generate-ai-code-stream/route.ts +++ b/app/api/generate-ai-code-stream/route.ts @@ -1151,9 +1151,7 @@ CRITICAL: When files are provided in the context: const isOpenAI = model.startsWith('openai/gpt-5'); const modelProvider = isAnthropic ? anthropic : (isOpenAI ? openai : groq); const actualModel = isAnthropic ? model.replace('anthropic/', '') : - (model === 'openai/gpt-5') ? 'gpt-5' : - (model === 'openai/gpt-5-nano') ? 'gpt-5-nano' : - (model === 'openai/gpt-5-mini') ? 'gpt-5-mini' : model; + (model === 'openai/gpt-5') ? 'gpt-5' : model; // Make streaming API call with appropriate provider const streamOptions: any = { @@ -1231,14 +1229,9 @@ It's better to have 3 complete files than 10 incomplete files.` // Add reasoning effort for GPT-5 models if (isOpenAI) { - let reasoningEffort = 'medium'; // default for gpt-5-nano and gpt-5-mini - if (model === 'openai/gpt-5') { - reasoningEffort = 'high'; - } - streamOptions.experimental_providerMetadata = { openai: { - reasoningEffort: reasoningEffort + reasoningEffort: 'high' } }; } diff --git a/app/page.tsx b/app/page.tsx index fdf80b6..43b01d5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -3247,6 +3247,48 @@ Focus on the key sections and content, making it clean and modern.`; )} + + {/* Live streaming response display */} + {generationProgress.streamedCode && ( + +
+
+
+ AI Response Stream +
+
+
+
+ + {(() => { + const lastContent = generationProgress.streamedCode.slice(-1000); + // Show the last part of the stream, starting from a complete tag if possible + const startIndex = lastContent.indexOf('<'); + return startIndex !== -1 ? lastContent.slice(startIndex) : lastContent; + })()} + + +
+ + )}
)}
diff --git a/config/app.config.ts b/config/app.config.ts index 3434eb5..ce468f0 100644 --- a/config/app.config.ts +++ b/config/app.config.ts @@ -28,24 +28,20 @@ export const appConfig = { // AI Model Configuration ai: { // Default AI model - defaultModel: 'openai/gpt-5-nano', + defaultModel: 'moonshotai/kimi-k2-instruct', // Available models availableModels: [ - 'openai/gpt-5-nano', - 'openai/gpt-5-mini', 'openai/gpt-5', 'moonshotai/kimi-k2-instruct', - 'anthropic/claude-3-5-sonnet-20241022' + 'anthropic/claude-sonnet-4-20250514' ], // Model display names modelDisplayNames: { - 'openai/gpt-5-nano': 'GPT-5 Nano', - 'openai/gpt-5-mini': 'GPT-5 Mini', 'openai/gpt-5': 'GPT-5', 'moonshotai/kimi-k2-instruct': 'Kimi K2 Instruct', - 'anthropic/claude-3-5-sonnet-20241022': 'Claude 3.5 Sonnet' + 'anthropic/claude-sonnet-4-20250514': 'Sonnet 4' }, // Temperature settings for non-reasoning models diff --git a/package-lock.json b/package-lock.json index 6e4aa8e..385ab79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,8 @@ "react-icons": "^5.5.0", "react-syntax-highlighter": "^15.6.1", "tailwind-merge": "^3.3.1", - "tailwindcss-animate": "^1.0.7" + "tailwindcss-animate": "^1.0.7", + "zod": "^3.25.76" }, "devDependencies": { "@eslint/eslintrc": "^3", @@ -6211,7 +6212,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index a4c5c77..83a7923 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "react-icons": "^5.5.0", "react-syntax-highlighter": "^15.6.1", "tailwind-merge": "^3.3.1", - "tailwindcss-animate": "^1.0.7" + "tailwindcss-animate": "^1.0.7", + "zod": "^3.25.76" }, "devDependencies": { "@eslint/eslintrc": "^3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b4ad36..d7ec216 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,9 +23,6 @@ importers: '@e2b/code-interpreter': specifier: ^1.5.1 version: 1.5.1 - '@e2b/sdk': - specifier: ^1.13.2 - version: 1.13.2 '@radix-ui/react-slot': specifier: ^1.2.3 version: 1.2.3(@types/react@19.1.9)(react@19.1.0) @@ -53,6 +50,9 @@ importers: dotenv: specifier: ^17.2.1 version: 17.2.1 + e2b: + specifier: ^1.13.2 + version: 1.13.2 express: specifier: ^5.1.0 version: 5.1.0 @@ -185,11 +185,6 @@ packages: resolution: {integrity: sha512-mkyKjAW2KN5Yt0R1I+1lbH3lo+W/g/1+C2lnwlitXk5wqi/g94SEO41XKdmDf5WWpKG3mnxWDR5d6S/lyjmMEw==} engines: {node: '>=18'} - '@e2b/sdk@1.13.2': - resolution: {integrity: sha512-63NiOOB7Pg6a7OnpF5pGZxQ0GhdVSJ92BjbDGm/oh890prbMrxPdoxd2Ll3chFdBpEKvizcngLbuu2AS43dGZw==} - engines: {node: '>=18'} - deprecated: 'The package @e2b/sdk has been renamed to e2b. Please uninstall the old one and install the new by running following command: npm uninstall @e2b/sdk && npm install e2b' - '@emnapi/core@1.4.5': resolution: {integrity: sha512-XsLw1dEOpkSX/WucdqUhPWP7hDxSvZiY+fsUC14h+FtQ2Ifni4znbBt8punRX+Uj2JG/uDb8nEHVKvrVlvdZ5Q==} @@ -2578,15 +2573,6 @@ snapshots: dependencies: e2b: 1.13.2 - '@e2b/sdk@1.13.2': - dependencies: - '@bufbuild/protobuf': 2.6.3 - '@connectrpc/connect': 2.0.0-rc.3(@bufbuild/protobuf@2.6.3) - '@connectrpc/connect-web': 2.0.0-rc.3(@bufbuild/protobuf@2.6.3)(@connectrpc/connect@2.0.0-rc.3(@bufbuild/protobuf@2.6.3)) - compare-versions: 6.1.1 - openapi-fetch: 0.9.8 - platform: 1.3.6 - '@emnapi/core@1.4.5': dependencies: '@emnapi/wasi-threads': 1.0.4