diff --git a/README.md b/README.md index 306b88b5..400d07e1 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ project, please check the [project management guide](./PROJECT.md) to get starte - ✅ Deploy directly to Vercel - ✅ Deploy directly to Cloudflare Pages - ✅ Supabase Integration (@xKevIsDev) -- ⬜ Have LLM plan the project in a MD file for better results/transparency +- ✅ Have LLM plan the project in a MD file for better results/transparency - ✅ VSCode Integration with git-like confirmations - ⬜ Upload documents for knowledge - UI design templates, a code base to reference coding style, etc. - ✅ Voice prompting diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index 1ef9cd15..9fe76319 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/components/chat/Chat.client.tsx @@ -316,6 +316,8 @@ export const ChatImpl = memo( let finalMessageContent = messageContent; + let uploadArtifact = ''; + if (selectedElement) { console.log('Selected Element:', selectedElement); @@ -437,14 +439,13 @@ export const ChatImpl = memo( const uploadedMap: { [path: string]: string } = {}; uploadedFiles.forEach((file, idx) => { const text = textDataList[idx]; + if (text) { uploadedMap[file.name] = escapeBoltTags(text); } }); - const uploadArtifact = - Object.keys(uploadedMap).length > 0 - ? uploadedFilesToArtifacts(uploadedMap, `uploaded-${Date.now()}`) - : ''; + uploadArtifact = + Object.keys(uploadedMap).length > 0 ? uploadedFilesToArtifacts(uploadedMap, `uploaded-${Date.now()}`) : ''; if (modifiedFiles !== undefined) { const userUpdateArtifact = filesToArtifacts(modifiedFiles, `${Date.now()}`); diff --git a/app/components/chat/ChatBox.tsx b/app/components/chat/ChatBox.tsx index b632c470..6bb246d9 100644 --- a/app/components/chat/ChatBox.tsx +++ b/app/components/chat/ChatBox.tsx @@ -296,6 +296,19 @@ export const ChatBox: React.FC = (props) => { onStop={props.stopListening} disabled={props.isStreaming} /> + + props.handleSendMessage?.( + event, + 'Plan the project in a plan.md file with sections: Files/components needed, Data flow, Deployment plan.', + ) + } + > +
+ Plan + {props.chatStarted && ( void; } -const FilePreview: React.FC = ({ files, imageDataList, textDataList, onRemove }) => { +const FilePreview: React.FC = ({ files, imageDataList, textDataList: _textDataList, onRemove }) => { if (!files || files.length === 0) { return null; } diff --git a/app/utils/targetFiles.ts b/app/utils/targetFiles.ts index e26c2457..c39f2231 100644 --- a/app/utils/targetFiles.ts +++ b/app/utils/targetFiles.ts @@ -1,9 +1,4 @@ -import { - addTargetedFile, - removeTargetedFile, - isFileTargeted as isFileTargetedInternal, - getTargetedFiles, -} from '~/lib/persistence/targetedFiles'; +import { isFileTargeted as isFileTargetedInternal, getTargetedFiles } from '~/lib/persistence/targetedFiles'; import { createScopedLogger } from './logger'; const logger = createScopedLogger('TargetFiles'); @@ -12,10 +7,12 @@ export function getCurrentChatId(): string { try { if (typeof window !== 'undefined') { const match = window.location.pathname.match(/\/chat\/([^/]+)/); + if (match && match[1]) { return match[1]; } } + return 'default'; } catch (error) { logger.error('Failed to get current chat ID', error); @@ -37,6 +34,7 @@ export function hasTargetedFiles(chatId?: string): boolean { try { const currentChatId = chatId || getCurrentChatId(); const files = getTargetedFiles(); + return files.some((f) => f.chatId === currentChatId); } catch (error) { logger.error('Failed to check for targeted files', error); diff --git a/types/external.d.ts b/types/external.d.ts new file mode 100644 index 00000000..d7b1b745 --- /dev/null +++ b/types/external.d.ts @@ -0,0 +1,3 @@ +declare module 'pdfjs-dist/build/pdf.mjs'; +declare module 'pdfjs-dist/build/pdf.worker.mjs'; +declare module 'mammoth/mammoth.browser';