You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix production chat interface - remove hardcoded localhost URL
- Replace HTTP fetch to localhost with direct smart fallback function call
- Move system prompt logic from API route to server action
- Remove unused imports and helper functions
- Fix TypeScript type issues with history conversion
- Eliminate network overhead for same-server function calls
- Maintain all 9 models and smart fallback functionality
- Production-ready chat interface that works on Netlify
Resolves: Chat interface failing in production with 'fetch failed' errors
The chat interface was failing in production with "fetch failed" errors because the `generateResponse` function in `src/app/actions.ts` was making hardcoded localhost API calls that don't work in production environments.
return'Explain concepts in simple terms. Avoid jargon, use analogies, and break down complex ideas into easy steps. Assume no prior knowledge.';
56
+
case'expert':
57
+
return'Use technical terminology freely. Provide in-depth explanations, include advanced concepts, and assume strong foundational knowledge.';
58
+
default:
59
+
return'Balance technical accuracy with accessibility. Define specialized terms when first used and provide moderate detail.';
60
+
}
61
+
};
59
62
60
-
constdata=awaitresponse.json();
61
-
62
-
if(data.error){
63
-
return{error: data.error};
63
+
constsystemPrompt=`You are CODEEX AI, an intelligent and versatile assistant created by Heoster. You excel at helping users with coding, problem-solving, learning, and general questions.
0 commit comments