[PR #2352] [CLOSED] Standardize fetch API #36598

Closed
opened 2026-04-25 10:24:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/2352
Author: @elliottlawrence
Created: 5/17/2024
Status: ❌ Closed

Base: dev ← Head: fetch-api


📝 Commits (2)

📊 Changes

15 files changed (+367 additions, -2549 deletions)

View changed files

📝 src/lib/apis/audio/index.ts (+12 -82)
📝 src/lib/apis/auths/index.ts (+46 -304)
📝 src/lib/apis/chats/index.ts (+58 -476)
📝 src/lib/apis/configs/index.ts (+7 -42)
📝 src/lib/apis/documents/index.ts (+19 -145)
📝 src/lib/apis/images/index.ts (+35 -318)
📝 src/lib/apis/index.ts (+20 -143)
📝 src/lib/apis/litellm/index.ts (+11 -76)
📝 src/lib/apis/modelfiles/index.ts (+14 -116)
📝 src/lib/apis/ollama/index.ts (+25 -145)
📝 src/lib/apis/openai/index.ts (+15 -136)
📝 src/lib/apis/prompts/index.ts (+15 -118)
📝 src/lib/apis/rag/index.ts (+47 -326)
📝 src/lib/apis/users/index.ts (+18 -122)
📝 src/lib/apis/utils/index.ts (+25 -0)

📄 Description

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.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • 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

There are quite a few places in the frontend code that use a similar pattern of calling fetch() and then dealing with error handling. This should probably be standardized with a helper function.


Changelog Entry

Added

Fixed

Changed

  • Refactored fetch calls to have standardized error handling

Removed

Security

Breaking Changes


Additional Information

I tried to be somewhat cautious about changing existing callsites of fetch. Most of them follow the same pattern but some are slightly different and I left those as-is. I figured this would be a good start and the rest can be cleaned up later.

I did a sanity check that the UI still seems to work, but there are quite a few changes here so I haven't tested every API call.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/2352 **Author:** [@elliottlawrence](https://github.com/elliottlawrence) **Created:** 5/17/2024 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fetch-api` --- ### 📝 Commits (2) - [`2b53aaa`](https://github.com/open-webui/open-webui/commit/2b53aaaf2692aaff257cbf21a196caffb8740041) Standardize fetch api - [`1b1340a`](https://github.com/open-webui/open-webui/commit/1b1340a9498fbcf6606355e91aa167d370b63d8c) Revert some risky changes ### 📊 Changes **15 files changed** (+367 additions, -2549 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/apis/audio/index.ts` (+12 -82) 📝 `src/lib/apis/auths/index.ts` (+46 -304) 📝 `src/lib/apis/chats/index.ts` (+58 -476) 📝 `src/lib/apis/configs/index.ts` (+7 -42) 📝 `src/lib/apis/documents/index.ts` (+19 -145) 📝 `src/lib/apis/images/index.ts` (+35 -318) 📝 `src/lib/apis/index.ts` (+20 -143) 📝 `src/lib/apis/litellm/index.ts` (+11 -76) 📝 `src/lib/apis/modelfiles/index.ts` (+14 -116) 📝 `src/lib/apis/ollama/index.ts` (+25 -145) 📝 `src/lib/apis/openai/index.ts` (+15 -136) 📝 `src/lib/apis/prompts/index.ts` (+15 -118) 📝 `src/lib/apis/rag/index.ts` (+47 -326) 📝 `src/lib/apis/users/index.ts` (+18 -122) 📝 `src/lib/apis/utils/index.ts` (+25 -0) </details> ### 📄 Description ## Pull Request Checklist - [x] **Target branch:** Pull requests should target the `dev` branch. - [x] **Description:** Briefly describe the changes in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ ] **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 There are quite a few places in the frontend code that use a similar pattern of calling `fetch()` and then dealing with error handling. This should probably be standardized with a helper function. --- ### Changelog Entry ### Added ### Fixed ### Changed - Refactored `fetch` calls to have standardized error handling ### Removed ### Security ### Breaking Changes --- ### Additional Information I tried to be somewhat cautious about changing existing callsites of `fetch`. Most of them follow the same pattern but some are slightly different and I left those as-is. I figured this would be a good start and the rest can be cleaned up later. I did a sanity check that the UI still seems to work, but there are quite a few changes here so I haven't tested every API call. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 10:24:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#36598