mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 04:16:03 -05:00
[PR #2233] [CLOSED] chore/feat: frontend API DRYing #7731
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/2233
Author: @akx
Created: 5/13/2024
Status: ❌ Closed
Base:
dev← Head:api-helpers📝 Commits (2)
1746712feat: add API request helpers for frontendb36b940chore: refactor APIs to use new helpers📊 Changes
16 files changed (+416 additions, -3807 deletions)
View changed files
📝
src/lib/apis/audio/index.ts(+4 -76)📝
src/lib/apis/auths/index.ts(+32 -381)📝
src/lib/apis/chats/index.ts(+62 -631)📝
src/lib/apis/configs/index.ts(+11 -107)📝
src/lib/apis/documents/index.ts(+21 -185)➕
src/lib/apis/helpers.ts(+96 -0)📝
src/lib/apis/images/index.ts(+21 -421)📝
src/lib/apis/index.ts(+23 -300)📝
src/lib/apis/memories/index.ts(+7 -167)📝
src/lib/apis/models/index.ts(+10 -143)📝
src/lib/apis/ollama/index.ts(+58 -440)📝
src/lib/apis/openai/index.ts(+5 -119)📝
src/lib/apis/prompts/index.ts(+14 -151)📝
src/lib/apis/rag/index.ts(+29 -415)📝
src/lib/apis/users/index.ts(+18 -231)📝
src/lib/apis/utils/index.ts(+5 -40)📄 Description
Pull Request Checklist
devbranch.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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.