Skip to content

Support file uploads on document update and enable admin document creation#12

Open
iqra1503 wants to merge 1 commit into
mainfrom
codex/fix-document-save-issue-and-add-admin-panel-feature-9xmbne
Open

Support file uploads on document update and enable admin document creation#12
iqra1503 wants to merge 1 commit into
mainfrom
codex/fix-document-save-issue-and-add-admin-panel-feature-9xmbne

Conversation

@iqra1503

@iqra1503 iqra1503 commented Mar 9, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Document edits that included uploaded replacement files were not being saved because the update endpoint only accepted JSON payloads.
  • Admins lacked the ability to create documents from the admin panel using the same upload/summary flow available to regular users.

Description

  • Update the backend PUT /documents/{document_id} handler to accept multipart/form-data (now async def update_document(...) accepts file, title, description, and summary) and extract uploaded file text with extract_text_from_upload while preserving the existing JSON update flow via DocumentUpdate validation.
  • When processing multipart updates the backend sets source_type, file_name, and file_type, and regenerates summary_embedding when summary is updated.
  • Change the frontend updateDocumentApi to send FormData when a file is present so file-based updates match the backend contract.
  • Extend the shared DocumentForm to allow file uploads in edit mode (and make the summary preview call a no-op when not provided), and wire the admin dashboard to use the same form so admins can create and edit documents and preview summaries.

Testing

  • Built the frontend with npm run build and the build completed successfully.
  • Compiled backend modules with python -m compileall backend/app and compilation succeeded without errors.
  • Manually exercised the frontend dev server and captured a screenshot to validate the admin form UI changes (playwright script run succeeded).

Codex Task

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant