Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Writing assistant v2 - #487

Draft
samlhuillier wants to merge 22 commits into
mainfrom
writing-assistant-v2
Draft

Writing assistant v2#487
samlhuillier wants to merge 22 commits into
mainfrom
writing-assistant-v2

Conversation

@samlhuillier

Copy link
Copy Markdown
Collaborator

No description provided.

@samlhuillier
samlhuillier marked this pull request as draft November 13, 2024 23:04

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added AI-powered text editing capabilities and document statistics while removing the backlink suggestions system.

  • New AIEdit.tsx component sends raw text to /api/generate endpoint without content validation or sanitization, potential security concern
  • Missing error handling and loading states in AI editing operations in AIEdit.tsx
  • Event listener cleanup missing in DocumentStats.tsx useEffect hook, potential memory leak
  • Empty onEdit callback in EditorManager.tsx for AI edit menu makes feature non-functional
  • Continue writing button in AI menu lacks implementation

4 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile

Comment thread src/components/Editor/AIEdit.tsx Outdated
Comment on lines +17 to +23
const handleAction = async (action: string) => {
const prompt = `${action} the following text: ${selectedText}`
const completion = await complete(prompt)
if (completion) {
onEdit(completion)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: no error handling for failed API calls or rate limits. Add try/catch and show error state to user

Comment thread src/components/Editor/AIEdit.tsx Outdated

const handleAction = async (action: string) => {
const prompt = `${action} the following text: ${selectedText}`
const completion = await complete(prompt)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: missing loading state while waiting for completion. User has no feedback during API call

Comment thread src/components/Editor/AIEdit.tsx Outdated
Comment on lines +75 to +78
<Button variant="ghost" className="w-full justify-start text-gray-300 hover:bg-gray-800">
<Play className="mr-2 size-5 text-purple-500" />
Continue writing
</Button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: 'Continue writing' button has no onClick handler - appears to be non-functional

Comment on lines +11 to +24
useEffect(() => {
const initDocumentStats = async () => {
const showStats = await window.electronStore.getDocumentStats()
setShow(showStats)
}

initDocumentStats()

const handleDocStatsChange = (event: Electron.IpcRendererEvent, value: boolean) => {
setShow(value)
}

window.ipcRenderer.on('show-doc-stats-changed', handleDocStatsChange)
}, [])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: missing cleanup function to remove IPC event listener on unmount

Comment thread src/components/Editor/EditorManager.tsx Outdated
}}
>
{showAIPopup ? (
<AiEditMenu selectedText={editor.getText()} onEdit={() => {}} />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: onEdit prop is passed an empty function - AI edits will not be applied to the editor

Comment thread src/components/Editor/EditorManager.tsx Outdated
className="flex gap-2 rounded-lg border border-gray-700 bg-dark-gray-c-eleven p-2 shadow-lg"
editor={editor}
tippyOptions={{
duration: 1000,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: 1000ms duration for bubble menu animation may feel slow for frequent interactions

@@ -52,26 +42,40 @@ const EditorManager: React.FC = () => {
window.ipcRenderer.on('editor-flex-center-changed', handleEditorChange)
}, [])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: missing cleanup for ipcRenderer event listener

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant