-
-
Notifications
You must be signed in to change notification settings - Fork 6
fix: resolve Next.js build errors and optimize embeddings loading #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/nextjs16-gemini31-upgrade
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Chat } from '@/components/chat' | ||
| import { AI } from './actions' | ||
|
|
||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Stray page file compiled The new root-level app_page.tsx is included by tsconfig.json (**/*.tsx) and imports ./actions, which resolves relative to repo root and does not match the actual app/actions.tsx location. This can break next build/typecheck with a module resolution error. Agent Prompt
|
||
| export const maxDuration = 60 | ||
|
|
||
| import { MapDataProvider } from '@/components/map/map-data-context' | ||
|
|
||
| export default function Page() { | ||
| return ( | ||
| <AI initialAIState={{ chatId: 'new-chat', messages: [] }}> | ||
| <MapDataProvider> | ||
| <Chat /> | ||
| </MapDataProvider> | ||
| </AI> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,15 @@ type ChatProps = { | |
| id?: string // This is the chatId | ||
| } | ||
|
|
||
| export function Chat({ id }: ChatProps) { | ||
| export function Chat({ id: initialId }: ChatProps) { | ||
| const [id, setId] = useState(initialId || '') | ||
|
|
||
| useEffect(() => { | ||
| if (!id || id === 'new-chat') { | ||
| setId(crypto.randomUUID()) | ||
| } | ||
| }, [id]) | ||
|
Comment on lines
+29
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Chat ids diverge client/server On the landing page, AI state initializes with chatId: 'new-chat' while the Chat component
generates a different UUID in local state and updates the URL to /search/{uuid}. Server
persistence uses the AI state’s chatId, and chat-db.saveChat deletes 'new-chat' to let the DB
generate another UUID, causing chat fragmentation and DB writes (e.g., updateDrawingContext) to
target a non-existent chatId.
Agent Prompt
|
||
|
|
||
| const router = useRouter() | ||
| const path = usePathname() | ||
| const [messages] = useUIState() | ||
|
|
@@ -70,7 +78,7 @@ export function Chat({ id }: ChatProps) { | |
| }, []) | ||
|
|
||
| useEffect(() => { | ||
| if (!path.includes('search') && messages.length === 1) { | ||
| if (id && id !== 'new-chat' && !path.includes('search') && messages.length === 1) { | ||
| window.history.replaceState({}, '', `/search/${id}`) | ||
| } | ||
| }, [id, path, messages.length]) // OPTIMIZATION: Use messages.length instead of full array | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Chat updates lack ownership check
🐞 Bug⛨ SecurityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools