Skip to content
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

unused code in financial-data-analyst route.ts #234

Open
matthew-dews opened this issue Jan 25, 2025 · 0 comments
Open

unused code in financial-data-analyst route.ts #234

matthew-dews opened this issue Jan 25, 2025 · 0 comments

Comments

@matthew-dews
Copy link

fileData in financial-data-analyst\app\api\finance\route.ts appears like it will never be used as the frontend will never populate that field. This looks like a vestige of a refactor as the frontend ends up constructing the meat of what gets sent to the Anthropic API.

I see two ways to resolve this:

  • Remove all usage of fileData in route.ts. This is the most straightforward but a benefit of having that functionality on the backend is you don't allow a malicious frontend to insert extra stuff into what gets sent to the Anthropic API.
  • Move all the work done by apiMessages in app\finance\page.tsx to be done on the backend. More work but maybe a better practice to follow?

This is an example app, so maybe the security aspect isn't worth worrying about here. At the very least I found it confusing to have this functionality in both places because I initially modified what was in route.ts and it took me a while to figure out why the change wasn't having any effect (I actually needed to make the change in page.tsx).

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

No branches or pull requests

1 participant