Skip to content

Remove unused fileData code in financial-data-analyst route.ts#365

Open
LuciferDono wants to merge 1 commit into
anthropics:mainfrom
LuciferDono:LuciferDono/remove-unused-filedata-234
Open

Remove unused fileData code in financial-data-analyst route.ts#365
LuciferDono wants to merge 1 commit into
anthropics:mainfrom
LuciferDono:LuciferDono/remove-unused-filedata-234

Conversation

@LuciferDono
Copy link
Copy Markdown

Summary

The financial-data-analyst/app/api/finance/route.ts API route contains dead code for handling fileData that is never sent by the frontend. The frontend (page.tsx) constructs { messages, model } and sends it to /api/financefileData is never included in the request body.

Fixes #234.

Root Cause

The fileData handling appears to be a vestige of a prior refactor. The frontend now constructs the full message content (including file attachments) client-side via apiMessages in page.tsx before sending to the API route. The backend's file processing code is unreachable.

Changes

Removed from route.ts:

  • isValidBase64 helper function (defined but never called)
  • fileData from request body destructuring
  • fileData-related fields from the initial request log
  • Entire fileData handling block (~57 lines of dead code for text/image file processing)
  • Changed let anthropicMessages to const since it is no longer reassigned

Net: 72 lines removed, 2 lines changed. Zero behavior change.

Verification

  • Confirmed page.tsx sends { messages: apiMessages, model: selectedModel } only (line 434-437)
  • No other file in the project references fileData in the context of the finance API route
  • isValidBase64 had zero call sites

The frontend sends only { messages, model } to /api/finance. The fileData
handling block (lines 137-193), isValidBase64 helper, and related log
fields were unreachable dead code left from a prior refactor.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unused code in financial-data-analyst route.ts

1 participant