Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/vibe-coding-ide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ npm i
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the backend.
Open [http://localhost:3000](http://localhost:3000) with your browser to see the frontend.
18 changes: 18 additions & 0 deletions python/vibe-coding-ide/frontend/src/hooks/useChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { API_BASE } from '../constants'
import { useProjects } from '../context/ProjectsContext'
import { computeProjectHashes } from '../lib/hash'

declare const process: { env: Record<string, string | undefined> }

interface UseChatProps {
userId: string
input: string
Expand Down Expand Up @@ -44,6 +46,22 @@ export const useChat = ({
useProjects()
const sendPrompt = useCallback(async () => {
if (!input.trim()) return
// In production, require NEXT_PUBLIC_API_URL to be set; otherwise show a user-facing error
const isProd = (process.env.NODE_ENV || '').trim() === 'production'
const hasApiUrl = Boolean((process.env.NEXT_PUBLIC_API_URL || '').trim())
if (isProd && !hasApiUrl) {
const errorRunId = `config_error_${Date.now()}`
createRun(errorRunId, input, projectId, threadId)
addAction(errorRunId, {
id: `notice_${Date.now()}`,
kind: 'system_notice',
status: 'done',
message:
'Missing environment variable: NEXT_PUBLIC_API_URL is not set. Set it to your backend URL and reload.',
timestamp: new Date().toISOString(),
} as Action)
return
}
setLoading(true)
setInput('')

Expand Down