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

chore/feat: frontend API DRYing #2233

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

chore/feat: frontend API DRYing #2233

wants to merge 2 commits into from

Conversation

akx
Copy link
Contributor

@akx akx commented May 13, 2024

Pull Request Checklist

  • Target branch: Pull requests should target the dev branch.
  • Description: Briefly describe the changes in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Testing: Have you written and run sufficient tests for the changes?
  • Code Review: Have you self-reviewed your code and addressed any coding standard issues?

Description

This PR is a continuation/rework of #2227.

It refactors most frontend API calls into a couple of idiomatic helpers wherever possible. As discussed in #2227's comments, while the helpers are generic over the expected API return type, they're purposefully loose for the time being; users may opt-in to doing do...Request<T>.

Notes/Code Review

The main refactoring commit was done manually; I tried to be careful that the calls are equivalent to what the preimage was, but of course something could have slipped past these non-AI eyeballs.

Testing

Since there are no automated tests for the backend, I did some manual testing.

I tested that the app seems to work (signup, signin, ollama chat, llava "what's in this image", tagging, etc.).


Changelog Entry

Changed

  • Refactored frontend API calls and error handling to reduce repetition.

@akx akx mentioned this pull request May 13, 2024
7 tasks
src/lib/apis/audio/index.ts Outdated Show resolved Hide resolved
@akx
Copy link
Contributor Author

akx commented May 15, 2024

Btw, I can split this into multiple PRs that refactor a couple of files at a time if it'd make things easier to review ✌️

@akx akx marked this pull request as draft May 27, 2024 14:35
@akx akx force-pushed the api-helpers branch 2 times, most recently from db8bb02 to 4cc870d Compare May 27, 2024 14:45
@akx akx marked this pull request as ready for review May 27, 2024 14:52
@akx
Copy link
Contributor Author

akx commented May 27, 2024

@tjbck Rebased. CI errors seem unrelated.

@akx akx requested a review from tjbck May 27, 2024 14:52
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.

None yet

2 participants